@xopcai/xopc 0.0.254 → 0.0.255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-Ci5Rxmi_.js → activity-store-DvjK5FEm.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D82jpmFL.js → agent-avatar-dicebear-Cqspzbf_.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CL3Mi-uM.js +1 -0
- package/dist/gateway/static/root/assets/agents-odqXmGhA.js +1 -0
- package/dist/gateway/static/root/assets/{api-CXIzQJ2Z.js → api-CsYi3heY.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-mhxcQpkQ.js → app-management-settings-panel-Gd4a5hdE.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BIMwACUF.js → appearance-settings-CZ6KOnbd.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DyBDoCam.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C63Xp_sU.js → archive-plugin-y82Rwhjm.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D12KYOav.js → attachment-load-D46SGNpv.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DXj0o5CY.js → automations-page-wilciIZ1.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-8U86Umig.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Bcv8hun6.js → binary-plugins-CuMkNNCe.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C61LqK_-.js → block-editor-DFnPsrxI.js} +24 -24
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CAclu735.js → browser-automation-inputs-hlmcSp4p.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BITfKX8L.js → browser-automations-page-OjZvbARU.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DOUG84qV.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CG73Mwi8.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-MDywEWWM.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-Cmbx0E8O.js → channels-status-swr-D1HHFzkE.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CNBgHN9U.js → chat-terminal-dock-Ce_T9BPq.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-D29p6Zvm.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DCTN4QAG.js → cron-expression-BRrCwYyD.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-C35RuuWW.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-l6IXzk0C.js → dependency-picker-4pNXVcRM.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DIfccDKS.js → desktop-pet-settings-BvV1UA5g.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-cGn_20DO.js → desktop-pet-z91GYnPf.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CTS5RP_D.js → extension-debug-page-CkVF5HvV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Dg9YssYH.js → extension-page-DW0zQGaB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CWZYL8Fi.js → extension-settings-page-BLQhizZ3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Chsr5wGH.js → gateway-config-swr-02BBC1mK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-vHI_Que8.js → gateway-settings-rAXx8FGP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C9ynH6VV.js → gateway-startup-retry-XZnY6621.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BaW_r1t9.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BoTS8-Z9.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D_TsVe7h.js → image-generation-api-CIcKz4Xs.js} +1 -1
- package/dist/gateway/static/root/assets/index-DsonmRCH.css +2 -0
- package/dist/gateway/static/root/assets/index-PksHo9hS.js +74 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGBf6YfD.js → keyboard-shortcuts-settings-yfaGz6SE.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3flRQH1.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DGWP_xsQ.js → local-apps-page-Cp-nEtgV.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-B2v8mNJw.js → locale-store-VsboRLD7.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DkqsRCri.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-DUAZ-dtt.js → management-settings-24_JyDPk.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DBWu9d_n.js → markdown-view-CPXhy6nh.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CsUjcIBy.js → media-plugins-CwLvIb9r.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DngsF_Kx.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-Dxu8twiQ.js → mobile-pairing-wizard-BbJCDv57.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-OklYXK7y.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BjfgJIQw.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-YeJKwV-7.js → page-tabs-0YXn9Gkl.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BfJ3jMDG.js → preview-open-alternatives-2jVV5kfZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B7NRGPox.js → product-open-page-D7p0NfTK.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-rLNM2mP0.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D6jY2ZWl.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B9OZUdwC.js → registry-api-DlTWbXQA.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DTO-faxH.js → remote-access-hub-CZZg0kXc.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-uJ8Br3ZL.js → runtime-tools-settings-panel-B-NDgmJ4.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-CXwn6up5.js → schema-form-DZYeBS1v.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BvuxJegi.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BAQHP4mB.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-YVNYsR0U.js → settings-form-section-zy5UMvPk.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-cHqrIdVR.js → settings-page-CTuipbJq.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BkWoc5j5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DnjSDQru.js → share-preview-page-D3Uawo_h.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-B2doziIn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-D2ymjqG5.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DkrGEdiY.js → skills-page-DDbabz7p.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CqZbiZuK.js → skills-page.utils-DkGhbiMa.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Dmw0RfxZ.js → system-settings-panel-Fc-WbX6-.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-7w7eB9nB.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CubltMKm.js → theme-store-vdB57bTn.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CiieC6HP.js → tunnel-api-DZ0evABj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-XQ3SuyB9.js → use-autosave-Ckof_m7e.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CcNCyrXZ.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-D4QzVgdt.js → voice-api-key-field-CnmtpWlq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B1ZbyVmF.js → voice-config-api-OA04c71t.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D5Tf8GRZ.js → work-discovery-overlay-sxvsDIC3.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CUCfBpPF.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-Bp-nvnLa.js +5 -0
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/src/agent/tools/create-share-tool.js +39 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/gateway/device-routes.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +404 -7
- package/dist/src/gateway/hono/routes/site-shares.js +19 -13
- package/dist/src/gateway/hono/routes/tunnel.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/share/hosted-note-publication.d.ts +22 -0
- package/dist/src/share/hosted-note-publication.js +96 -0
- package/dist/src/share/hosted-session-share.d.ts +86 -7
- package/dist/src/share/hosted-session-share.js +72 -15
- package/dist/src/share/hosted-static-site-publication.d.ts +16 -0
- package/dist/src/share/hosted-static-site-publication.js +108 -0
- package/dist/src/share/hosted-static-site-publish.d.ts +23 -0
- package/dist/src/share/hosted-static-site-publish.js +53 -0
- package/dist/src/share/note-share-service.d.ts +1 -0
- package/dist/src/share/note-share-service.js +4 -4
- package/dist/src/share/share-url.d.ts +1 -1
- package/dist/src/share/share-url.js +14 -9
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui-agent-events.js +1 -1
- package/dist/src/tunnel/index.js +1 -1
- package/dist/src/tunnel/tunnel-service.js +1 -1
- package/dist/src/voice/realtime/agentEngine.js +17 -0
- package/dist/src/voice/realtime/memory-context.js +1 -1
- package/dist/src/voice/realtime/playback-echo.d.ts +2 -0
- package/dist/src/voice/realtime/playback-echo.js +15 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-vul32IsP.js +0 -1
- package/dist/gateway/static/root/assets/agents-p3kWyz1T.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CJFJKNwS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B2wxcpgq.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BMjY8cyv.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-wB3Vgmp3.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-U5ffzu4r.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BGaF--m5.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BuEyUxZn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-WUhSfvob.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CYjlMzPx.js +0 -1
- package/dist/gateway/static/root/assets/index-BBlJYVxR.js +0 -74
- package/dist/gateway/static/root/assets/index-_I0dD2LN.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-CLlIl83V.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DuhCigiB.js +0 -2
- package/dist/gateway/static/root/assets/messages-ChSTFZR5.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DMdbaTZp.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-xe_vX0nM.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hG7ELibZ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-C5G2ET4w.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CwzsUCgP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Djc3EdoO.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-MUAMcZLD.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C7A0aywX.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D1xSGJAQ.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BvZSCLUH.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BKJC7tyW.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BW9p8Maz.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DuqRodIc.js +0 -5
package/dist/gateway/static/root/assets/{block-editor-C61LqK_-.js → block-editor-DFnPsrxI.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{m as u,t as d,u as f}from"./markdown-view-DBWu9d_n.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./copy-to-clipboard-HOJ79TWv.js";import{t as h}from"./messages-ChSTFZR5.js";import{n as g}from"./locale-store-B2v8mNJw.js";import{t as _}from"./cn-JdwAhgNB.js";import{s as v}from"./vendor-swr-BIWyz7Rc.js";import{a as y,d as b,i as x,l as S,n as C,o as w,s as T,t as E,u as D}from"./floating-ui.dom-B7uQOZZW.js";import{Bn as ee,Ds as te,Es as ne,Ic as re,Ml as ie,Oc as O,Ps as ae,Qc as oe,Rc as se,Rn as k,Vc as ce,Vn as le,Zn as ue,_c as de,cl as fe,ll as pe,nl as me,oc as he,ou as ge,pc as _e,qn as ve,sc as ye,sl as be,yc as xe,zc as Se}from"./index-BBlJYVxR.js";import{S as Ce,x as we}from"./vendor-codemirror-Qdcjid65.js";import{t as Te}from"./with-selector-aYPsXwdl.js";import{a as Ee}from"./note-detail-panel-DMdbaTZp.js";var A=e(r(),1),De=e(i(),1),j=o(),Oe=v();function M(e){this.content=e}M.prototype={constructor:M,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new M(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new M(n)},addToStart:function(e,t){return new M([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new M(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new M(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=M.from(e),e.size?new M(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=M.from(e),e.size?new M(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=M.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},M.from=function(e){if(e instanceof M)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new M(t)};function ke(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Me(e.charCodeAt(r-1))&&je(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ke(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ae(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Me(e.charCodeAt(i-1))&&je(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ae(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function je(e){return e>=56320&&e<57344}function Me(e){return e>=55296&&e<56320}var N=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ke(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ae(this,e,t,n)}findIndex(e){if(e==0)return Pe(0,e);if(e==this.size)return Pe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Pe(t+1,i):Pe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};N.empty=new N([],0);var Ne={index:0,offset:0};function Pe(e,t){return Ne.index=e,Ne.offset=t,Ne}function Fe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Fe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Fe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var P=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};P.none=[];var Ie=class extends Error{},F=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Re(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Le(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(N.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};F.empty=new F(N.empty,0,0);function Le(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Le(a.content,t-i-1,n-i-1)))}function Re(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Re(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function ze(e,t,n){if(n.openStart>e.depth)throw new Ie(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ie(`Inconsistent open depths`);return Be(e,t,n,0)}function Be(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Be(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ge(a,qe(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ge(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Je(n,e);return Ge(a,Ke(e,i,o,t,r))}}function Ve(e,t){if(!t.type.compatibleContent(e.type))throw new Ie(`Cannot join `+t.type.name+` onto `+e.type.name)}function He(e,t,n){let r=e.node(n);return Ve(r,t.node(n)),r}function Ue(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function We(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ue(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ue(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ue(t.nodeBefore,r)}function Ge(e,t){if(!e.type.validContent(t))throw new Ie(`Invalid content for node `+e.type.name);return e.copy(t)}function Ke(e,t,n,r,i){let a=e.depth>i&&He(e,t,i+1),o=r.depth>i&&He(n,r,i+1),s=[];return We(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ve(a,o),Ue(Ge(a,Ke(e,t,n,r,i+1)),s)):(a&&Ue(Ge(a,qe(e,t,i+1)),s),We(t,n,i,s),o&&Ue(Ge(o,qe(n,r,i+1)),s)),We(r,null,i,s),new N(s)}function qe(e,t,n){let r=[];return We(null,e,n,r),e.depth>n&&Ue(Ge(He(e,t,n+1),qe(e,t,n+1)),r),We(t,null,n,r),new N(r)}function Je(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(N.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ye=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return P.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new $e(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Qe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Qe.set(t,r=new Xe);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ze,i}},Xe=class{constructor(){this.elts=[],this.i=0}},Ze=12,Qe=new WeakMap,$e=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},et=Object.create(null),tt=class e{constructor(e,t,n,r=P.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||N.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Fe(this.attrs,t||e.defaultAttrs||et)&&P.sameSet(this.marks,n||P.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return F.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new F(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ze(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ye.resolveCached(this,e)}resolveNoCache(e){return Ye.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),rt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=N.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=P.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!P.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=N.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};tt.prototype.text=void 0;var nt=class e extends tt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function rt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var it=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new at(t,n);if(r.next==null)return e.empty;let i=ot(r);r.next&&r.err(`Unexpected trailing text`);let a=gt(pt(i));return _t(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return N.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{m as u,t as d,u as f}from"./markdown-view-CPXhy6nh.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./copy-to-clipboard-HOJ79TWv.js";import{t as h}from"./messages-DngsF_Kx.js";import{n as g}from"./locale-store-VsboRLD7.js";import{t as _}from"./cn-JdwAhgNB.js";import{s as v}from"./vendor-swr-BIWyz7Rc.js";import{a as y,d as b,i as x,l as S,n as C,o as w,s as T,t as E,u as D}from"./floating-ui.dom-B7uQOZZW.js";import{$c as ee,Bc as te,Gn as O,Hn as k,Jc as ne,Ks as re,Rs as ie,Tc as ae,Wl as oe,Wn as se,Xc as ce,Zc as le,Zn as ue,bl as de,jc as fe,kc as pe,ml as me,tr as he,ul as ge,vc as _e,vu as ve,xl as ye,yc as be,yl as xe,zs as Se}from"./index-PksHo9hS.js";import{S as Ce,x as we}from"./vendor-codemirror-Qdcjid65.js";import{t as Te}from"./with-selector-aYPsXwdl.js";import{a as Ee}from"./note-detail-panel-OklYXK7y.js";var A=e(r(),1),De=e(i(),1),j=o(),Oe=v();function M(e){this.content=e}M.prototype={constructor:M,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new M(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new M(n)},addToStart:function(e,t){return new M([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new M(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new M(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=M.from(e),e.size?new M(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=M.from(e),e.size?new M(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=M.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},M.from=function(e){if(e instanceof M)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new M(t)};function ke(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Me(e.charCodeAt(r-1))&&je(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ke(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ae(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Me(e.charCodeAt(i-1))&&je(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ae(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function je(e){return e>=56320&&e<57344}function Me(e){return e>=55296&&e<56320}var N=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ke(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ae(this,e,t,n)}findIndex(e){if(e==0)return Pe(0,e);if(e==this.size)return Pe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Pe(t+1,i):Pe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};N.empty=new N([],0);var Ne={index:0,offset:0};function Pe(e,t){return Ne.index=e,Ne.offset=t,Ne}function Fe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Fe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Fe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var P=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};P.none=[];var Ie=class extends Error{},F=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Re(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Le(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(N.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};F.empty=new F(N.empty,0,0);function Le(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Le(a.content,t-i-1,n-i-1)))}function Re(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Re(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function ze(e,t,n){if(n.openStart>e.depth)throw new Ie(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ie(`Inconsistent open depths`);return Be(e,t,n,0)}function Be(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Be(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ge(a,qe(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ge(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Je(n,e);return Ge(a,Ke(e,i,o,t,r))}}function Ve(e,t){if(!t.type.compatibleContent(e.type))throw new Ie(`Cannot join `+t.type.name+` onto `+e.type.name)}function He(e,t,n){let r=e.node(n);return Ve(r,t.node(n)),r}function Ue(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function We(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Ue(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Ue(i.child(e),r);t&&t.depth==n&&t.textOffset&&Ue(t.nodeBefore,r)}function Ge(e,t){if(!e.type.validContent(t))throw new Ie(`Invalid content for node `+e.type.name);return e.copy(t)}function Ke(e,t,n,r,i){let a=e.depth>i&&He(e,t,i+1),o=r.depth>i&&He(n,r,i+1),s=[];return We(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ve(a,o),Ue(Ge(a,Ke(e,t,n,r,i+1)),s)):(a&&Ue(Ge(a,qe(e,t,i+1)),s),We(t,n,i,s),o&&Ue(Ge(o,qe(n,r,i+1)),s)),We(r,null,i,s),new N(s)}function qe(e,t,n){let r=[];return We(null,e,n,r),e.depth>n&&Ue(Ge(He(e,t,n+1),qe(e,t,n+1)),r),We(t,null,n,r),new N(r)}function Je(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(N.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Ye=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return P.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new $e(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Qe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Qe.set(t,r=new Xe);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ze,i}},Xe=class{constructor(){this.elts=[],this.i=0}},Ze=12,Qe=new WeakMap,$e=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},et=Object.create(null),tt=class e{constructor(e,t,n,r=P.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||N.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Fe(this.attrs,t||e.defaultAttrs||et)&&P.sameSet(this.marks,n||P.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return F.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new F(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return ze(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Ye.resolveCached(this,e)}resolveNoCache(e){return Ye.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),rt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=N.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=P.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!P.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=N.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};tt.prototype.text=void 0;var nt=class e extends tt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):rt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function rt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var it=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new at(t,n);if(r.next==null)return e.empty;let i=ot(r);r.next&&r.err(`Unexpected trailing text`);let a=gt(pt(i));return _t(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return N.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
2
2
|
`)}};it.empty=new it(!0);var at=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function ot(e){let t=[];do t.push(st(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function st(e){let t=[];do t.push(ct(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function ct(e){let t=ft(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ut(e,t);else break;return t}function lt(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ut(e,t){let n=lt(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:lt(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function dt(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function ft(e){if(e.eat(`(`)){let t=ot(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=dt(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pt(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mt(e,t){return t-e}function ht(e,t){let n=[];return r(t),n.sort(mt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gt(e){let t=Object.create(null);return n(ht(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);ht(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new it(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _t(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function vt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function yt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function bt(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function xt(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new wt(e,r,t[r]);return n}var St=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=xt(e,n.attrs),this.defaultAttrs=vt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==it.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:yt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new tt(this,this.computeAttrs(e),N.from(t),P.setFrom(n))}createChecked(e=null,t,n){return t=N.from(t),this.checkContent(t),new tt(this,this.computeAttrs(e),t,P.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=N.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(N.empty,!0);return i?new tt(this,e,t.append(i),P.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bt(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:P.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ct(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var wt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ct(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Tt=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=xt(e,r.attrs),this.excluded=null;let i=vt(this.attrs);this.instance=i?new P(this,i):null}create(e=null){return!e&&this.instance?this.instance:new P(this,yt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){bt(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Et=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=M.from(e.nodes),t.marks=M.from(e.marks||{}),this.nodes=St.compile(this.spec.nodes,this),this.marks=Tt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=it.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Dt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Dt(this,n.split(` `))}this.nodeFromJSON=e=>tt.fromJSON(this,e),this.markFromJSON=e=>P.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof St))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new nt(n,n.defaultAttrs,e,P.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Dt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Ot(e){return e.tag!=null}function kt(e){return e.style!=null}var At=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Ot(e))this.tags.push(e);else if(kt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new zt(this,t,!1);return n.addAll(e,P.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new zt(this,t,!0);return n.addAll(e,P.none,t.from,t.to),F.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Vt(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ht(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ht(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},jt={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},Mt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Nt={ol:!0,ul:!0},Pt=1,Ft=2,It=4;function Lt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Pt:0)|(t===`full`?Ft:0)}var Rt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=P.none,this.match=i||(a&It?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(N.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=N.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(N.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},zt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Lt(null,t.preserveWhitespace,0)|(n?It:0);i=r?new Rt(r.type,r.attrs,P.none,!0,t.topMatch||r.type.contentMatch,a):n?new Rt(null,null,P.none,!0,null,a):new Rt(e.schema.topNodeType,null,P.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Ft?`full`:this.localPreserveWS||(r.options&Pt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Nt.hasOwnProperty(a)&&this.parser.normalizeLists&&Bt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Mt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(jt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=P.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Ut(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Lt(e,i,a.options);a.options&It&&a.content.length==0&&(o|=It);let s=P.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Ut(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Rt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Pt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Bt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Nt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Vt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ht(e){let t={};for(let n in e)t[n]=e[n];return t}function Ut(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Wt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=Kt(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Kt(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Xt(Kt(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Xt(Kt(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Xt(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Gt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Gt(e.marks)}};function Gt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Kt(e){return e.document||window.document}var qt=new WeakMap;function Jt(e){let t=qt.get(e);return t===void 0&&qt.set(e,t=Yt(e)),t}function Yt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Xt(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Jt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Xt(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Zt=65535,Qt=2**16;function $t(e,t){return e+t*Qt}function en(e){return e&Zt}function tn(e){return(e-(e&Zt))/Qt}var nn=1,rn=2,an=4,on=8,sn=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&on)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&an)>0}},cn=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=en(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+tn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:$t(o/3,e-s),f=e==s?rn:e==u?nn:an;return(t<0?e!=s:e!=u)&&(f|=on),new sn(a,f,d)}r+=l-c}return n?e+r:new sn(e+r,0,null)}touches(e,t){let n=0,r=en(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};cn.empty=new cn([]);var ln=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new sn(e,r,null)}},un=Object.create(null),dn=class{getMap(){return cn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=un[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in un)throw RangeError(`Duplicate use of step JSON ID `+e);return un[e]=t,t.prototype.jsonID=e,t}},fn=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ie)return e.fail(t.message);throw t}}};function pn(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(pn(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return N.fromArray(r)}var mn=class e extends dn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new F(pn(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return fn.fromReplace(e,this.from,this.to,i)}invert(){return new hn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};dn.jsonID(`addMark`,mn);var hn=class e extends dn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new F(pn(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return fn.fromReplace(e,this.from,this.to,n)}invert(){return new mn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};dn.jsonID(`removeMark`,hn);var gn=class e extends dn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return fn.fromReplace(e,this.pos,this.pos+1,new F(N.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new _n(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};dn.jsonID(`addNodeMark`,gn);var _n=class e extends dn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return fn.fromReplace(e,this.pos,this.pos+1,new F(N.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new gn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};dn.jsonID(`removeNodeMark`,_n);var vn=class e extends dn{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&bn(e,this.from,this.to)?fn.fail(`Structure replace would overwrite content`):fn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new cn([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?F.empty:new F(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?F.empty:new F(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,F.fromJSON(t,n.slice),!!n.structure)}};vn.MAP_BIAS=1,dn.jsonID(`replace`,vn);var yn=class e extends dn{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(bn(e,this.from,this.gapFrom)||bn(e,this.gapTo,this.to)))return fn.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return fn.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?fn.fromReplace(e,this.from,this.to,n):fn.fail(`Content does not fit in gap`)}getMap(){return new cn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(t,n.slice),n.insert,!!n.structure)}};dn.jsonID(`replaceAround`,yn);function bn(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function xn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new hn(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new mn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Sn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Tt){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new hn(t.from,t.to,t.style)))}function Cn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new vn(s,l,F.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new hn(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new F(N.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new vn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(N.empty,!0);e.replace(s,s,new F(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function wn(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Tn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!wn(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function En(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=N.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=N.from(r.node(e).copy(u)),d++):c--;let f=N.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=N.from(i.node(e).copy(f)),p++):l++;e.step(new yn(c,l,o,s,new F(u.append(f),d,p),u.size-d,!0))}function Dn(e,t,n=null,r=e){let i=kn(e,t),a=i&&An(r,t);return a?i.map(On).concat({type:t,attrs:n}).concat(a.map(On)):null}function On(e){return{type:e,attrs:null}}function kn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function An(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function jn(e,t,n){let r=N.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=N.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new yn(i,a,i,a,new F(r,0,0),n.length,!0))}function Mn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Fn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Pn(e,t,n,a),Cn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new yn(c,l,c+1,l-1,new F(N.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Nn(e,t,n,a),!1}})}function Nn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Pn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
@@ -103,18 +103,18 @@ ${t.renderChildren(e.content||[],`
|
|
|
103
103
|
|
|
104
104
|
${n}`:`
|
|
105
105
|
${n}`}}),s}function Xp(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var K=class e extends sp{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Zp=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t;let{view:n}=this.editor,r=e.target,i=r.nodeType===3?r.parentElement?.closest(`[data-drag-handle]`):r.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(r)||!i)return;let a=0,o=0;if(this.dom!==i){let t=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;a=n.x-t.x+r,o=n.y-t.y+s}let s=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();s.style.width=`${Math.round(e.width)}px`,s.style.height=`${Math.round(e.height)}px`,s.style.boxSizing=`border-box`,s.style.pointerEvents=`none`}catch{}let c=null;try{c=document.createElement(`div`),c.style.position=`absolute`,c.style.top=`-9999px`,c.style.left=`-9999px`,c.style.pointerEvents=`none`,c.appendChild(s),document.body.appendChild(c),(t=e.dataTransfer)==null||t.setDragImage(s,a,o)}finally{c&&setTimeout(()=>{try{c?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=R.create(n.state.doc,l),d=n.state.tr.setSelection(u);n.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!(this.dom.contains(t)&&!this.contentDOM?.contains(t)))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=R.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.dom.contains(e.target)&&e.type===`childList`&&(qu()||Ku())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Qp(e){return new up({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=U(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(uf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:$p,getOwnPropertySymbols:em}=Object,{hasOwnProperty:tm}=Object.prototype;function nm(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function rm(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function im(e){return e?.[Symbol.toStringTag]}function am(e){return $p(e).concat(em(e))}var om=Object.hasOwn||((e,t)=>tm.call(e,t));function sm(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var cm=`__v`,lm=`__o`,um=`_owner`,{getOwnPropertyDescriptor:dm,keys:fm}=Object;function pm(e,t){return e.byteLength===t.byteLength&&Em(new Uint8Array(e),new Uint8Array(t))}function mm(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function hm(e,t){return e.byteLength===t.byteLength&&Em(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function gm(e,t){return sm(e.getTime(),t.getTime())}function _m(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function vm(e,t){return e===t}function ym(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var bm=sm;function xm(e,t,n){let r=fm(e),i=r.length;if(fm(t).length!==i)return!1;for(;i-- >0;)if(!Om(e,t,n,r[i]))return!1;return!0}function Sm(e,t,n){let r=am(e),i=r.length;if(am(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Om(e,t,n,a)||(o=dm(e,a),s=dm(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Cm(e,t){return sm(e.valueOf(),t.valueOf())}function wm(e,t){return e.source===t.source&&e.flags===t.flags}function Tm(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Em(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Dm(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Om(e,t,n,r){return(r===um||r===lm||r===cm)&&(e.$$typeof||t.$$typeof)?!0:om(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var km=`[object ArrayBuffer]`,Am=`[object Arguments]`,jm=`[object Boolean]`,Mm=`[object DataView]`,Nm=`[object Date]`,Pm=`[object Error]`,Fm=`[object Map]`,Im=`[object Number]`,Lm=`[object Object]`,Rm=`[object RegExp]`,zm=`[object Set]`,Bm=`[object String]`,Vm={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Hm=`[object URL]`,Um=Object.prototype.toString;function Wm({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=Um.call(h);if(b===Nm)return r(h,g,_);if(b===Rm)return u(h,g,_);if(b===Fm)return o(h,g,_);if(b===zm)return d(h,g,_);if(b===Lm)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===Hm)return p(h,g,_);if(b===Pm)return i(h,g,_);if(b===Am)return c(h,g,_);if(Vm[b])return f(h,g,_);if(b===km)return e(h,g,_);if(b===Mm)return n(h,g,_);if(b===jm||b===Im||b===Bm)return l(h,g,_);if(m){let e=m[b];if(!e){let t=im(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function Gm({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:pm,areArraysEqual:n?Sm:mm,areDataViewsEqual:hm,areDatesEqual:gm,areErrorsEqual:_m,areFunctionsEqual:vm,areMapsEqual:n?nm(ym,Sm):ym,areNumbersEqual:bm,areObjectsEqual:n?Sm:xm,arePrimitiveWrappersEqual:Cm,areRegExpsEqual:wm,areSetsEqual:n?nm(Tm,Sm):Tm,areTypedArraysEqual:n?nm(Em,Sm):Em,areUrlsEqual:Dm,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=rm(r.areArraysEqual),t=rm(r.areMapsEqual),n=rm(r.areObjectsEqual),i=rm(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Km(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function qm({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var Jm=Ym();Ym({strict:!0}),Ym({circular:!0}),Ym({circular:!0,strict:!0}),Ym({createInternalComparator:()=>sm}),Ym({strict:!0,createInternalComparator:()=>sm}),Ym({circular:!0,createInternalComparator:()=>sm}),Ym({circular:!0,createInternalComparator:()=>sm,strict:!0});function Ym(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=Wm(Gm(e));return qm({circular:t,comparator:a,createState:r,equals:n?n(a):Km(a),strict:i})}var Xm=e(Te(),1),Zm=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Qm=({contentComponent:e})=>{let t=(0,Oe.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,j.jsx)(j.Fragment,{children:Object.values(t)})};function $m(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:De.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var eh=class extends A.Component{constructor(e){super(e),this.editorContentRef=A.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=$m(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{ref:Zm(t,this.editorContentRef),...n}),e?.contentComponent&&(0,j.jsx)(Qm,{contentComponent:e.contentComponent})]})}},th=(0,A.forwardRef)((e,t)=>{let n=A.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return A.createElement(eh,{key:n,innerRef:t,...e})}),nh=A.memo(th),rh=typeof window<`u`?A.useLayoutEffect:A.useEffect,ih=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.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){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function ah(e){let[t]=(0,A.useState)(()=>new ih(e.editor)),n=(0,Xm.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??Jm);return rh(()=>t.watch(e.editor),[e.editor,t]),(0,A.useDebugValue)(n),n}var oh=!1,sh=typeof window>`u`,ch=sh||!!(typeof window<`u`&&window.next),lh=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return sh?(t&&oh&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):ch&&e===void 0&&(t=!1,oh&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new Mp({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function uh(e={},t=[]){let n=(0,A.useRef)(e);n.current=e;let[r]=(0,A.useState)(()=>new lh(n)),i=(0,Oe.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,A.useDebugValue)(i),(0,A.useEffect)(r.onRender(t)),ah({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var dh=(0,A.createContext)({editor:null});dh.Consumer;var fh=()=>(0,A.useContext)(dh),ph=(0,A.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),mh=()=>(0,A.useContext)(ph);function hh({as:e=`div`,...t}){let{nodeViewContentRef:n,nodeViewContentChildren:r}=mh();return(0,j.jsx)(e,{...t,ref:n,"data-node-view-content":``,style:{whiteSpace:`pre-wrap`,...t.style},children:r})}var gh=A.forwardRef((e,t)=>{let{onDragStart:n}=mh();return(0,j.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function _h(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function vh(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function yh(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function bh(e){if(_h(e)||vh(e))return!0;if(yh(e)){let t=e.type;if(t)return _h(t)||vh(t)}return!1}function xh(){try{if(A.version)return parseInt(A.version.split(`.`)[0],10)>=19}catch{}return!1}var Sh=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,De.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=xh(),a=bh(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,j.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};A.createContext({markViewContentRef:()=>{}});var Ch=class extends Zp{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,A.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,A.memo)(e=>(0,j.jsx)(ph.Provider,{value:t,children:(0,A.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Sh(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.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),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if(typeof e==`number`)if(Cf({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove(`ProseMirror-selectednode`)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=Kd(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function wh(e,t){return n=>n.editor.contentComponent?new Ch(e,n,t):{}}var Th=(0,A.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Th.displayName=`TiptapContext`;var Eh=()=>(0,A.useContext)(Th);function Dh({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,A.useMemo)(()=>({editor:r}),[r]),a=(0,A.useMemo)(()=>({editor:r}),[r]);return(0,j.jsx)(dh.Provider,{value:a,children:(0,j.jsx)(Th.Provider,{value:i,children:n})})}Dh.displayName=`Tiptap`;function Oh({...e}){let{editor:t}=Eh();return(0,j.jsx)(nh,{editor:t,...e})}Oh.displayName=`Tiptap.Content`,Object.assign(Dh,{Content:Oh});var kh=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function Ah(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Ah(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function jh(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=jh(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Mh=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ah(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return jh(this,e,t,n)}findIndex(e){if(e==0)return Ph(0,e);if(e==this.size)return Ph(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ph(t+1,i):Ph(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Mh.empty=new Mh([],0);var Nh={index:0,offset:0};function Ph(e,t){return Nh.index=e,Nh.offset=t,Nh}function Fh(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Fh(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Fh(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Ih=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fh(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ih.none=[];var Lh=class extends Error{},q=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=zh(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Rh(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Mh.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};q.empty=new q(Mh.empty,0,0);function Rh(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Rh(a.content,t-i-1,n-i-1)))}function zh(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=zh(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Bh(e,t,n){if(n.openStart>e.depth)throw new Lh(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Lh(`Inconsistent open depths`);return Vh(e,t,n,0)}function Vh(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Vh(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Kh(a,Jh(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Kh(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Yh(n,e);return Kh(a,qh(e,i,o,t,r))}}function Hh(e,t){if(!t.type.compatibleContent(e.type))throw new Lh(`Cannot join `+t.type.name+` onto `+e.type.name)}function Uh(e,t,n){let r=e.node(n);return Hh(r,t.node(n)),r}function Wh(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Gh(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Wh(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Wh(i.child(e),r);t&&t.depth==n&&t.textOffset&&Wh(t.nodeBefore,r)}function Kh(e,t){return e.type.checkContent(t),e.copy(t)}function qh(e,t,n,r,i){let a=e.depth>i&&Uh(e,t,i+1),o=r.depth>i&&Uh(n,r,i+1),s=[];return Gh(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Hh(a,o),Wh(Kh(a,qh(e,t,n,r,i+1)),s)):(a&&Wh(Kh(a,Jh(e,t,i+1)),s),Gh(t,n,i,s),o&&Wh(Kh(o,Jh(n,r,i+1)),s)),Gh(r,null,i,s),new Mh(s)}function Jh(e,t,n){let r=[];return Gh(null,e,n,r),e.depth>n&&Wh(Kh(Uh(e,t,n+1),Jh(e,t,n+1)),r),Gh(t,null,n,r),new Mh(r)}function Yh(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Mh.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Xh=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ih.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new eg(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=$h.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else $h.set(t,r=new Zh);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Qh,i}},Zh=class{constructor(){this.elts=[],this.i=0}},Qh=12,$h=new WeakMap,eg=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},tg=Object.create(null),ng=class e{constructor(e,t,n,r=Ih.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Mh.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Fh(this.attrs,t||e.defaultAttrs||tg)&&Ih.sameSet(this.marks,n||Ih.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Bh(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Xh.resolveCached(this,e)}resolveNoCache(e){return Xh.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),rg(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Mh.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ih.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ih.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Mh.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};ng.prototype.text=void 0;function rg(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var ig=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ag(t,n);if(r.next==null)return e.empty;let i=og(r);r.next&&r.err(`Unexpected trailing text`);let a=gg(pg(i));return _g(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Mh.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
106
|
-
`)}};ig.empty=new ig(!0);var ag=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function og(e){let t=[];do t.push(sg(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function sg(e){let t=[];do t.push(cg(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function cg(e){let t=fg(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ug(e,t);else break;return t}function lg(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ug(e,t){let n=lg(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:lg(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function dg(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function fg(e){if(e.eat(`(`)){let t=og(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=dg(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pg(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mg(e,t){return t-e}function hg(e,t){let n=[];return r(t),n.sort(mg);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gg(e){let t=Object.create(null);return n(hg(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);hg(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ig(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mg);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _g(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var vg=65535,yg=2**16;function bg(e,t){return e+t*yg}function xg(e){return e&vg}function Sg(e){return(e-(e&vg))/yg}var Cg=1,wg=2,Tg=4,Eg=8,Dg=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Eg)>0}get deletedBefore(){return(this.delInfo&(Cg|Tg))>0}get deletedAfter(){return(this.delInfo&(wg|Tg))>0}get deletedAcross(){return(this.delInfo&Tg)>0}},Og=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=xg(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Sg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:bg(o/3,e-s),f=e==s?wg:e==u?Cg:Tg;return(t<0?e!=s:e!=u)&&(f|=Eg),new Dg(a,f,d)}r+=l-c}return n?e+r:new Dg(e+r,0,null)}touches(e,t){let n=0,r=xg(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Og.empty=new Og([]);var kg=Object.create(null),Ag=class{getMap(){return Og.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=kg[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kg)throw RangeError(`Duplicate use of step JSON ID `+e);return kg[e]=t,t.prototype.jsonID=e,t}},jg=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Lh)return e.fail(t.message);throw t}}};function Mg(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Mg(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Mh.fromArray(r)}var Ng=class e extends Ag{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new q(Mg(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return jg.fromReplace(e,this.from,this.to,i)}invert(){return new Pg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Ag.jsonID(`addMark`,Ng);var Pg=class e extends Ag{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new q(Mg(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return jg.fromReplace(e,this.from,this.to,n)}invert(){return new Ng(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Ag.jsonID(`removeMark`,Pg);var Fg=class e extends Ag{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Ig(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Ag.jsonID(`addNodeMark`,Fg);var Ig=class e extends Ag{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Fg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Ag.jsonID(`removeNodeMark`,Ig);var Lg=class e extends Ag{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&zg(e,this.from,this.to)?jg.fail(`Structure replace would overwrite content`):jg.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Og([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?q.empty:new q(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?q.empty:new q(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,q.fromJSON(t,n.slice),!!n.structure)}};Lg.MAP_BIAS=1,Ag.jsonID(`replace`,Lg);var Rg=class e extends Ag{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(zg(e,this.from,this.gapFrom)||zg(e,this.gapTo,this.to)))return jg.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return jg.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?jg.fromReplace(e,this.from,this.to,n):jg.fail(`Content does not fit in gap`)}getMap(){return new Og([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(t,n.slice),n.insert,!!n.structure)}};Ag.jsonID(`replaceAround`,Rg);function zg(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var Bg=class e extends Ag{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(r),0,+!t.isLeaf))}getMap(){return Og.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};Ag.jsonID(`attr`,Bg);var Vg=class e extends Ag{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return jg.ok(n)}getMap(){return Og.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};Ag.jsonID(`docAttr`,Vg);var Hg=class extends Error{};Hg=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Hg.prototype=Object.create(Error.prototype),Hg.prototype.constructor=Hg,Hg.prototype.name=`TransformError`;var Ug=Object.create(null),J=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Wg(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=q.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?q.empty:t),o==0&&e_(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),e_(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new qg(e):$g(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?$g(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):$g(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Zg(e.node(0))}static atStart(e){return $g(e,e,0,0,1)||new Zg(e)}static atEnd(e){return $g(e,e,e.content.size,e.childCount,-1)||new Zg(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=Ug[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ug)throw RangeError(`Duplicate use of selection JSON ID `+e);return Ug[e]=t,t.prototype.jsonID=e,t}getBookmark(){return qg.between(this.$anchor,this.$head).getBookmark()}};J.prototype.visible=!0;var Wg=class{constructor(e,t){this.$from=e,this.$to=t}},Gg=!1;function Kg(e){!Gg&&!e.parent.inlineContent&&(Gg=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var qg=class e extends J{constructor(e,t=e){Kg(e),Kg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return J.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Jg(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=J.findFrom(n,r,!0)||J.findFrom(n,-r,!0);if(e)n=e.$head;else return J.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(J.findFrom(t,-r,!0)||J.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};J.jsonID(`text`,qg);var Jg=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return qg.between(e.resolve(this.anchor),e.resolve(this.head))}},Yg=class e extends J{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?J.near(a):new e(a)}content(){return new q(Mh.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new Xg(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Yg.prototype.visible=!1,J.jsonID(`node`,Yg);var Xg=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Jg(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Yg.isSelectable(n)?new Yg(t):J.near(t)}},Zg=class e extends J{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.empty){e.delete(0,e.doc.content.size);let t=J.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return Qg}};J.jsonID(`all`,Zg);var Qg={map(){return this},resolve(e){return new Zg(e)}};function $g(e,t,n,r,i,a=!1){if(t.inlineContent)return qg.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=$g(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&Yg.isSelectable(r))return Yg.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function e_(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Lg||i instanceof Rg))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(J.near(e.doc.resolve(o),n))}function t_(e,t){return!t||!e?e:e.bind(t)}var n_=class{constructor(e,t,n){this.name=e,this.init=t_(t.init,n),this.apply=t_(t.apply,n)}};new n_(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new n_(`selection`,{init(e,t){return e.selection||J.atStart(t.doc)},apply(e){return e.selection}}),new n_(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new n_(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var r_=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(qg.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},i_=/^\s*>\s$/,a_=K.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return kh(`blockquote`,{...W(this.options.HTMLAttributes,e),children:kh(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
106
|
+
`)}};ig.empty=new ig(!0);var ag=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function og(e){let t=[];do t.push(sg(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function sg(e){let t=[];do t.push(cg(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function cg(e){let t=fg(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ug(e,t);else break;return t}function lg(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ug(e,t){let n=lg(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:lg(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function dg(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function fg(e){if(e.eat(`(`)){let t=og(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=dg(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function pg(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function mg(e,t){return t-e}function hg(e,t){let n=[];return r(t),n.sort(mg);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function gg(e){let t=Object.create(null);return n(hg(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);hg(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new ig(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(mg);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function _g(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var vg=65535,yg=2**16;function bg(e,t){return e+t*yg}function xg(e){return e&vg}function Sg(e){return(e-(e&vg))/yg}var Cg=1,wg=2,Tg=4,Eg=8,Dg=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Eg)>0}get deletedBefore(){return(this.delInfo&(Cg|Tg))>0}get deletedAfter(){return(this.delInfo&(wg|Tg))>0}get deletedAcross(){return(this.delInfo&Tg)>0}},Og=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=xg(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Sg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:bg(o/3,e-s),f=e==s?wg:e==u?Cg:Tg;return(t<0?e!=s:e!=u)&&(f|=Eg),new Dg(a,f,d)}r+=l-c}return n?e+r:new Dg(e+r,0,null)}touches(e,t){let n=0,r=xg(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Og.empty=new Og([]);var kg=Object.create(null),Ag=class{getMap(){return Og.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=kg[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in kg)throw RangeError(`Duplicate use of step JSON ID `+e);return kg[e]=t,t.prototype.jsonID=e,t}},jg=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Lh)return e.fail(t.message);throw t}}};function Mg(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Mg(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Mh.fromArray(r)}var Ng=class e extends Ag{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new q(Mg(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return jg.fromReplace(e,this.from,this.to,i)}invert(){return new Pg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Ag.jsonID(`addMark`,Ng);var Pg=class e extends Ag{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new q(Mg(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return jg.fromReplace(e,this.from,this.to,n)}invert(){return new Ng(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Ag.jsonID(`removeMark`,Pg);var Fg=class e extends Ag{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Ig(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Ag.jsonID(`addNodeMark`,Fg);var Ig=class e extends Ag{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Fg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Ag.jsonID(`removeNodeMark`,Ig);var Lg=class e extends Ag{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&zg(e,this.from,this.to)?jg.fail(`Structure replace would overwrite content`):jg.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Og([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?q.empty:new q(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?q.empty:new q(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,q.fromJSON(t,n.slice),!!n.structure)}};Lg.MAP_BIAS=1,Ag.jsonID(`replace`,Lg);var Rg=class e extends Ag{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(zg(e,this.from,this.gapFrom)||zg(e,this.gapTo,this.to)))return jg.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return jg.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?jg.fromReplace(e,this.from,this.to,n):jg.fail(`Content does not fit in gap`)}getMap(){return new Og([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(t,n.slice),n.insert,!!n.structure)}};Ag.jsonID(`replaceAround`,Rg);function zg(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var Bg=class e extends Ag{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return jg.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return jg.fromReplace(e,this.pos,this.pos+1,new q(Mh.from(r),0,+!t.isLeaf))}getMap(){return Og.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};Ag.jsonID(`attr`,Bg);var Vg=class e extends Ag{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return jg.ok(n)}getMap(){return Og.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};Ag.jsonID(`docAttr`,Vg);var Hg=class extends Error{};Hg=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},Hg.prototype=Object.create(Error.prototype),Hg.prototype.constructor=Hg,Hg.prototype.name=`TransformError`;var Ug=Object.create(null),Wg=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Gg(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=q.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?q.empty:t),o==0&&t_(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),t_(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Jg(e):e_(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?e_(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):e_(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Qg(e.node(0))}static atStart(e){return e_(e,e,0,0,1)||new Qg(e)}static atEnd(e){return e_(e,e,e.content.size,e.childCount,-1)||new Qg(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=Ug[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ug)throw RangeError(`Duplicate use of selection JSON ID `+e);return Ug[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Jg.between(this.$anchor,this.$head).getBookmark()}};Wg.prototype.visible=!0;var Gg=class{constructor(e,t){this.$from=e,this.$to=t}},Kg=!1;function qg(e){!Kg&&!e.parent.inlineContent&&(Kg=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Jg=class e extends Wg{constructor(e,t=e){qg(e),qg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Wg.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Yg(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=Wg.findFrom(n,r,!0)||Wg.findFrom(n,-r,!0);if(e)n=e.$head;else return Wg.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Wg.findFrom(t,-r,!0)||Wg.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};Wg.jsonID(`text`,Jg);var Yg=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return Jg.between(e.resolve(this.anchor),e.resolve(this.head))}},Xg=class e extends Wg{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?Wg.near(a):new e(a)}content(){return new q(Mh.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new Zg(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Xg.prototype.visible=!1,Wg.jsonID(`node`,Xg);var Zg=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Yg(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Xg.isSelectable(n)?new Xg(t):Wg.near(t)}},Qg=class e extends Wg{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.empty){e.delete(0,e.doc.content.size);let t=Wg.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return $g}};Wg.jsonID(`all`,Qg);var $g={map(){return this},resolve(e){return new Qg(e)}};function e_(e,t,n,r,i,a=!1){if(t.inlineContent)return Jg.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=e_(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&Xg.isSelectable(r))return Xg.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function t_(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Lg||i instanceof Rg))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(Wg.near(e.doc.resolve(o),n))}function n_(e,t){return!t||!e?e:e.bind(t)}var r_=class{constructor(e,t,n){this.name=e,this.init=n_(t.init,n),this.apply=n_(t.apply,n)}};new r_(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new r_(`selection`,{init(e,t){return e.selection||Wg.atStart(t.doc)},apply(e){return e.selection}}),new r_(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new r_(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var i_=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(Jg.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},a_=/^\s*>\s$/,o_=K.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return kh(`blockquote`,{...W(this.options.HTMLAttributes,e),children:kh(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
107
107
|
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
108
108
|
`))}),n.join(`
|
|
109
109
|
>
|
|
110
|
-
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>
|
|
110
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>i_(this.editor,this.type)}},addInputRules(){return[Ip({find:a_,type:this.type})]}}),s_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,c_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,l_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,u_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,d_=cp.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return kh(`strong`,{...W(this.options.HTMLAttributes,e),children:kh(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Np({find:s_,type:this.type}),Np({find:l_,type:this.type})]},addPasteRules(){return[Qp({find:c_,type:this.type}),Qp({find:u_,type:this.type})]}}),f_=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},p_=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},m_=cp.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Np({find:f_,type:this.type})]},addPasteRules(){return[Qp({find:p_,type:this.type})]}}),h_=4,g_=/^```([a-z]+)?[\s\n]$/,__=/^~~~([a-z]+)?[\s\n]$/,v_=K.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:h_,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,W(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
111
111
|
`):`\`\`\`${r}
|
|
112
112
|
|
|
113
|
-
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??
|
|
113
|
+
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??h_,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
114
114
|
`,`
|
|
115
115
|
`).split(`
|
|
116
116
|
`).map(e=>o+e).join(`
|
|
117
|
-
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??
|
|
117
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??h_,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
118
118
|
`,`
|
|
119
119
|
`).split(`
|
|
120
120
|
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(L.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
@@ -123,36 +123,36 @@ ${n}`}}),s}function Xp(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants
|
|
|
123
123
|
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
124
124
|
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
125
125
|
|
|
126
|
-
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(I.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Fp({find:
|
|
127
|
-
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(L.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),v_
|
|
126
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(I.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Fp({find:g_,type:this.type,getAttributes:e=>({language:e[1]})}),Fp({find:__,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new z({key:new B(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
127
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(L.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),y_=v_,b_=K.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
128
128
|
|
|
129
|
-
`):``}),
|
|
129
|
+
`):``}),x_=K.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,W(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
130
130
|
`},renderMarkdown:()=>`
|
|
131
|
-
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),x_=K.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,W(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Fp({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),S_=K.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,W(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!zp(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Sf(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(L.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(R.create(t.doc,n.pos)):t.setSelection(L.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(L.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Pp({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),C_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,w_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,T_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,E_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,D_=cp.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,W(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Np({find:C_,type:this.type}),Np({find:T_,type:this.type})]},addPasteRules(){return[Qp({find:w_,type:this.type}),Qp({find:E_,type:this.type})]}}),O_=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,k_=`ελ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`,A_=`numeric`,j_=`ascii`,M_=`alpha`,N_=`asciinumeric`,P_=`alphanumeric`,F_=`domain`,I_=`emoji`,L_=`scheme`,R_=`slashscheme`,z_=`whitespace`;function B_(e,t){return e in t||(t[e]=[]),t[e]}function V_(e,t,n){t[A_]&&(t[N_]=!0,t[P_]=!0),t[j_]&&(t[N_]=!0,t[M_]=!0),t[N_]&&(t[P_]=!0),t[M_]&&(t[P_]=!0),t[P_]&&(t[F_]=!0),t[I_]&&(t[F_]=!0);for(let r in t){let t=B_(r,n);t.indexOf(e)<0&&t.push(e)}}function H_(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function U_(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}U_.groups={},U_.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=U_.groups;let i;return t&&t.j?i=t:(i=new U_(t),n&&r&&V_(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=U_.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new U_,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new U_,a&&(r&&(o.t&&typeof o.t==`string`?V_(a,Object.assign(H_(o.t,r),n),r):n&&V_(a,n,r)),o.t=a),i.j[e]=o,o}};var Y=(e,t,n,r,i)=>e.ta(t,n,r,i),X=(e,t,n,r,i)=>e.tr(t,n,r,i),W_=(e,t,n,r,i)=>e.ts(t,n,r,i),Z=(e,t,n,r,i)=>e.tt(t,n,r,i),G_=`WORD`,K_=`UWORD`,q_=`ASCIINUMERICAL`,J_=`ALPHANUMERICAL`,Y_=`LOCALHOST`,X_=`TLD`,Z_=`UTLD`,Q_=`SCHEME`,$_=`SLASH_SCHEME`,ev=`NUM`,tv=`WS`,nv=`NL`,rv=`OPENBRACE`,iv=`CLOSEBRACE`,av=`OPENBRACKET`,ov=`CLOSEBRACKET`,sv=`OPENPAREN`,cv=`CLOSEPAREN`,lv=`OPENANGLEBRACKET`,uv=`CLOSEANGLEBRACKET`,dv=`FULLWIDTHLEFTPAREN`,fv=`FULLWIDTHRIGHTPAREN`,pv=`LEFTCORNERBRACKET`,mv=`RIGHTCORNERBRACKET`,hv=`LEFTWHITECORNERBRACKET`,gv=`RIGHTWHITECORNERBRACKET`,_v=`FULLWIDTHLESSTHAN`,vv=`FULLWIDTHGREATERTHAN`,yv=`AMPERSAND`,bv=`APOSTROPHE`,xv=`ASTERISK`,Sv=`AT`,Cv=`BACKSLASH`,wv=`BACKTICK`,Tv=`CARET`,Ev=`COLON`,Dv=`COMMA`,Ov=`DOLLAR`,kv=`DOT`,Av=`EQUALS`,jv=`EXCLAMATION`,Mv=`HYPHEN`,Nv=`PERCENT`,Pv=`PIPE`,Fv=`PLUS`,Iv=`POUND`,Lv=`QUERY`,Rv=`QUOTE`,zv=`FULLWIDTHMIDDLEDOT`,Bv=`SEMI`,Vv=`SLASH`,Hv=`TILDE`,Uv=`UNDERSCORE`,Wv=`EMOJI`,Gv=`SYM`,Kv=Object.freeze({__proto__:null,ALPHANUMERICAL:J_,AMPERSAND:yv,APOSTROPHE:bv,ASCIINUMERICAL:q_,ASTERISK:xv,AT:Sv,BACKSLASH:Cv,BACKTICK:wv,CARET:Tv,CLOSEANGLEBRACKET:uv,CLOSEBRACE:iv,CLOSEBRACKET:ov,CLOSEPAREN:cv,COLON:Ev,COMMA:Dv,DOLLAR:Ov,DOT:kv,EMOJI:Wv,EQUALS:Av,EXCLAMATION:jv,FULLWIDTHGREATERTHAN:vv,FULLWIDTHLEFTPAREN:dv,FULLWIDTHLESSTHAN:_v,FULLWIDTHMIDDLEDOT:zv,FULLWIDTHRIGHTPAREN:fv,HYPHEN:Mv,LEFTCORNERBRACKET:pv,LEFTWHITECORNERBRACKET:hv,LOCALHOST:Y_,NL:nv,NUM:ev,OPENANGLEBRACKET:lv,OPENBRACE:rv,OPENBRACKET:av,OPENPAREN:sv,PERCENT:Nv,PIPE:Pv,PLUS:Fv,POUND:Iv,QUERY:Lv,QUOTE:Rv,RIGHTCORNERBRACKET:mv,RIGHTWHITECORNERBRACKET:gv,SCHEME:Q_,SEMI:Bv,SLASH:Vv,SLASH_SCHEME:$_,SYM:Gv,TILDE:Hv,TLD:X_,UNDERSCORE:Uv,UTLD:Z_,UWORD:K_,WORD:G_,WS:tv}),qv=/[a-z]/,Jv=/\p{L}/u,Yv=/\p{Emoji}/u,Xv=/\d/,Zv=/\s/,Qv=`\r`,$v=`
|
|
132
|
-
`,
|
|
131
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),S_=K.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,W(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Fp({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),C_=K.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,W(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!zp(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Sf(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(L.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(R.create(t.doc,n.pos)):t.setSelection(L.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(L.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Pp({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),w_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,T_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,E_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,D_=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,O_=cp.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,W(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Np({find:w_,type:this.type}),Np({find:E_,type:this.type})]},addPasteRules(){return[Qp({find:T_,type:this.type}),Qp({find:D_,type:this.type})]}}),k_=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,A_=`ελ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`,j_=`numeric`,M_=`ascii`,N_=`alpha`,P_=`asciinumeric`,F_=`alphanumeric`,I_=`domain`,L_=`emoji`,R_=`scheme`,z_=`slashscheme`,B_=`whitespace`;function V_(e,t){return e in t||(t[e]=[]),t[e]}function H_(e,t,n){t[j_]&&(t[P_]=!0,t[F_]=!0),t[M_]&&(t[P_]=!0,t[N_]=!0),t[P_]&&(t[F_]=!0),t[N_]&&(t[F_]=!0),t[F_]&&(t[I_]=!0),t[L_]&&(t[I_]=!0);for(let r in t){let t=V_(r,n);t.indexOf(e)<0&&t.push(e)}}function U_(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function W_(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}W_.groups={},W_.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=W_.groups;let i;return t&&t.j?i=t:(i=new W_(t),n&&r&&H_(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=W_.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new W_,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new W_,a&&(r&&(o.t&&typeof o.t==`string`?H_(a,Object.assign(U_(o.t,r),n),r):n&&H_(a,n,r)),o.t=a),i.j[e]=o,o}};var J=(e,t,n,r,i)=>e.ta(t,n,r,i),Y=(e,t,n,r,i)=>e.tr(t,n,r,i),G_=(e,t,n,r,i)=>e.ts(t,n,r,i),X=(e,t,n,r,i)=>e.tt(t,n,r,i),K_=`WORD`,q_=`UWORD`,J_=`ASCIINUMERICAL`,Y_=`ALPHANUMERICAL`,X_=`LOCALHOST`,Z_=`TLD`,Q_=`UTLD`,$_=`SCHEME`,ev=`SLASH_SCHEME`,tv=`NUM`,nv=`WS`,rv=`NL`,iv=`OPENBRACE`,av=`CLOSEBRACE`,ov=`OPENBRACKET`,sv=`CLOSEBRACKET`,cv=`OPENPAREN`,lv=`CLOSEPAREN`,uv=`OPENANGLEBRACKET`,dv=`CLOSEANGLEBRACKET`,fv=`FULLWIDTHLEFTPAREN`,pv=`FULLWIDTHRIGHTPAREN`,mv=`LEFTCORNERBRACKET`,hv=`RIGHTCORNERBRACKET`,gv=`LEFTWHITECORNERBRACKET`,_v=`RIGHTWHITECORNERBRACKET`,vv=`FULLWIDTHLESSTHAN`,yv=`FULLWIDTHGREATERTHAN`,bv=`AMPERSAND`,xv=`APOSTROPHE`,Sv=`ASTERISK`,Cv=`AT`,wv=`BACKSLASH`,Tv=`BACKTICK`,Ev=`CARET`,Dv=`COLON`,Ov=`COMMA`,kv=`DOLLAR`,Av=`DOT`,jv=`EQUALS`,Mv=`EXCLAMATION`,Nv=`HYPHEN`,Pv=`PERCENT`,Fv=`PIPE`,Iv=`PLUS`,Lv=`POUND`,Rv=`QUERY`,zv=`QUOTE`,Bv=`FULLWIDTHMIDDLEDOT`,Vv=`SEMI`,Hv=`SLASH`,Uv=`TILDE`,Wv=`UNDERSCORE`,Gv=`EMOJI`,Kv=`SYM`,qv=Object.freeze({__proto__:null,ALPHANUMERICAL:Y_,AMPERSAND:bv,APOSTROPHE:xv,ASCIINUMERICAL:J_,ASTERISK:Sv,AT:Cv,BACKSLASH:wv,BACKTICK:Tv,CARET:Ev,CLOSEANGLEBRACKET:dv,CLOSEBRACE:av,CLOSEBRACKET:sv,CLOSEPAREN:lv,COLON:Dv,COMMA:Ov,DOLLAR:kv,DOT:Av,EMOJI:Gv,EQUALS:jv,EXCLAMATION:Mv,FULLWIDTHGREATERTHAN:yv,FULLWIDTHLEFTPAREN:fv,FULLWIDTHLESSTHAN:vv,FULLWIDTHMIDDLEDOT:Bv,FULLWIDTHRIGHTPAREN:pv,HYPHEN:Nv,LEFTCORNERBRACKET:mv,LEFTWHITECORNERBRACKET:gv,LOCALHOST:X_,NL:rv,NUM:tv,OPENANGLEBRACKET:uv,OPENBRACE:iv,OPENBRACKET:ov,OPENPAREN:cv,PERCENT:Pv,PIPE:Fv,PLUS:Iv,POUND:Lv,QUERY:Rv,QUOTE:zv,RIGHTCORNERBRACKET:hv,RIGHTWHITECORNERBRACKET:_v,SCHEME:$_,SEMI:Vv,SLASH:Hv,SLASH_SCHEME:ev,SYM:Kv,TILDE:Uv,TLD:Z_,UNDERSCORE:Wv,UTLD:Q_,UWORD:q_,WORD:K_,WS:nv}),Jv=/[a-z]/,Yv=/\p{L}/u,Xv=/\p{Emoji}/u,Zv=/\d/,Qv=/\s/,$v=`\r`,ey=`
|
|
132
|
+
`,ty=`️`,ny=``,ry=``,iy=null,ay=null;function oy(e=[]){let t={};W_.groups=t;let n=new W_;iy??=uy(k_),ay??=uy(A_),X(n,`'`,xv),X(n,`{`,iv),X(n,`}`,av),X(n,`[`,ov),X(n,`]`,sv),X(n,`(`,cv),X(n,`)`,lv),X(n,`<`,uv),X(n,`>`,dv),X(n,`(`,fv),X(n,`)`,pv),X(n,`「`,mv),X(n,`」`,hv),X(n,`『`,gv),X(n,`』`,_v),X(n,`<`,vv),X(n,`>`,yv),X(n,`&`,bv),X(n,`*`,Sv),X(n,`@`,Cv),X(n,"`",Tv),X(n,`^`,Ev),X(n,`:`,Dv),X(n,`,`,Ov),X(n,`$`,kv),X(n,`.`,Av),X(n,`=`,jv),X(n,`!`,Mv),X(n,`-`,Nv),X(n,`%`,Pv),X(n,`|`,Fv),X(n,`+`,Iv),X(n,`#`,Lv),X(n,`?`,Rv),X(n,`"`,zv),X(n,`/`,Hv),X(n,`;`,Vv),X(n,`~`,Uv),X(n,`_`,Wv),X(n,`\\`,wv),X(n,`・`,Bv);let r=Y(n,Zv,tv,{[j_]:!0});Y(r,Zv,r);let i=Y(r,Jv,J_,{[P_]:!0}),a=Y(r,Yv,Y_,{[F_]:!0}),o=Y(n,Jv,K_,{[M_]:!0});Y(o,Zv,i),Y(o,Jv,o),Y(i,Zv,i),Y(i,Jv,i);let s=Y(n,Yv,q_,{[N_]:!0});Y(s,Jv),Y(s,Zv,a),Y(s,Yv,s),Y(a,Zv,a),Y(a,Jv),Y(a,Yv,a);let c=X(n,ey,rv,{[B_]:!0}),l=X(n,$v,nv,{[B_]:!0}),u=Y(n,Qv,nv,{[B_]:!0});X(n,ry,u),X(l,ey,c),X(l,ry,u),Y(l,Qv,u),X(u,$v),X(u,ey),Y(u,Qv,u),X(u,ry,u);let d=Y(n,Xv,Gv,{[L_]:!0});X(d,`#`),Y(d,Xv,d),X(d,ty,d);let f=X(d,ny);X(f,`#`),Y(f,Xv,d);let p=[[Jv,o],[Zv,i]],m=[[Jv,null],[Yv,s],[Zv,a]];for(let e=0;e<iy.length;e++)ly(n,iy[e],Z_,K_,p);for(let e=0;e<ay.length;e++)ly(n,ay[e],Q_,q_,m);H_(Z_,{tld:!0,ascii:!0},t),H_(Q_,{utld:!0,alpha:!0},t),ly(n,`file`,$_,K_,p),ly(n,`mailto`,$_,K_,p),ly(n,`http`,ev,K_,p),ly(n,`https`,ev,K_,p),ly(n,`ftp`,ev,K_,p),ly(n,`ftps`,ev,K_,p),H_($_,{scheme:!0,ascii:!0},t),H_(ev,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[R_]:!0}:{[z_]:!0};r.indexOf(`-`)>=0?i[I_]=!0:Jv.test(r)?Zv.test(r)?i[P_]=!0:i[M_]=!0:i[j_]=!0,G_(n,r,r,i)}return G_(n,`localhost`,X_,{ascii:!0}),n.jd=new W_(Kv),{start:n,tokens:Object.assign({groups:t},qv)}}function sy(e,t){let n=cy(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function cy(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function ly(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new W_(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new W_(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function uy(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var dy={defaultProtocol:`http`,events:null,format:py,formatHref:py,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function fy(e,t=null){let n=Object.assign({},dy);e&&(n=Object.assign(n,e instanceof fy?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}fy.prototype={o:dy,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:dy[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function py(e){return e}function my(e,t){this.t=`token`,this.v=e,this.tk=t}my.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=dy.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function hy(e,t){class n extends my{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var gy=hy(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),_y=hy(`text`),vy=hy(`nl`),yy=hy(`url`,{isLink:!0,toHref(e=dy.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==X_&&e[1].t===Dv}}),by=e=>new W_(e);function xy({groups:e}){let t=e.domain.concat([bv,Sv,Cv,wv,Tv,Ev,kv,jv,Nv,tv,Pv,Fv,Iv,Lv,Hv,Kv,Uv,Wv]),n=[xv,Dv,Ov,Av,Mv,Pv,Rv,zv,Vv,uv,dv,iv,av,sv,ov,cv,lv,fv,pv,mv,hv,gv,_v,vv,yv],r=[bv,xv,Sv,wv,Tv,Ev,kv,jv,Nv,iv,av,Pv,Fv,Iv,Lv,Rv,Hv,Kv,Uv,Wv],i=by(),a=X(i,Uv);J(a,r,a),J(a,e.domain,a);let o=by(),s=by(),c=by();J(i,e.domain,o),J(i,e.scheme,s),J(i,e.slashscheme,c),J(o,r,a),J(o,e.domain,o);let l=X(o,Cv);X(a,Cv,l),X(s,Cv,l),X(c,Cv,l);let u=X(a,Av);J(u,r,a),J(u,e.domain,a);let d=by();J(l,e.domain,d),J(d,e.domain,d);let f=X(d,Av);J(f,e.domain,d);let p=by(gy);J(f,e.tld,p),J(f,e.utld,p),X(l,X_,p);let m=X(d,Nv);X(m,Nv,m),J(m,e.domain,d),J(p,e.domain,d),X(p,Av,f),X(p,Nv,m);let h=X(o,Nv),g=X(o,Av);X(h,Nv,h),J(h,e.domain,o),J(g,r,a),J(g,e.domain,o);let _=by(yy);J(g,e.tld,_),J(g,e.utld,_),J(_,e.domain,o),J(_,r,a),X(_,Av,g),X(_,Nv,h),X(_,Cv,l);let v=X(_,Dv),y=by(yy);J(v,e.numeric,y);let b=by(yy),x=by();J(b,t,b),J(b,n,x),J(x,t,b),J(x,n,x),X(_,Hv,b),X(y,Hv,b);let S=X(s,Dv),C=X(X(X(c,Dv),Hv),Hv);J(s,e.domain,o),X(s,Av,g),X(s,Nv,h),J(c,e.domain,o),X(c,Av,g),X(c,Nv,h),J(S,e.domain,b),X(S,Hv,b),X(S,Rv,b),J(C,e.domain,b),J(C,t,b),X(C,Hv,b);let w=[[iv,av],[ov,sv],[cv,lv],[uv,dv],[fv,pv],[mv,hv],[gv,_v],[vv,yv]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=X(b,r);X(x,r,a);let o=by(yy);J(a,t,o);let s=by();J(a,n,s),X(a,i,b),J(o,t,o),J(o,n,s),J(s,t,o),J(s,n,s),X(o,i,b),X(s,i,b)}return X(i,X_,_),X(i,rv,vy),{start:i,tokens:qv}}function Sy(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(Cy(_y,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(Cy(e,t,r))}}return o.length>0&&a.push(Cy(_y,t,o)),a}function Cy(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var wy=typeof console<`u`&&console&&console.warn||(()=>{}),Ty=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,Z={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ey(){return W_.groups={},Z.scanner=null,Z.parser=null,Z.tokenQueue=[],Z.pluginQueue=[],Z.customSchemes=[],Z.initialized=!1,Z}function Dy(e,t=!1){if(Z.initialized&&wy(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Ty}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
133
133
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
134
134
|
2. Cannot start or end with "-"
|
|
135
|
-
3. "-" cannot repeat`);
|
|
136
|
-
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
135
|
+
3. "-" cannot repeat`);Z.customSchemes.push([e,t])}function Oy(){Z.scanner=oy(Z.customSchemes);for(let e=0;e<Z.tokenQueue.length;e++)Z.tokenQueue[e][1]({scanner:Z.scanner});Z.parser=xy(Z.scanner.tokens);for(let e=0;e<Z.pluginQueue.length;e++)Z.pluginQueue[e][1]({scanner:Z.scanner,parser:Z.parser});return Z.initialized=!0,Z}function ky(e){return Z.initialized||Oy(),Sy(Z.parser.start,e,sy(Z.scanner.start,e))}ky.scan=sy;function Ay(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new fy(n),i=ky(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var jy=`[\0- \xA0 -\u2029 ]`,My=new RegExp(jy),Ny=RegExp(`${jy}$`),Py=new RegExp(jy,`g`);function Fy(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Iy(e){return new z({key:new B(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(lf(Nd(n.doc,[...t])).forEach(({newRange:t})=>{let n=Fd(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!Ny.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(My).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=ky(n).map(t=>t.toObject(e.defaultProtocol));if(!Fy(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{uf(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Ly(e){return new z({key:new B(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=of(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function Ry(e){return new z({key:new B(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=Ay(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function zy(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Py,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var By=cp.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){Dy(e);return}Dy(e.scheme,e.optionalSlashes)})},onDestroy(){Ey()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!zy(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!zy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!zy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,W(this.options.HTMLAttributes,e),0]:[`a`,W(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!zy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!zy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[Qp({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=Ay(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!zy(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Iy({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!zy(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Ly({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Ry({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Vy=By,Hy=Object.defineProperty,Uy=(e,t)=>{for(var n in t)Hy(e,n,{get:t[n],enumerable:!0})},Wy=`listItem`,Gy=`textStyle`,Ky=/^\s*([-+*])\s$/,qy=K.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
136
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Wy,this.editor.getAttributes(Gy)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Ip({find:Ky,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ip({find:Ky,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Gy),editor:this.editor})),[e]}}),Jy=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},Yy=(e,t,n,r)=>{let i=Jy(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,N.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},Xy=(e,t,n)=>Yy(e.state,e.view.dispatch,t,n),Zy=(e,t)=>G.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>Xy(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}});function Qy(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function $y(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var eb=K.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Qy(e))return{type:`listItem`,content:[{type:`paragraph`,content:$y(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>Yp(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addExtensions(){return[Zy(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});Uy({},{findListItemPos:()=>tb,getNextListDepth:()=>nb,handleBackspace:()=>ib,handleDelete:()=>sb,hasListBefore:()=>rb,hasListItemAfter:()=>cb,hasListItemBefore:()=>lb,listItemHasSubList:()=>ub,nextListIsDeeper:()=>ab,nextListIsHigher:()=>ob});var tb=(e,t)=>{let{$from:n}=t.selection,r=V(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},nb=(e,t)=>{let n=tb(e,t);if(!n)return!1;let[,r]=df(t,e,n.$pos.pos+4);return r},rb=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},ib=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!hd(e.state,t)&&rb(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!hd(e.state,t)||!vf(e.state)?!1:e.chain().liftListItem(t).run()},ab=(e,t)=>{let n=nb(e,t),r=tb(e,t);return!r||!n?!1:n>r.depth},ob=(e,t)=>{let n=nb(e,t),r=tb(e,t);return!r||!n?!1:n<r.depth},sb=(e,t)=>{if(!hd(e.state,t)||!_f(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:ab(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():ob(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},cb=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},lb=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},ub=(e,t,n)=>{if(!n)return!1;let r=V(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},db=G.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&sb(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&sb(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ib(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&ib(e,n,r)&&(t=!0)}),t}}}}),fb=/^(\s*)(\d+)\.\s+(.*)$/,pb=/^\s/;function mb(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function hb(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&mb(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function gb(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(fb);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(fb))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(pb))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
|
|
137
137
|
`).trim(),contentLines:u,raw:f.join(`
|
|
138
|
-
`)}),r=d,n=d}return[t,r]}function
|
|
138
|
+
`)}),r=d,n=d}return[t,r]}function _b(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=hb(a.contentLines),c=o.join(`
|
|
139
139
|
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
140
|
-
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=
|
|
141
|
-
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function
|
|
140
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=_b(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
|
|
141
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function vb(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var yb=`listItem`,bb=`textStyle`,xb=/^(\d+)\.\s$/,Sb=K.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,W(this.options.HTMLAttributes,n),0]:[`ol`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?vb(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
142
142
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
143
|
-
`),[i,a]=
|
|
144
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
145
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Jp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Jp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});G.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Ky.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push($y.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(ub.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(xb.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Cb.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(wb.configure(this.options.taskList)),e}});var Tb=` `,Eb=`\xA0`,Db=K.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,W(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Tb||n[0].text===Tb||n[0].raw===Eb||n[0].text===Eb)&&r.length===1&&r[0].type===`text`&&(r[0].text===Tb||r[0].text===Eb)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?Tb:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ob=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,kb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ab=cp.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Np({find:Ob,type:this.type})]},addPasteRules(){return[Qp({find:kb,type:this.type})]}}),jb=K.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Mb=cp.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,W(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Nb(e={}){return new z({view(t){return new Pb(t,e)}})}var Pb=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Gn(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},Fb=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Ib=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Lb=null,Rb=function(e,t,n){let r=Lb||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},zb=function(){Lb=null},Bb=function(e,t,n,r){return n&&(Hb(e,t,n,r,-1)||Hb(e,t,n,r,1))},Vb=/^(img|br|input|textarea|hr)$/i;function Hb(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ub(e))){let n=e.parentNode;if(!n||n.nodeType!=1||qb(e)||Vb.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Fb(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Ub(e):0}else return!1}}function Ub(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Wb(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Ub(e)}else if(e.parentNode&&!qb(e))t=Fb(e),e=e.parentNode;else return null}}function Gb(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!qb(e))t=Fb(e)+1,e=e.parentNode;else return null}}function Kb(e,t,n){for(let r=t==0,i=t==Ub(e);r||i;){if(e==n)return!0;let t=Fb(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Ub(e)}}function qb(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Jb=function(e){return e.focusNode&&Bb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Yb(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Xb(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Zb(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Ub(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Ub(r.startContainer),r.startOffset)}}}var Qb=typeof navigator<`u`?navigator:null,$b=typeof document<`u`?document:null,ex=Qb&&Qb.userAgent||``,tx=/Edge\/(\d+)/.exec(ex),nx=/MSIE \d/.exec(ex),rx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ex),ix=!!(nx||rx||tx),ax=nx?document.documentMode:rx?+rx[1]:tx?+tx[1]:0,ox=!ix&&/gecko\/(\d+)/i.test(ex);ox&&+(/Firefox\/(\d+)/.exec(ex)||[0,0])[1];var sx=!ix&&/Chrome\/(\d+)/.exec(ex),cx=!!sx,lx=sx?+sx[1]:0,ux=!ix&&!!Qb&&/Apple Computer/.test(Qb.vendor),dx=ux&&(/Mobile\/\w+/.test(ex)||!!Qb&&Qb.maxTouchPoints>2),fx=dx||(Qb?/Mac/.test(Qb.platform):!1),px=Qb?/Win/.test(Qb.platform):!1,mx=/Android \d/.test(ex),hx=!!$b&&`webkitFontSmoothing`in $b.documentElement.style,gx=hx?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _x(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function vx(e,t){return typeof e==`number`?e:e[t]}function yx(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bx(e,t,n){if(!Fx(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Ib(o);continue}let e=o,n=e==a.body,s=n?_x(a):yx(e),c=0,l=0;if(t.top<s.top+vx(r,`top`)?l=-(s.top-t.top+vx(i,`top`)):t.bottom>s.bottom-vx(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+vx(i,`top`)-s.top:t.bottom-s.bottom+vx(i,`bottom`)),t.left<s.left+vx(r,`left`)?c=-(s.left-t.left+vx(i,`left`)):t.right>s.right-vx(r,`right`)&&(c=t.right-s.right+vx(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Ib(o)}}function xx(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Sx(e.dom)}}function Sx(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ib(r));return t}function Cx({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wx(n,r==0?0:r-t)}function wx(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Tx=null;function Ex(e){if(e.setActive)return e.setActive();if(Tx)return e.focus(Tx);let t=Sx(e);e.focus(Tx==null?{get preventScroll(){return Tx={preventScroll:!0},!0}}:void 0),Tx||(Tx=!1,wx(t,0))}function Dx(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=Rb(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?Ox(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Dx(n,i)}function Ox(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Ix(r,1);if(n.top!=n.bottom&&kx(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function kx(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ax(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function jx(e,t,n){let{node:r,offset:i}=Dx(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Mx(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Nx(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(kx(t,i))return Nx(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Px(e,t){let n=e.dom.ownerDocument,r,i=0,a=Zb(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!kx(t,n)||(o=Nx(e.dom,t,n),!o))return null}if(ux)for(let e=o;r&&e;e=Ib(e))e.draggable&&(r=void 0);if(o=Ax(o,t),r){if(ox&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;hx&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Mx(e,r,i,t))}s??=jx(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Fx(e){return e.top<e.bottom||e.left<e.right}function Ix(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Fx(e))return e}return Array.prototype.find.call(n,Fx)||e.getBoundingClientRect()}var Lx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Rx(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=hx||ox;if(r.nodeType==3)if(o&&(Lx.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Ix(Rb(r,i,i),n);if(ox&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Ix(Rb(r,i-1,i-1),-1);if(t.top==e.top){let n=Ix(Rb(r,i,i+1),-1);if(n.top!=e.top)return zx(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,zx(Ix(Rb(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Ub(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Bx(e.getBoundingClientRect(),!1)}if(a==null&&i<Ub(r)){let e=r.childNodes[i];if(e.nodeType==1)return Bx(e.getBoundingClientRect(),!0)}return Bx(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Ub(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Rb(e,Ub(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return zx(Ix(t,1),!1)}if(a==null&&i<Ub(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?Rb(e,0,+!o):e.nodeType==1?e:null:null;if(t)return zx(Ix(t,-1),!0)}return zx(Ix(r.nodeType==3?Rb(r):r,-n),n>=0)}function zx(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Bx(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Vx(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Hx(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Vx(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Rx(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Rb(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Ux=/[\u0590-\u08ac]/;function Wx(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Ux.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Vx(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Gx=null,Kx=null,qx=!1;function Jx(e,t,n){return Gx==t&&Kx==n?qx:(Gx=t,Kx=n,qx=n==`up`||n==`down`?Hx(e,t,n):Wx(e,t,n))}var Yx=0,Xx=1,Zx=2,Qx=3,$x=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Yx,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Fb(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof oS){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof eS&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Fb(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Fb(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Fb(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Fb(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((ox||ux)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
146
|
-
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Fb(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(ox&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&ux)&&Bb(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Bb(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&ox)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Zx:Xx,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Qx:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Zx:Qx}n=a}this.dirty=Zx}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Zx:Xx;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},eS=class extends $x{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.hasAttribute(`contenteditable`)||(a.contentEditable=`false`),a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Yx&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},tS=class extends $x{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},nS=class e extends $x{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Wt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Qx||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Qx&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Yx){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Yx}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=CS(a,n,o,r)),t>0&&(a=CS(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},rS=class e extends $x{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Wt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=mS(u,r,n),l?c=new sS(t,n,r,i,u,d||null,f,l):n.isText?new aS(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>t.nodeType==1&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>N.empty}}return t}matchesNode(e,t,n){return this.dirty==Yx&&e.eq(this.node)&&hS(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new _S(this,a&&a.node,e);bS(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?P.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Zx)&&(a&&this.protectLocalComposition(e,a),cS(this.contentDOM,this.children,e),dx&&xS(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof L)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=SS(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new tS(this,i,t,r);e.input.compositionNodes.push(a),this.children=CS(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Qx||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Yx}updateOuterDeco(e){if(hS(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=fS(this.dom,this.nodeDOM,dS(this.outerDeco,this.node,t),dS(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function iS(e,t,n,r,i){mS(r,t,e);let a=new rS(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var aS=class e extends rS{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Qx||this.dirty!=Yx&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Yx||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Yx,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Qx)}get domAtom(){return!1}isText(e){return this.node.text==e}},oS=class extends $x{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Yx&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},sS=class extends rS{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Qx)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function cS(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=gS(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof nS){let t=r?r.previousSibling:e.lastChild;cS(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=gS(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var lS=function(e){e&&(this.nodeName=e)};lS.prototype=Object.create(null);var uS=[new lS];function dS(e,t,n){if(e.length==0)return uS;let r=n?uS[0]:new lS,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new lS(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new lS(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function fS(e,t,n,r){if(n==uS&&r==uS)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=uS[0],i=t)}pS(i,o||uS[0],a)}return i}function pS(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function mS(e,t,n){return fS(e,e,uS,dS(t,n,e.nodeType!=1))}function hS(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function gS(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var _S=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vS(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Yx,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof nS&&t.dirty!=Qx&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=nS.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Qx&&a.dom==a.contentDOM&&(a.dirty=Zx),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof rS){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Qx&&hS(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Zx,u.updateChildren(r,a+1),u.dirty=Yx),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!hS(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=rS.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=rS.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new eS(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof nS;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof aS)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ux||cx)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new oS(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function vS(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof nS)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function yS(e,t){return e.type.side-t.type.side}function bS(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(yS);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function xS(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function SS(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function CS(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function wS(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Jb(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&R.isSelectable(e)&&i.parent&&!(e.isInline&&Kb(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new R(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=FS(e,u,s,n)}return l}function TS(e){return e.editable?e.hasFocus():LS(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ES(e,t=!1){let n=e.state.selection;if(NS(e,n),!TS(e))return;let r=e.input.mouseDown;if(!t&&cx&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Bb(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)MS(e);else{let{anchor:r,head:i}=n,a,o;DS&&!(n instanceof L)&&(n.$from.parent.inlineContent||(a=OS(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=OS(e,n.to))),e.docView.setSelection(r,i,e,t),DS&&(a&&AS(a),o&&AS(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&jS(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var DS=ux||cx&&lx<63;function OS(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(ux&&i&&i.contentEditable==`false`)return kS(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return kS(i);if(a)return kS(a)}}function kS(e){return e.contentEditable=`true`,ux&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function AS(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function jS(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!TS(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function MS(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Fb(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ix&&ax<=11&&(n.disabled=!0,n.disabled=!1)}function NS(e,t){if(t instanceof R){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(PS(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else PS(e)}function PS(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function FS(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||L.between(t,n,r)}function IS(e){return e.editable&&!e.hasFocus()?!1:LS(e)}function LS(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function RS(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Bb(t.node,t.offset,n.anchorNode,n.anchorOffset)}function zS(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&I.findFrom(a,t)}function BS(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function VS(e,t,n){let r=e.state.selection;if(r instanceof L){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return BS(e,new L(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=zS(e.state,t);return n&&n instanceof R?BS(e,n):!1}else if(!(fx&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?R.isSelectable(i)?BS(e,new R(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):hx?BS(e,new L(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof R&&r.node.isInline)return BS(e,new L(t>0?r.$to:r.$from));else{let n=zS(e.state,t);return n?BS(e,n):!1}}function HS(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function US(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function WS(e,t){return t<0?GS(e):KS(e)}function GS(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(ox&&n.nodeType==1&&r<HS(n)&&US(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(US(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(qS(n))break;else{let t=n.previousSibling;for(;t&&US(t,-1);)i=n.parentNode,a=Fb(t),t=t.previousSibling;if(t)n=t,r=HS(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?XS(e,n,r):i&&XS(e,i,a)}function KS(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=HS(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(US(e,1))a=n,o=++r;else break}else if(qS(n))break;else{let t=n.nextSibling;for(;t&&US(t,1);)a=t.parentNode,o=Fb(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=HS(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&XS(e,a,o)}function qS(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function JS(e,t){for(;e&&t==e.childNodes.length&&!qb(e);)t=Fb(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function YS(e,t){for(;e&&!t&&!qb(e);)t=Fb(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function XS(e,t,n){if(t.nodeType!=3){let e,r;(r=JS(t,n))?(t=r,n=0):(e=YS(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Jb(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&ES(e)},50)}function ZS(e,t){let n=e.state.doc.resolve(t);if(!(cx||px)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function QS(e,t,n){let r=e.state.selection;if(r instanceof L&&!r.empty||n.indexOf(`s`)>-1||fx&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=zS(e.state,t);if(n&&n instanceof R)return BS(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof ji?I.near(n,t):I.findFrom(n,t);return o?BS(e,o):!1}return!1}function $S(e,t){if(!(e.state.selection instanceof L))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function eC(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function tC(e){if(!ux||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;eC(e,n,`true`),setTimeout(()=>eC(e,n,`false`),20)}return!1}function nC(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function rC(e,t){let n=t.keyCode,r=nC(t);if(n==8||fx&&n==72&&r==`c`)return $S(e,-1)||WS(e,-1);if(n==46&&!t.shiftKey||fx&&n==68&&r==`c`)return $S(e,1)||WS(e,1);if(n==13||n==27)return!0;if(n==37||fx&&n==66&&r==`c`){let t=n==37?ZS(e,e.state.selection.from)==`ltr`?-1:1:-1;return VS(e,t,r)||WS(e,t)}else if(n==39||fx&&n==70&&r==`c`){let t=n==39?ZS(e,e.state.selection.from)==`ltr`?1:-1:1;return VS(e,t,r)||WS(e,t)}else if(n==38||fx&&n==80&&r==`c`)return QS(e,-1,r)||WS(e,-1);else if(n==40||fx&&n==78&&r==`c`)return tC(e)||QS(e,1,r)||WS(e,1);else if(r==(fx?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function iC(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Wt.fromSchema(e.state.schema),s=mC(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=pC[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
143
|
+
`),[i,a]=gb(r);if(i.length===0)return;let o=_b(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
144
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(yb,this.editor.getAttributes(bb)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Ip({find:xb,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ip({find:xb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(bb)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Cb=/^\s*(\[([( |x])?\])\s$/,wb=K.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,W(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Yp(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[Zy(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Kd(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Ip({find:Cb,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Tb=K.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,W(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
145
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Jp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Jp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});G.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(qy.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(eb.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(db.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Sb.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(wb.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Tb.configure(this.options.taskList)),e}});var Eb=` `,Db=`\xA0`,Ob=K.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,W(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Eb||n[0].text===Eb||n[0].raw===Db||n[0].text===Db)&&r.length===1&&r[0].type===`text`&&(r[0].text===Eb||r[0].text===Db)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?Eb:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),kb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ab=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jb=cp.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Np({find:kb,type:this.type})]},addPasteRules(){return[Qp({find:Ab,type:this.type})]}}),Mb=K.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Nb=cp.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,W(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Pb(e={}){return new z({view(t){return new Fb(t,e)}})}var Fb=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Gn(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},Ib=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Lb=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Rb=null,zb=function(e,t,n){let r=Rb||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Bb=function(){Rb=null},Vb=function(e,t,n,r){return n&&(Ub(e,t,n,r,-1)||Ub(e,t,n,r,1))},Hb=/^(img|br|input|textarea|hr)$/i;function Ub(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Wb(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Jb(e)||Hb.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Ib(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Wb(e):0}else return!1}}function Wb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Gb(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Wb(e)}else if(e.parentNode&&!Jb(e))t=Ib(e),e=e.parentNode;else return null}}function Kb(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Jb(e))t=Ib(e)+1,e=e.parentNode;else return null}}function qb(e,t,n){for(let r=t==0,i=t==Wb(e);r||i;){if(e==n)return!0;let t=Ib(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Wb(e)}}function Jb(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Yb=function(e){return e.focusNode&&Vb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Xb(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Zb(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Qb(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Wb(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Wb(r.startContainer),r.startOffset)}}}var $b=typeof navigator<`u`?navigator:null,ex=typeof document<`u`?document:null,tx=$b&&$b.userAgent||``,nx=/Edge\/(\d+)/.exec(tx),rx=/MSIE \d/.exec(tx),ix=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tx),ax=!!(rx||ix||nx),ox=rx?document.documentMode:ix?+ix[1]:nx?+nx[1]:0,sx=!ax&&/gecko\/(\d+)/i.test(tx);sx&&+(/Firefox\/(\d+)/.exec(tx)||[0,0])[1];var cx=!ax&&/Chrome\/(\d+)/.exec(tx),lx=!!cx,ux=cx?+cx[1]:0,dx=!ax&&!!$b&&/Apple Computer/.test($b.vendor),fx=dx&&(/Mobile\/\w+/.test(tx)||!!$b&&$b.maxTouchPoints>2),px=fx||($b?/Mac/.test($b.platform):!1),mx=$b?/Win/.test($b.platform):!1,hx=/Android \d/.test(tx),gx=!!ex&&`webkitFontSmoothing`in ex.documentElement.style,_x=gx?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vx(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function yx(e,t){return typeof e==`number`?e:e[t]}function bx(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function xx(e,t,n){if(!Ix(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Lb(o);continue}let e=o,n=e==a.body,s=n?vx(a):bx(e),c=0,l=0;if(t.top<s.top+yx(r,`top`)?l=-(s.top-t.top+yx(i,`top`)):t.bottom>s.bottom-yx(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+yx(i,`top`)-s.top:t.bottom-s.bottom+yx(i,`bottom`)),t.left<s.left+yx(r,`left`)?c=-(s.left-t.left+yx(i,`left`)):t.right>s.right-yx(r,`right`)&&(c=t.right-s.right+yx(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Lb(o)}}function Sx(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Cx(e.dom)}}function Cx(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Lb(r));return t}function wx({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Tx(n,r==0?0:r-t)}function Tx(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Ex=null;function Dx(e){if(e.setActive)return e.setActive();if(Ex)return e.focus(Ex);let t=Cx(e);e.focus(Ex==null?{get preventScroll(){return Ex={preventScroll:!0},!0}}:void 0),Ex||(Ex=!1,Tx(t,0))}function Ox(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=zb(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?kx(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Ox(n,i)}function kx(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Lx(r,1);if(n.top!=n.bottom&&Ax(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Ax(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function jx(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Mx(e,t,n){let{node:r,offset:i}=Ox(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Nx(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Px(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Ax(t,i))return Px(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Fx(e,t){let n=e.dom.ownerDocument,r,i=0,a=Qb(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!Ax(t,n)||(o=Px(e.dom,t,n),!o))return null}if(dx)for(let e=o;r&&e;e=Lb(e))e.draggable&&(r=void 0);if(o=jx(o,t),r){if(sx&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;gx&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Nx(e,r,i,t))}s??=Mx(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Ix(e){return e.top<e.bottom||e.left<e.right}function Lx(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Ix(e))return e}return Array.prototype.find.call(n,Ix)||e.getBoundingClientRect()}var Rx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zx(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=gx||sx;if(r.nodeType==3)if(o&&(Rx.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Lx(zb(r,i,i),n);if(sx&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Lx(zb(r,i-1,i-1),-1);if(t.top==e.top){let n=Lx(zb(r,i,i+1),-1);if(n.top!=e.top)return Bx(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Bx(Lx(zb(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Wb(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Vx(e.getBoundingClientRect(),!1)}if(a==null&&i<Wb(r)){let e=r.childNodes[i];if(e.nodeType==1)return Vx(e.getBoundingClientRect(),!0)}return Vx(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Wb(r))){let e=r.childNodes[i-1],t=e.nodeType==3?zb(e,Wb(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Bx(Lx(t,1),!1)}if(a==null&&i<Wb(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?zb(e,0,+!o):e.nodeType==1?e:null:null;if(t)return Bx(Lx(t,-1),!0)}return Bx(Lx(r.nodeType==3?zb(r):r,-n),n>=0)}function Bx(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Vx(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Hx(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Ux(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Hx(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=zx(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=zb(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Wx=/[\u0590-\u08ac]/;function Gx(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Wx.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Hx(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Kx=null,qx=null,Jx=!1;function Yx(e,t,n){return Kx==t&&qx==n?Jx:(Kx=t,qx=n,Jx=n==`up`||n==`down`?Ux(e,t,n):Gx(e,t,n))}var Xx=0,Zx=1,Qx=2,$x=3,eS=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Xx,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Ib(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof sS){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof tS&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Ib(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Ib(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Ib(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Ib(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((sx||dx)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
146
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Ib(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(sx&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&dx)&&Vb(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Vb(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&sx)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Qx:Zx,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=$x:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Qx:$x}n=a}this.dirty=Qx}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Qx:Zx;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},tS=class extends eS{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.hasAttribute(`contenteditable`)||(a.contentEditable=`false`),a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Xx&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},nS=class extends eS{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},rS=class e extends eS{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Wt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$x||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$x&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Xx){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Xx}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=wS(a,n,o,r)),t>0&&(a=wS(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},iS=class e extends eS{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Wt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=hS(u,r,n),l?c=new cS(t,n,r,i,u,d||null,f,l):n.isText?new oS(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>t.nodeType==1&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>N.empty}}return t}matchesNode(e,t,n){return this.dirty==Xx&&e.eq(this.node)&&gS(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new vS(this,a&&a.node,e);xS(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?P.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Qx)&&(a&&this.protectLocalComposition(e,a),lS(this.contentDOM,this.children,e),fx&&SS(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof L)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=CS(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new nS(this,i,t,r);e.input.compositionNodes.push(a),this.children=wS(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==$x||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Xx}updateOuterDeco(e){if(gS(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=pS(this.dom,this.nodeDOM,fS(this.outerDeco,this.node,t),fS(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function aS(e,t,n,r,i){hS(r,t,e);let a=new iS(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var oS=class e extends iS{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==$x||this.dirty!=Xx&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Xx||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Xx,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=$x)}get domAtom(){return!1}isText(e){return this.node.text==e}},sS=class extends eS{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xx&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},cS=class extends iS{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==$x)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function lS(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=_S(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof rS){let t=r?r.previousSibling:e.lastChild;lS(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=_S(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var uS=function(e){e&&(this.nodeName=e)};uS.prototype=Object.create(null);var dS=[new uS];function fS(e,t,n){if(e.length==0)return dS;let r=n?dS[0]:new uS,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new uS(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new uS(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function pS(e,t,n,r){if(n==dS&&r==dS)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=dS[0],i=t)}mS(i,o||dS[0],a)}return i}function mS(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function hS(e,t,n){return pS(e,e,dS,fS(t,n,e.nodeType!=1))}function gS(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function _S(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var vS=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=yS(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Xx,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof rS&&t.dirty!=$x&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=rS.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==$x&&a.dom==a.contentDOM&&(a.dirty=Qx),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof iS){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=$x&&gS(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Qx,u.updateChildren(r,a+1),u.dirty=Xx),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!gS(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=iS.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=iS.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new tS(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof rS;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof oS)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((dx||lx)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new sS(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function yS(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof rS)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function bS(e,t){return e.type.side-t.type.side}function xS(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(bS);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function SS(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function CS(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function wS(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function TS(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Yb(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&R.isSelectable(e)&&i.parent&&!(e.isInline&&qb(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new R(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=IS(e,u,s,n)}return l}function ES(e){return e.editable?e.hasFocus():RS(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function DS(e,t=!1){let n=e.state.selection;if(PS(e,n),!ES(e))return;let r=e.input.mouseDown;if(!t&&lx&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Vb(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)NS(e);else{let{anchor:r,head:i}=n,a,o;OS&&!(n instanceof L)&&(n.$from.parent.inlineContent||(a=kS(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=kS(e,n.to))),e.docView.setSelection(r,i,e,t),OS&&(a&&jS(a),o&&jS(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&MS(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var OS=dx||lx&&ux<63;function kS(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(dx&&i&&i.contentEditable==`false`)return AS(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return AS(i);if(a)return AS(a)}}function AS(e){return e.contentEditable=`true`,dx&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function jS(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function MS(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!ES(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function NS(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Ib(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ax&&ox<=11&&(n.disabled=!0,n.disabled=!1)}function PS(e,t){if(t instanceof R){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(FS(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else FS(e)}function FS(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function IS(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||L.between(t,n,r)}function LS(e){return e.editable&&!e.hasFocus()?!1:RS(e)}function RS(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function zS(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Vb(t.node,t.offset,n.anchorNode,n.anchorOffset)}function BS(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&I.findFrom(a,t)}function VS(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function HS(e,t,n){let r=e.state.selection;if(r instanceof L){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return VS(e,new L(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=BS(e.state,t);return n&&n instanceof R?VS(e,n):!1}else if(!(px&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?R.isSelectable(i)?VS(e,new R(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):gx?VS(e,new L(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof R&&r.node.isInline)return VS(e,new L(t>0?r.$to:r.$from));else{let n=BS(e.state,t);return n?VS(e,n):!1}}function US(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function WS(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function GS(e,t){return t<0?KS(e):qS(e)}function KS(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(sx&&n.nodeType==1&&r<US(n)&&WS(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(WS(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(JS(n))break;else{let t=n.previousSibling;for(;t&&WS(t,-1);)i=n.parentNode,a=Ib(t),t=t.previousSibling;if(t)n=t,r=US(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?ZS(e,n,r):i&&ZS(e,i,a)}function qS(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=US(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(WS(e,1))a=n,o=++r;else break}else if(JS(n))break;else{let t=n.nextSibling;for(;t&&WS(t,1);)a=t.parentNode,o=Ib(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=US(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&ZS(e,a,o)}function JS(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function YS(e,t){for(;e&&t==e.childNodes.length&&!Jb(e);)t=Ib(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function XS(e,t){for(;e&&!t&&!Jb(e);)t=Ib(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function ZS(e,t,n){if(t.nodeType!=3){let e,r;(r=YS(t,n))?(t=r,n=0):(e=XS(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Yb(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&DS(e)},50)}function QS(e,t){let n=e.state.doc.resolve(t);if(!(lx||mx)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function $S(e,t,n){let r=e.state.selection;if(r instanceof L&&!r.empty||n.indexOf(`s`)>-1||px&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=BS(e.state,t);if(n&&n instanceof R)return VS(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof ji?I.near(n,t):I.findFrom(n,t);return o?VS(e,o):!1}return!1}function eC(e,t){if(!(e.state.selection instanceof L))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function tC(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function nC(e){if(!dx||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;tC(e,n,`true`),setTimeout(()=>tC(e,n,`false`),20)}return!1}function rC(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function iC(e,t){let n=t.keyCode,r=rC(t);if(n==8||px&&n==72&&r==`c`)return eC(e,-1)||GS(e,-1);if(n==46&&!t.shiftKey||px&&n==68&&r==`c`)return eC(e,1)||GS(e,1);if(n==13||n==27)return!0;if(n==37||px&&n==66&&r==`c`){let t=n==37?QS(e,e.state.selection.from)==`ltr`?-1:1:-1;return HS(e,t,r)||GS(e,t)}else if(n==39||px&&n==70&&r==`c`){let t=n==39?QS(e,e.state.selection.from)==`ltr`?1:-1:1;return HS(e,t,r)||GS(e,t)}else if(n==38||px&&n==80&&r==`c`)return $S(e,-1,r)||GS(e,-1);else if(n==40||px&&n==78&&r==`c`)return nC(e)||$S(e,1,r)||GS(e,1);else if(r==(px?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function aC(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Wt.fromSchema(e.state.schema),s=hC(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=mC[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
147
147
|
|
|
148
|
-
`),slice:t}}function
|
|
149
|
-
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Wt.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=_C(n),hx&&vC(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||At.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!oC.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=yC(fC(s,+u[1],+u[2]),u[4]);else if(s=F.maxOpen(sC(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=fC(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var oC=/^(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 sC(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&lC(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=uC(a[a.length-1],i.length));let n=cC(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return N.from(a)}return e}function cC(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,N.from(e));return e}function lC(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=lC(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(N.from(cC(n,e,i+1))))}}function uC(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,uC(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(N.empty,!0);return e.copy(n.append(r))}function dC(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=dC(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(N.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function fC(e,t,n){return t<e.openStart&&(e=new F(dC(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new F(dC(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var pC={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function mC(){return document.implementation.createHTMLDocument(`title`)}var hC=null;function gC(e){let t=window.trustedTypes;if(!t)return e;if(!hC){if(hC=t.defaultPolicy)try{return hC.createHTML(e)}catch{}hC=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return hC.createHTML(e)}function _C(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=mC(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&pC[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=gC(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function vC(e){let t=e.querySelectorAll(cx?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function yC(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch{break}i=N.from(t.create(r[e+1],i)),a++,o++}return new F(i,a,o)}var bC={},xC={},SC={touchstart:!0,touchmove:!0},CC=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function wC(e){for(let t in bC){let n=bC[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{kC(e,t)&&!OC(e,t)&&(e.editable||!(t.type in xC))&&n(e,t)},SC[t]?{passive:!0}:void 0)}ux&&e.dom.addEventListener(`input`,()=>null),DC(e)}function TC(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function EC(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function DC(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>OC(e,t))})}function OC(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function kC(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function AC(e,t){!OC(e,t)&&bC[t.type]&&(e.editable||!(t.type in xC))&&bC[t.type](e,t)}xC.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!qC(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(mx&&cx&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),dx&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Yb(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||rC(e,n)?n.preventDefault():TC(e,`key`)},xC.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},xC.keypress=(e,t)=>{let n=t;if(qC(e)||!n.charCode||n.ctrlKey&&!n.altKey||fx&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function jC(e){return{left:e.clientX,top:e.clientY}}function MC(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function NC(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function PC(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function FC(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&R.isSelectable(r)?(PC(e,new R(n),`pointer`),!0):!1}function IC(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof R&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(R.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(PC(e,R.create(e.state.doc,i),`pointer`),!0)}function LC(e,t,n,r,i){return NC(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?IC(e,n):FC(e,n))}function RC(e,t,n,r){return NC(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function zC(e,t,n,r){return NC(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||BC(e,n,r)}function BC(e,t,n){if(n.button!=0)return!1;let r=VC(e,t,!0),i=e.state.doc;return r?(PC(e,r,`pointer`),r instanceof L&&i.eq(e.state.doc)&&(e.input.mouseDown=new KC(e,r)),!0):!1}function VC(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?L.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return L.create(r,a+1,a+1+t.content.size);if(n&&R.isSelectable(t))return R.create(r,a)}return null}function HC(e){return $C(e)}var UC=fx?`metaKey`:`ctrlKey`;bC.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=HC(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&MC(n,e.input.lastClick)&&!n[UC]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(jC(n));o&&(a==`singleClick`?e.input.mouseDown=new GC(e,o,n,!!r):(a==`doubleClick`?RC:zC)(e,o.pos,o.inside,n)?n.preventDefault():TC(e,`pointer`))};var WC=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},GC=class extends WC{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[UC],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof R&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ox&&!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()),TC(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||ES(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(jC(e))),this.updateAllowDefault(e),this.allowDefault||!t?TC(this.view,`pointer`):LC(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ux&&this.mightDrag&&!this.mightDrag.node.isAtom||cx&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(PC(this.view,I.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):TC(this.view,`pointer`)}move(e){this.updateAllowDefault(e),TC(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},KC=class extends WC{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),TC(this.view,`pointer`);let t=this.view.posAtCoords(jC(e)),n=t&&VC(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];PC(this.view,L.create(r,a,o),`pointer`)}};bC.touchstart=e=>{e.input.lastTouch=Date.now(),HC(e),TC(e,`pointer`)},bC.touchmove=e=>{e.input.lastTouch=Date.now(),TC(e,`pointer`)},bC.contextmenu=e=>HC(e);function qC(e,t){return e.composing?!0:ux&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var JC=mx?5e3:-1;xC.compositionstart=xC.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof L&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||cx&&px&&YC(e)))e.markCursor=e.state.storedMarks||n.marks(),$C(e,!0),e.markCursor=null;else if($C(e,!t.selection.empty),ox&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}XC(e,JC)};function YC(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}xC.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,XC(e,20))};function XC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>$C(e),t))}function ZC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function QC(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Wb(t.focusNode,t.focusOffset),r=Gb(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function $C(e,t=!1){if(!(mx&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ZC(e),t||e.docView&&e.docView.dirty){let n=wS(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function ew(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var tw=ix&&ax<15||dx&&gx<604;bC.copy=xC.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=tw?null:n.clipboardData,{dom:o,text:s}=iC(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):ew(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function nw(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function rw(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?iw(e,r.value,null,i,t):iw(e,r.textContent,r.innerHTML,i,t)},50)}function iw(e,t,n,r,i){let a=aC(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||F.empty)))return!0;if(!a)return!1;let o=nw(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function aw(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}xC.paste=(e,t)=>{let n=t;if(e.composing&&!mx)return;let r=tw?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&iw(e,aw(r),r.getData(`text/html`),i,n)?n.preventDefault():rw(e,n)};var ow=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},sw=fx?`altKey`:`ctrlKey`;function cw(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[sw]:!n}bC.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(jC(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof R?i.to-1:i.to))){if(r&&r.mightDrag)o=R.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=R.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=iC(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!cx||lx>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(tw?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,tw||n.dataTransfer.setData(`text/plain`,c),e.dragging=new ow(l,cw(e,n),o)},bC.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},xC.dragover=xC.dragenter=(e,t)=>t.preventDefault(),xC.drop=(e,t)=>{try{lw(e,t,e.dragging)}finally{e.dragging=null}};function lw(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(jC(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=aC(e,aw(t.dataTransfer),tw?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&cw(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||F.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?ii(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&R.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new R(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(FS(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}bC.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ES(e)},20))},bC.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},bC.beforeinput=(e,t)=>{if(mx&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Yb(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in xC)bC[e]=xC[e];function uw(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var dw=class e{constructor(e,t){this.toDOM=e,this.spec=t||gw,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new mw(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&uw(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},fw=class e{constructor(e,t){this.attrs=e,this.spec=t||gw}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new mw(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&uw(this.attrs,t.attrs)&&uw(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},pw=class e{constructor(e,t){this.attrs=e,this.spec=t||gw}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new mw(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&uw(this.attrs,t.attrs)&&uw(this.spec,t.spec)}destroy(){}},mw=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new dw(n,r))}static inline(t,n,r,i){return new e(t,n,new fw(r,i))}static node(t,n,r,i){return new e(t,n,new pw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof fw}get widget(){return this.type instanceof dw}},hw=[],gw={},_w=class e{constructor(e,t){this.local=e.length?e:hw,this.children=t.length?t:hw}static create(e,t){return t.length?Tw(t,e,0,gw):vw}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==vw||e.maps.length==0?this:this.mapInner(e,t,0,0,n||gw)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?bw(this.children,o||[],t,n,r,i,a):o?new e(o.sort(Ew),hw):vw}add(t,n){return n.length?this==vw?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=Cw(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Tw(s,e,o+1,gw)),a+=3}});let o=xw(a?ww(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(Ew):this.local,i||this.children)}remove(e){return e.length==0||this==vw?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==vw?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):vw}forChild(t,n){if(this==vw)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof fw){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(Ew),hw);return r?new yw([t,r]):t}return r||vw}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return Dw(this.localsInner(e))}localsInner(e){if(this==vw)return hw;if(e.inlineContent||!this.local.some(fw.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof fw||t.push(this.local[e]);return t}forEachSet(e){e(this)}};_w.empty=new _w([],[]),_w.removeOverlap=Dw;var vw=_w.empty,yw=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,gw));return e.from(r)}forChild(t,n){if(n.isLeaf)return _w.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=vw&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?Dw(n?t:t.sort(Ew)):hw}static from(t){switch(t.length){case 0:return vw;case 1:return t[0];default:return new e(t.every(e=>e instanceof _w)?t:t.reduce((e,t)=>e.concat(t instanceof _w?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function bw(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==vw?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Tw(Sw(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new _w(t.sort(Ew),s)}function xw(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new mw(i.from+t,i.to+t,i.type))}return n}function Sw(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Cw(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function ww(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Tw(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Cw(e,t,o+n);if(s){a=!0;let e=Tw(s,t,n+o+1,r);e!=vw&&i.push(o,o+t.nodeSize,e)}});let o=xw(a?ww(e):e,-n).sort(Ew);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new _w(o,i):vw}function Ew(e,t){return e.from-t.from||e.to-t.to}function Dw(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),Ow(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),Ow(t,i,r.copy(a.from,r.to)));break}}}return t}function Ow(e,t,n){for(;t<e.length&&Ew(n,e[t])>0;)t++;e.splice(t,0,n)}function kw(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=vw&&t.push(r)}),e.cursorWrapper&&t.push(_w.create(e.state.doc,[e.cursorWrapper.deco])),yw.from(t)}var Aw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jw=ix&&ax<=11,Mw=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Nw=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Mw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);ix&&ax<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ux&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),jw&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Aw)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(IS(this.view)){if(this.suppressingSelectionUpdates)return ES(this.view);if(ix&&ax<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Bb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Ib(n))t.add(n);for(let r=e.anchorNode;r;r=Ib(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&IS(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||cx&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(ox&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||zw(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jb(n)&&(c=wS(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ES(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Iw(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Bw(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ES(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ix&&ax<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Fb(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Fb(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},Pw=new WeakMap,Fw=!1;function Iw(e){if(!Pw.has(e)&&(Pw.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=ox,Fw)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.`),Fw=!0}}function Lw(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Bb(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Rw(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Lw(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Lw(e,n):null}function zw(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Bw(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Vw(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&e.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:l.anchorOffset}],Jb(l)||u.push({node:l.focusNode,offset:l.focusOffset})),cx&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||At.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace==`pre`?`full`:!0,findPositions:u,ruleFromNode:Hw(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var Hw=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(ux&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(t.parentNode.lastChild==t||ux&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Uw=/^(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 Ww(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=wS(e,t);if(n&&!e.state.selection.eq(n)){if(cx&&mx&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Yb(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Vw(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Yw(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(dx&&e.input.lastIOSEnter>Date.now()-225||mx)&&i.some(e=>e.nodeType==1&&!Uw.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Yb(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof L&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Gw(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof L&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ix&&ax<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((dx&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Yb(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&qw(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Yb(8,`Backspace`)))){mx&&cx&&e.domObserver.suppressSelectionUpdates();return}cx&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),mx&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Yb(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Gw(e,n.doc,l.sel);t&&!(cx&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||ix&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){ix&&ax<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ES(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Kw(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Gw(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:FS(e,t.resolve(n.anchor),t.resolve(n.head))}function Kw(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(N.from(l).eq(e))return{mark:s,type:o}}function qw(e,t,n,r,i){if(n-t<=i.pos-r.pos||Jw(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Jw(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Jw(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Jw(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Yw(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Xw=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new CC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rT),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=$w(this),Qw(this),this.nodeViews=tT(this),this.docView=iS(this.state.doc,Zw(this),kw(this),this.dom,this),this.domObserver=new Nw(this,(e,t,n,r)=>Ww(this,e,t,n,r)),this.domObserver.start(),wC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&DC(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rT),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(ZC(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=tT(this);nT(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&DC(this),this.editable=$w(this),Qw(this);let o=kw(this),s=Zw(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&xx(this);if(i){this.domObserver.stop();let t=l&&(ix||cx)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&eT(n.selection,e.selection);if(l){let n=cx?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=QC(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=iS(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&RS(this)&&i.delaySelUpdate())?ES(this,t):(NS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Cx(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof R){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&bx(this,t.getBoundingClientRect(),e)}else bx(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new ow(e.slice,e.move,r<0?void 0:R.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(ix){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&&Ex(this.dom),ES(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Px(this,e)}coordsAtPos(e,t=1){return Rx(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Jx(this,t||this.state,e)}pasteHTML(e,t){return iw(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return iw(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return iC(this,e)}destroy(){this.docView&&(EC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kw(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,zb())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return AC(this,e)}domSelectionRange(){let e=this.domSelection();return e?ux&&this.root.nodeType===11&&Xb(this.dom.ownerDocument)==this.dom&&Rw(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Xw.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Zw(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[mw.node(0,e.state.doc.content.size,t)]}function Qw(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:mw.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function $w(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function eT(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function tT(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function nT(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function rT(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var iT=class e extends I{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):I.near(r)}content(){return F.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new aT(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!sT(e)||!cT(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!R.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};iT.prototype.visible=!1,iT.findFrom=iT.findGapCursorFrom,I.jsonID(`gapcursor`,iT);var aT=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return iT.valid(t)?new iT(t):I.near(t)}};function oT(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function sT(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||oT(e.type))return!0;if(e.inlineContent)return!1}}return!0}function cT(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||oT(e.type))return!0;if(e.inlineContent)return!1}}return!0}function lT(){return new z({props:{decorations:mT,createSelectionBetween(e,t,n){return t.pos==n.pos&&iT.valid(n)?new iT(n):null},handleClick:fT,handleKeyDown:uT,handleDOMEvents:{beforeinput:pT}}})}var uT=mu({ArrowLeft:dT(`horiz`,-1),ArrowRight:dT(`horiz`,1),ArrowUp:dT(`vert`,-1),ArrowDown:dT(`vert`,1)});function dT(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof L){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=iT.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new iT(c))),!0):!1}}function fT(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!iT.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&R.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new iT(r))),!0)}function pT(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof iT))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=N.empty;for(let e=r.length-1;e>=0;e--)i=N.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new F(i,0,0));return a.setSelection(L.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function mT(e){if(!(e.selection instanceof iT))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,_w.create(e.doc,[mw.widget(e.selection.head,t,{key:`gapcursor`})])}var hT=200,gT=function(){};gT.prototype.append=function(e){return e.length?(e=gT.from(e),!this.length&&e||e.length<hT&&this.leafAppend(e)||this.length<hT&&e.leafPrepend(this)||this.appendInner(e)):this},gT.prototype.prepend=function(e){return e.length?gT.from(e).append(this):this},gT.prototype.appendInner=function(e){return new vT(this,e)},gT.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?gT.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},gT.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},gT.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},gT.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},gT.from=function(e){return e instanceof gT?e:e&&e.length?new _T(e):gT.empty};var _T=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=hT)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=hT)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(gT);gT.empty=new _T([]);var vT=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(gT),yT=500,bT=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new ST(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new ST(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new ST(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>wT&&(s=xT(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Cr;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new ST(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new ST(i,o,l))}else r.push(new ST(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new ST(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>yT&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new ST(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(gT.from(i.reverse()),a)}};bT.empty=new bT(gT.empty,0);function xT(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var ST=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},CT=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},wT=20;function TT(e,t,n,r){let i=n.getMeta(NT),a;if(i)return i.historyState;n.getMeta(PT)&&(e=new CT(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(NT))return o.getMeta(NT).redo?new CT(e.done.addTransform(n,void 0,r,MT(t)),e.undone,DT(n.mapping.maps),e.prevTime,e.prevComposition):new CT(e.done,e.undone.addTransform(n,void 0,r,MT(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!ET(n,e.prevRanges)),s=o?OT(e.prevRanges,n.mapping):DT(n.mapping.maps);return new CT(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,MT(t)),bT.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new CT(e.done.rebased(n,a),e.undone.rebased(n,a),OT(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new CT(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),OT(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function ET(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function DT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function OT(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function kT(e,t,n){let r=MT(t),i=NT.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new CT(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(NT,{redo:n,historyState:c})}var AT=!1,jT=null;function MT(e){let t=e.plugins;if(jT!=t){AT=!1,jT=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){AT=!0;break}}return AT}var NT=new B(`history`),PT=new B(`closeHistory`);function FT(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new z({key:NT,state:{init(){return new CT(bT.empty,bT.empty,null,0,-1)},apply(t,n,r){return TT(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?LT:n==`historyRedo`?RT:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function IT(e,t){return(n,r)=>{let i=NT.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=kT(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var LT=IT(!1,!0),RT=IT(!0,!0);G.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new z({key:new B(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var zT=G.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Nb(this.options)]}});G.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new z({key:new B(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return bl.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(_l.node(t,t+e.nodeSize,{class:this.options.className}))}),bl.create(e,a)}}})]}});var BT=G.create({name:`gapCursor`,addProseMirrorPlugins(){return[lT()]},extendNodeSchema(e){return{allowGapCursor:U(H(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),VT=`placeholder`,HT=new B(`tiptap__placeholder`),UT=200;function WT(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),_l.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function GT(e,t){return typeof e==`function`?e(t):e}function KT({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&xf(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(WT({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:GT(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else{let i=HT.getState(e.state),c=i?.topPos??0,l=i?.bottomPos??r.content.size;r.nodesBetween(c,l,(r,i)=>{let c=a>=i&&a<=i+r.nodeSize,l=!r.isLeaf&&xf(r);return r.type.isTextblock&&(c||!t.showOnlyCurrent)&&l&&o.push(WT({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:c,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:GT(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:c})},node:r,pos:i})),t.includeChildren})}return bl.create(r,o)}function qT(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function JT(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function YT(e){let t=e;for(;t;){if(JT(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function XT(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function ZT({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?XT(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-UT,o=Math.min(r.bottom,i.bottom)+UT;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var QT={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(HT);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function $T(e){let t=YT(e.dom),n=()=>{let n=ZT({view:e,doc:e.state.doc,scrollContainer:t}),r=HT.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(HT,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function eE({editor:e,options:t}){let n=t.dataAttribute?`data-${qT(t.dataAttribute)}`:`data-${VT}`;return new z({key:HT,state:QT,view:$T,props:{decorations:({doc:r,selection:i})=>KT({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}var tE=G.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:VT,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[eE({editor:this.editor,options:this.options})]}}),nE=`.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
148
|
+
`),slice:t}}function oC(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new F(N.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
149
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Wt.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=vC(n),gx&&yC(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||At.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!sC.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=bC(pC(s,+u[1],+u[2]),u[4]);else if(s=F.maxOpen(cC(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=pC(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var sC=/^(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 cC(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&uC(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=dC(a[a.length-1],i.length));let n=lC(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return N.from(a)}return e}function lC(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,N.from(e));return e}function uC(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=uC(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(N.from(lC(n,e,i+1))))}}function dC(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,dC(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(N.empty,!0);return e.copy(n.append(r))}function fC(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=fC(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(N.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function pC(e,t,n){return t<e.openStart&&(e=new F(fC(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new F(fC(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var mC={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function hC(){return document.implementation.createHTMLDocument(`title`)}var gC=null;function _C(e){let t=window.trustedTypes;if(!t)return e;if(!gC){if(gC=t.defaultPolicy)try{return gC.createHTML(e)}catch{}gC=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return gC.createHTML(e)}function vC(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=hC(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&mC[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=_C(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function yC(e){let t=e.querySelectorAll(lx?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function bC(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch{break}i=N.from(t.create(r[e+1],i)),a++,o++}return new F(i,a,o)}var xC={},SC={},CC={touchstart:!0,touchmove:!0},wC=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function TC(e){for(let t in xC){let n=xC[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{AC(e,t)&&!kC(e,t)&&(e.editable||!(t.type in SC))&&n(e,t)},CC[t]?{passive:!0}:void 0)}dx&&e.dom.addEventListener(`input`,()=>null),OC(e)}function EC(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function DC(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function OC(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>kC(e,t))})}function kC(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function AC(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function jC(e,t){!kC(e,t)&&xC[t.type]&&(e.editable||!(t.type in SC))&&xC[t.type](e,t)}SC.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!JC(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(hx&&lx&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),fx&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Xb(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||iC(e,n)?n.preventDefault():EC(e,`key`)},SC.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},SC.keypress=(e,t)=>{let n=t;if(JC(e)||!n.charCode||n.ctrlKey&&!n.altKey||px&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function MC(e){return{left:e.clientX,top:e.clientY}}function NC(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function PC(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function FC(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function IC(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&R.isSelectable(r)?(FC(e,new R(n),`pointer`),!0):!1}function LC(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof R&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(R.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(FC(e,R.create(e.state.doc,i),`pointer`),!0)}function RC(e,t,n,r,i){return PC(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?LC(e,n):IC(e,n))}function zC(e,t,n,r){return PC(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function BC(e,t,n,r){return PC(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||VC(e,n,r)}function VC(e,t,n){if(n.button!=0)return!1;let r=HC(e,t,!0),i=e.state.doc;return r?(FC(e,r,`pointer`),r instanceof L&&i.eq(e.state.doc)&&(e.input.mouseDown=new qC(e,r)),!0):!1}function HC(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?L.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return L.create(r,a+1,a+1+t.content.size);if(n&&R.isSelectable(t))return R.create(r,a)}return null}function UC(e){return ew(e)}var WC=px?`metaKey`:`ctrlKey`;xC.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=UC(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&NC(n,e.input.lastClick)&&!n[WC]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(MC(n));o&&(a==`singleClick`?e.input.mouseDown=new KC(e,o,n,!!r):(a==`doubleClick`?zC:BC)(e,o.pos,o.inside,n)?n.preventDefault():EC(e,`pointer`))};var GC=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},KC=class extends GC{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[WC],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof R&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&sx&&!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()),EC(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||DS(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(MC(e))),this.updateAllowDefault(e),this.allowDefault||!t?EC(this.view,`pointer`):RC(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||dx&&this.mightDrag&&!this.mightDrag.node.isAtom||lx&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(FC(this.view,I.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):EC(this.view,`pointer`)}move(e){this.updateAllowDefault(e),EC(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},qC=class extends GC{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),EC(this.view,`pointer`);let t=this.view.posAtCoords(MC(e)),n=t&&HC(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];FC(this.view,L.create(r,a,o),`pointer`)}};xC.touchstart=e=>{e.input.lastTouch=Date.now(),UC(e),EC(e,`pointer`)},xC.touchmove=e=>{e.input.lastTouch=Date.now(),EC(e,`pointer`)},xC.contextmenu=e=>UC(e);function JC(e,t){return e.composing?!0:dx&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var YC=hx?5e3:-1;SC.compositionstart=SC.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof L&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||lx&&mx&&XC(e)))e.markCursor=e.state.storedMarks||n.marks(),ew(e,!0),e.markCursor=null;else if(ew(e,!t.selection.empty),sx&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}ZC(e,YC)};function XC(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}SC.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ZC(e,20))};function ZC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>ew(e),t))}function QC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function $C(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Gb(t.focusNode,t.focusOffset),r=Kb(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function ew(e,t=!1){if(!(hx&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),QC(e),t||e.docView&&e.docView.dirty){let n=TS(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function tw(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var nw=ax&&ox<15||fx&&_x<604;xC.copy=SC.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=nw?null:n.clipboardData,{dom:o,text:s}=aC(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):tw(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function rw(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function iw(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?aw(e,r.value,null,i,t):aw(e,r.textContent,r.innerHTML,i,t)},50)}function aw(e,t,n,r,i){let a=oC(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||F.empty)))return!0;if(!a)return!1;let o=rw(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function ow(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}SC.paste=(e,t)=>{let n=t;if(e.composing&&!hx)return;let r=nw?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&aw(e,ow(r),r.getData(`text/html`),i,n)?n.preventDefault():iw(e,n)};var sw=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},cw=px?`altKey`:`ctrlKey`;function lw(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[cw]:!n}xC.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(MC(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof R?i.to-1:i.to))){if(r&&r.mightDrag)o=R.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=R.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=aC(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!lx||ux>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(nw?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,nw||n.dataTransfer.setData(`text/plain`,c),e.dragging=new sw(l,lw(e,n),o)},xC.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},SC.dragover=SC.dragenter=(e,t)=>t.preventDefault(),SC.drop=(e,t)=>{try{uw(e,t,e.dragging)}finally{e.dragging=null}};function uw(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(MC(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=oC(e,ow(t.dataTransfer),nw?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&lw(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||F.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?ii(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&R.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new R(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(IS(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}xC.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&DS(e)},20))},xC.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},xC.beforeinput=(e,t)=>{if(hx&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Xb(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in SC)xC[e]=SC[e];function dw(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var fw=class e{constructor(e,t){this.toDOM=e,this.spec=t||_w,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new hw(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&dw(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},pw=class e{constructor(e,t){this.attrs=e,this.spec=t||_w}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new hw(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&dw(this.attrs,t.attrs)&&dw(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},mw=class e{constructor(e,t){this.attrs=e,this.spec=t||_w}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new hw(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&dw(this.attrs,t.attrs)&&dw(this.spec,t.spec)}destroy(){}},hw=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new fw(n,r))}static inline(t,n,r,i){return new e(t,n,new pw(r,i))}static node(t,n,r,i){return new e(t,n,new mw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof pw}get widget(){return this.type instanceof fw}},gw=[],_w={},vw=class e{constructor(e,t){this.local=e.length?e:gw,this.children=t.length?t:gw}static create(e,t){return t.length?Ew(t,e,0,_w):yw}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==yw||e.maps.length==0?this:this.mapInner(e,t,0,0,n||_w)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?xw(this.children,o||[],t,n,r,i,a):o?new e(o.sort(Dw),gw):yw}add(t,n){return n.length?this==yw?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=ww(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Ew(s,e,o+1,_w)),a+=3}});let o=Sw(a?Tw(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(Dw):this.local,i||this.children)}remove(e){return e.length==0||this==yw?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==yw?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):yw}forChild(t,n){if(this==yw)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof pw){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(Dw),gw);return r?new bw([t,r]):t}return r||yw}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return Ow(this.localsInner(e))}localsInner(e){if(this==yw)return gw;if(e.inlineContent||!this.local.some(pw.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof pw||t.push(this.local[e]);return t}forEachSet(e){e(this)}};vw.empty=new vw([],[]),vw.removeOverlap=Ow;var yw=vw.empty,bw=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,_w));return e.from(r)}forChild(t,n){if(n.isLeaf)return vw.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=yw&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?Ow(n?t:t.sort(Dw)):gw}static from(t){switch(t.length){case 0:return yw;case 1:return t[0];default:return new e(t.every(e=>e instanceof vw)?t:t.reduce((e,t)=>e.concat(t instanceof vw?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function xw(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==yw?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Ew(Cw(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new vw(t.sort(Dw),s)}function Sw(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new hw(i.from+t,i.to+t,i.type))}return n}function Cw(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function ww(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function Tw(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Ew(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=ww(e,t,o+n);if(s){a=!0;let e=Ew(s,t,n+o+1,r);e!=yw&&i.push(o,o+t.nodeSize,e)}});let o=Sw(a?Tw(e):e,-n).sort(Dw);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new vw(o,i):yw}function Dw(e,t){return e.from-t.from||e.to-t.to}function Ow(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),kw(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),kw(t,i,r.copy(a.from,r.to)));break}}}return t}function kw(e,t,n){for(;t<e.length&&Dw(n,e[t])>0;)t++;e.splice(t,0,n)}function Aw(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=yw&&t.push(r)}),e.cursorWrapper&&t.push(vw.create(e.state.doc,[e.cursorWrapper.deco])),bw.from(t)}var jw={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Mw=ax&&ox<=11,Nw=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Pw=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Nw,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);ax&&ox<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():dx&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Mw&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,jw)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(LS(this.view)){if(this.suppressingSelectionUpdates)return DS(this.view);if(ax&&ox<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Vb(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Lb(n))t.add(n);for(let r=e.anchorNode;r;r=Lb(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&LS(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||lx&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(sx&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Bw(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Yb(n)&&(c=TS(e))&&c.eq(I.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,DS(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Lw(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Vw(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||DS(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ax&&ox<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Ib(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Ib(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},Fw=new WeakMap,Iw=!1;function Lw(e){if(!Fw.has(e)&&(Fw.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=sx,Iw)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.`),Iw=!0}}function Rw(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Vb(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function zw(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Rw(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Rw(e,n):null}function Bw(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Vw(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Hw(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&e.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:l.anchorOffset}],Yb(l)||u.push({node:l.focusNode,offset:l.focusOffset})),lx&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||At.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace==`pre`?`full`:!0,findPositions:u,ruleFromNode:Uw(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var Uw=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(dx&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(t.parentNode.lastChild==t||dx&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Ww=/^(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 Gw(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=TS(e,t);if(n&&!e.state.selection.eq(n)){if(lx&&hx&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Xb(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Hw(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Xw(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(fx&&e.input.lastIOSEnter>Date.now()-225||hx)&&i.some(e=>e.nodeType==1&&!Ww.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Xb(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof L&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Kw(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof L&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ax&&ox<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((fx&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Xb(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Jw(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Xb(8,`Backspace`)))){hx&&lx&&e.domObserver.suppressSelectionUpdates();return}lx&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),hx&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Xb(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Kw(e,n.doc,l.sel);t&&!(lx&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||ax&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){ax&&ox<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>DS(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=qw(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Kw(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:IS(e,t.resolve(n.anchor),t.resolve(n.head))}function qw(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(N.from(l).eq(e))return{mark:s,type:o}}function Jw(e,t,n,r,i){if(n-t<=i.pos-r.pos||Yw(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Yw(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Yw(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Yw(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Xw(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Zw=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new wC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(iT),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=eT(this),$w(this),this.nodeViews=nT(this),this.docView=aS(this.state.doc,Qw(this),Aw(this),this.dom,this),this.domObserver=new Pw(this,(e,t,n,r)=>Gw(this,e,t,n,r)),this.domObserver.start(),TC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&OC(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(iT),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(QC(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=nT(this);rT(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&OC(this),this.editable=eT(this),$w(this);let o=Aw(this),s=Qw(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Sx(this);if(i){this.domObserver.stop();let t=l&&(ax||lx)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&tT(n.selection,e.selection);if(l){let n=lx?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=$C(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=aS(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&zS(this)&&i.delaySelUpdate())?DS(this,t):(PS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&wx(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof R){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&xx(this,t.getBoundingClientRect(),e)}else xx(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new sw(e.slice,e.move,r<0?void 0:R.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(ax){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&&Dx(this.dom),DS(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Fx(this,e)}coordsAtPos(e,t=1){return zx(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Yx(this,t||this.state,e)}pasteHTML(e,t){return aw(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return aw(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return aC(this,e)}destroy(){this.docView&&(DC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Aw(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Bb())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jC(this,e)}domSelectionRange(){let e=this.domSelection();return e?dx&&this.root.nodeType===11&&Zb(this.dom.ownerDocument)==this.dom&&zw(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Zw.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Qw(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[hw.node(0,e.state.doc.content.size,t)]}function $w(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:hw.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function eT(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function tT(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function nT(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function rT(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function iT(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var aT=class e extends I{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):I.near(r)}content(){return F.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new oT(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!cT(e)||!lT(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!R.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};aT.prototype.visible=!1,aT.findFrom=aT.findGapCursorFrom,I.jsonID(`gapcursor`,aT);var oT=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return aT.valid(t)?new aT(t):I.near(t)}};function sT(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function cT(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||sT(e.type))return!0;if(e.inlineContent)return!1}}return!0}function lT(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||sT(e.type))return!0;if(e.inlineContent)return!1}}return!0}function uT(){return new z({props:{decorations:hT,createSelectionBetween(e,t,n){return t.pos==n.pos&&aT.valid(n)?new aT(n):null},handleClick:pT,handleKeyDown:dT,handleDOMEvents:{beforeinput:mT}}})}var dT=mu({ArrowLeft:fT(`horiz`,-1),ArrowRight:fT(`horiz`,1),ArrowUp:fT(`vert`,-1),ArrowDown:fT(`vert`,1)});function fT(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof L){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=aT.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new aT(c))),!0):!1}}function pT(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!aT.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&R.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new aT(r))),!0)}function mT(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof aT))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=N.empty;for(let e=r.length-1;e>=0;e--)i=N.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new F(i,0,0));return a.setSelection(L.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function hT(e){if(!(e.selection instanceof aT))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,vw.create(e.doc,[hw.widget(e.selection.head,t,{key:`gapcursor`})])}var gT=200,Q=function(){};Q.prototype.append=function(e){return e.length?(e=Q.from(e),!this.length&&e||e.length<gT&&this.leafAppend(e)||this.length<gT&&e.leafPrepend(this)||this.appendInner(e)):this},Q.prototype.prepend=function(e){return e.length?Q.from(e).append(this):this},Q.prototype.appendInner=function(e){return new vT(this,e)},Q.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Q.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Q.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Q.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Q.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Q.from=function(e){return e instanceof Q?e:e&&e.length?new _T(e):Q.empty};var _T=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=gT)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=gT)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Q);Q.empty=new _T([]);var vT=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Q),yT=500,bT=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new ST(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new ST(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new ST(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>wT&&(s=xT(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Cr;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new ST(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new ST(i,o,l))}else r.push(new ST(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new ST(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>yT&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new ST(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(Q.from(i.reverse()),a)}};bT.empty=new bT(Q.empty,0);function xT(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var ST=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},CT=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},wT=20;function TT(e,t,n,r){let i=n.getMeta(NT),a;if(i)return i.historyState;n.getMeta(PT)&&(e=new CT(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(NT))return o.getMeta(NT).redo?new CT(e.done.addTransform(n,void 0,r,MT(t)),e.undone,DT(n.mapping.maps),e.prevTime,e.prevComposition):new CT(e.done,e.undone.addTransform(n,void 0,r,MT(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!ET(n,e.prevRanges)),s=o?OT(e.prevRanges,n.mapping):DT(n.mapping.maps);return new CT(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,MT(t)),bT.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new CT(e.done.rebased(n,a),e.undone.rebased(n,a),OT(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new CT(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),OT(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function ET(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function DT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function OT(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function kT(e,t,n){let r=MT(t),i=NT.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new CT(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(NT,{redo:n,historyState:c})}var AT=!1,jT=null;function MT(e){let t=e.plugins;if(jT!=t){AT=!1,jT=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){AT=!0;break}}return AT}var NT=new B(`history`),PT=new B(`closeHistory`);function FT(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new z({key:NT,state:{init(){return new CT(bT.empty,bT.empty,null,0,-1)},apply(t,n,r){return TT(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?LT:n==`historyRedo`?RT:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function IT(e,t){return(n,r)=>{let i=NT.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=kT(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var LT=IT(!1,!0),RT=IT(!0,!0);G.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new z({key:new B(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var zT=G.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Pb(this.options)]}});G.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new z({key:new B(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return bl.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(_l.node(t,t+e.nodeSize,{class:this.options.className}))}),bl.create(e,a)}}})]}});var BT=G.create({name:`gapCursor`,addProseMirrorPlugins(){return[uT()]},extendNodeSchema(e){return{allowGapCursor:U(H(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),VT=`placeholder`,HT=new B(`tiptap__placeholder`),UT=200;function WT(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),_l.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function GT(e,t){return typeof e==`function`?e(t):e}function KT({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&xf(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(WT({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:GT(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else{let i=HT.getState(e.state),c=i?.topPos??0,l=i?.bottomPos??r.content.size;r.nodesBetween(c,l,(r,i)=>{let c=a>=i&&a<=i+r.nodeSize,l=!r.isLeaf&&xf(r);return r.type.isTextblock&&(c||!t.showOnlyCurrent)&&l&&o.push(WT({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:c,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:GT(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:c})},node:r,pos:i})),t.includeChildren})}return bl.create(r,o)}function qT(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function JT(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function YT(e){let t=e;for(;t;){if(JT(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function XT(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function ZT({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?XT(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-UT,o=Math.min(r.bottom,i.bottom)+UT;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var QT={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(HT);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function $T(e){let t=YT(e.dom),n=()=>{let n=ZT({view:e,doc:e.state.doc,scrollContainer:t}),r=HT.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(HT,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function eE({editor:e,options:t}){let n=t.dataAttribute?`data-${qT(t.dataAttribute)}`:`data-${VT}`;return new z({key:HT,state:QT,view:$T,props:{decorations:({doc:r,selection:i})=>KT({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}var tE=G.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:VT,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[eE({editor:this.editor,options:this.options})]}}),nE=`.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
150
150
|
background: transparent;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
154
154
|
background: transparent;
|
|
155
|
-
}`;G.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&jp(nE,e.options.injectNonce,`selection`),[new z({key:new B(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Sf(n.selection)||e.view.dragging?null:bl.create(n.doc,[_l.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function rE({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var iE=G.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new B(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new z({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!rE({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!rE({node:r,types:n})}}})]}}),aE=G.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>LT(e,t),redo:()=>({state:e,dispatch:t})=>RT(e,t)}},addProseMirrorPlugins(){return[FT(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()}}}),oE=G.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(
|
|
155
|
+
}`;G.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&jp(nE,e.options.injectNonce,`selection`),[new z({key:new B(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Sf(n.selection)||e.view.dragging?null:bl.create(n.doc,[_l.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function rE({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var iE=G.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new B(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new z({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!rE({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!rE({node:r,types:n})}}})]}}),aE=G.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>LT(e,t),redo:()=>({state:e,dispatch:t})=>RT(e,t)}},addProseMirrorPlugins(){return[FT(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()}}}),oE=G.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(d_.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(o_.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(qy.configure(this.options.bulletList)),this.options.code!==!1&&e.push(m_.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(v_.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(b_.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(zT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(BT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(x_.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(S_.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(aE.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(C_.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(O_.configure(this.options.italic)),this.options.listItem!==!1&&e.push(eb.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(db.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(By.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Sb.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Ob.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(jb.configure(this.options.strike)),this.options.text!==!1&&e.push(Mb.configure(this.options.text)),this.options.underline!==!1&&e.push(Nb.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(iE.configure(this.options?.trailingNode)),e}}),sE=Tb,cE=wb,lE=tE,uE={};function dE(e){let t=uE[e];if(t)return t;t=uE[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function fE(e,t){typeof t!=`string`&&(t=fE.defaultChars);let n=dE(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}fE.defaultChars=`;/?:@&=+$,#`,fE.componentChars=``;var pE={};function mE(e){let t=pE[e];if(t)return t;t=pE[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function hE(e,t,n){typeof t!=`string`&&(n=t,t=hE.defaultChars),n===void 0&&(n=!0);let r=mE(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}hE.defaultChars=`;/?:@&=+$,-_.!~*'()#`,hE.componentChars=`-_.!~*'()`;function gE(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function _E(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var vE=/^([a-z0-9.+-]+:)/i,yE=/:[0-9]*$/,bE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,xE=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
156
156
|
`,` `],SE=[`/`,`?`,`#`],CE=255,wE=/^[+a-z0-9A-Z_-]{0,63}$/,TE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,EE={javascript:!0,"javascript:":!0},DE={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function OE(e,t){if(e&&e instanceof _E)return e;let n=new _E;return n.parse(e,t),n}_E.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=bE.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=vE.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&EE[o])&&(a=a.substr(2),this.slashes=!0)),!EE[o]&&(i||o&&!DE[o])){let e=-1;for(let t=0;t<SE.length;t++)r=a.indexOf(SE[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<xE.length;t++)r=a.indexOf(xE[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(wE)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(wE)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(TE);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>CE&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),DE[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},_E.prototype.parseHost=function(e){let t=yE.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var kE=t({decode:()=>fE,encode:()=>hE,format:()=>gE,parse:()=>OE}),AE=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,jE=/[\0-\x1F\x7F-\x9F]/,ME=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,NE=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,PE=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,FE=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,IE=t({Any:()=>AE,Cc:()=>jE,Cf:()=>ME,P:()=>NE,S:()=>PE,Z:()=>FE}),LE=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肻\xA0ଷ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(e=>e.charCodeAt(0))),RE=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),zE=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]]),BE=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function VE(e){return e>=55296&&e<=57343||e>1114111?65533:zE.get(e)??e}var HE;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(HE||={});var UE=32,WE;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(WE||={});function GE(e){return e>=HE.ZERO&&e<=HE.NINE}function KE(e){return e>=HE.UPPER_A&&e<=HE.UPPER_F||e>=HE.LOWER_A&&e<=HE.LOWER_F}function qE(e){return e>=HE.UPPER_A&&e<=HE.UPPER_Z||e>=HE.LOWER_A&&e<=HE.LOWER_Z||GE(e)}function JE(e){return e===HE.EQUALS||qE(e)}var YE;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(YE||={});var XE;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(XE||={});var ZE=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=YE.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=XE.Strict}startEntity(e){this.decodeMode=e,this.state=YE.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case YE.EntityStart:return e.charCodeAt(t)===HE.NUM?(this.state=YE.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=YE.NamedEntity,this.stateNamedEntity(e,t));case YE.NumericStart:return this.stateNumericStart(e,t);case YE.NumericDecimal:return this.stateNumericDecimal(e,t);case YE.NumericHex:return this.stateNumericHex(e,t);case YE.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|UE)===HE.LOWER_X?(this.state=YE.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=YE.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(GE(r)||KE(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(GE(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===HE.SEMI)this.consumed+=1;else if(this.decodeMode===XE.Strict)return 0;return this.emitCodePoint(VE(this.result),this.consumed),this.errors&&(e!==HE.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&WE.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=$E(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===XE.Attribute&&(i===0||JE(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&WE.VALUE_LENGTH)>>14,i!==0){if(a===HE.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==XE.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&WE.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~WE.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case YE.NamedEntity:return this.result!==0&&(this.decodeMode!==XE.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case YE.NumericDecimal:return this.emitNumericEntity(0,2);case YE.NumericHex:return this.emitNumericEntity(0,3);case YE.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case YE.EntityStart:return 0}}};function QE(e){let t=``,n=new ZE(e,e=>t+=BE(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function $E(e,t,n,r){let i=(t&WE.BRANCH_LENGTH)>>7,a=t&WE.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var eD=QE(LE);QE(RE);function tD(e,t=XE.Legacy){return eD(e,t)}function nD(e){return eD(e,XE.Strict)}var rD=t({arrayReplaceAt:()=>lD,asciiTrim:()=>jD,assign:()=>cD,escapeHtml:()=>SD,escapeRE:()=>wD,fromCodePoint:()=>dD,has:()=>sD,isMdAsciiPunct:()=>OD,isPunctChar:()=>ED,isPunctCharCode:()=>DD,isSpace:()=>$,isString:()=>aD,isValidEntityCode:()=>uD,isWhiteSpace:()=>TD,lib:()=>MD,normalizeReference:()=>kD,unescapeAll:()=>_D,unescapeMd:()=>gD});function iD(e){return Object.prototype.toString.call(e)}function aD(e){return iD(e)===`[object String]`}var oD=Object.prototype.hasOwnProperty;function sD(e,t){return oD.call(e,t)}function cD(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function lD(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function uD(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function dD(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var fD=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,pD=RegExp(fD.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),mD=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function hD(e,t){if(t.charCodeAt(0)===35&&mD.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return uD(n)?dD(n):e}let n=tD(e);return n===e?e:n}function gD(e){return e.indexOf(`\\`)<0?e:e.replace(fD,`$1`)}function _D(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(pD,function(e,t,n){return t||hD(e,n)})}var vD=/[&<>"]/,yD=/[&<>"]/g,bD={"&":`&`,"<":`<`,">":`>`,'"':`"`};function xD(e){return bD[e]}function SD(e){return vD.test(e)?e.replace(yD,xD):e}var CD=/[.?*+^$[\]\\(){}|-]/g;function wD(e){return e.replace(CD,`\\$&`)}function $(e){switch(e){case 9:case 32:return!0}return!1}function TD(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function ED(e){return NE.test(e)||PE.test(e)}function DD(e){return ED(dD(e))}function OD(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function kD(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function AD(e){return e===32||e===9||e===10||e===13}function jD(e){let t=0;for(;t<e.length&&AD(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&AD(e.charCodeAt(n));n--);return e.slice(t,n+1)}var MD={mdurl:kE,ucmicro:IE};function ND(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function PD(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=_D(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=_D(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function FD(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=_D(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=_D(e.slice(t,a)),o}var ID=t({parseLinkDestination:()=>PD,parseLinkLabel:()=>ND,parseLinkTitle:()=>FD}),LD={};LD.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+SD(a.content)+`</code>`},LD.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+SD(e[t].content)+`</code></pre>
|
|
157
157
|
`},LD.fence=function(e,t,n,r,i){let a=e[t],o=a.info?_D(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||SD(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
158
158
|
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},LD.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},LD.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
@@ -181,5 +181,5 @@ ${t.innerHTML}
|
|
|
181
181
|
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),rj=K.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?ZA.storage.markdown.serialize.call(this,e,t,n):`\\
|
|
182
182
|
`);return}},parse:{}}}}}),ij=K.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:kA.nodes.heading,parse:{}}}}}),aj=K.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:kA.nodes.horizontal_rule,parse:{}}}}}),oj=K.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:kA.nodes.image,parse:{}}}}}),sj=K.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:kA.nodes.list_item,parse:{}}}}}),cj=K.create({name:`orderedList`});function lj(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var uj=cj.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=lj(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),dj=K.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:kA.nodes.paragraph,parse:{}}}}});function fj(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var pj=K.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!hj(t)){ZA.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function mj(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function hj(e){let t=fj(e),n=t[0],r=t.slice(1);return!(fj(n).some(e=>e.type.name!==`tableHeader`||mj(e)||e.childCount>1)||r.some(e=>fj(e).some(e=>e.type.name===`tableHeader`||mj(e)||e.childCount>1)))}var gj=[ej,tj,nj,rj,ij,aj,ZA,oj,sj,uj,dj,pj,K.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),K.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:tj.storage.markdown.serialize,parse:{setup(e){e.use(NA.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),K.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(JA(t.text))},parse:{}}}}}),cp.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:kA.marks.strong,parse:{}}}}}),cp.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:kA.marks.code,parse:{}}}}}),GA,cp.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:kA.marks.em,parse:{}}}}}),cp.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:kA.marks.link,parse:{}}}}}),cp.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function _j(e){let t=e.storage?.markdown,n=gj.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var vj=class{constructor(e){IA(this,`editor`,null),this.editor=e}serialize(e){let t=new WA(this.nodes,this.marks,{hardBreakNodeName:rj.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(ZA)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(GA)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=_j(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=_j(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},yj=class{constructor(e,t){IA(this,`editor`,null),IA(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(_A({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=_j(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=qA(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=_j(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&YA(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}XA(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
|
|
183
183
|
`?t:t[t.length-1]===`
|
|
184
|
-
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},bj=G.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new z({key:new B(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return At.fromSchema(this.editor.schema).parseSlice(qA(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),xj=G.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=_p.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new yj(this.editor,this.options),serializer:new vj(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[LA.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),bj.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),Sj={heading:{levels:[1,2,3,4]},link:!1,underline:!1},Cj={nested:!0},wj={autolink:!0,protocols:[`xopc`],openOnClick:!1,enableClickSelection:!0},Tj={html:!0,transformCopiedText:!0,transformPastedText:!0};function Ej(e){let t=e.storage.markdown;if(!t?.getMarkdown)throw Error(`The note editor requires the Markdown extension`);return t.getMarkdown()}var Dj=[1,1.5,2];function Oj(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function kj(e){let t=(0,dr.c)(63),{noteId:n,attachment:r,transcript:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ve(),f=ve(jj),m=ve(Aj),h=u===n&&d===r.id,g=h&&o,v=h&&s,y=h?c:0,b=h&&l>0?l:r.duration??0,x=b>0?Math.min(y/b*100,100):0,[S,C]=(0,A.useState)(0),w=(0,A.useRef)(null),T;t[0]!==r.duration||t[1]!==r.id||t[2]!==n||t[3]!==f?(T=()=>{f(n,r.id,r.duration)},t[0]=r.duration,t[1]=r.id,t[2]=n,t[3]=f,t[4]=T):T=t[4];let E=T,D;t[5]===m?D=t[6]:(D=e=>{m(Number(e.target.value))},t[5]=m,t[6]=D);let ee=D,te;t[7]===S?te=t[8]:(te=()=>{C((S+1)%Dj.length)},t[7]=S,t[8]=te);let ne=te,re;t[9]!==h||t[10]!==S?(re=()=>{if(!h)return;let e=document.querySelector(`audio`);e&&(e.playbackRate=Dj[S])},t[9]=h,t[10]=S,t[11]=re):re=t[11];let ie;t[12]!==h||t[13]!==g||t[14]!==S?(ie=[S,h,g],t[12]=h,t[13]=g,t[14]=S,t[15]=ie):ie=t[15],(0,A.useEffect)(re,ie);let ae;t[16]===a?ae=t[17]:(ae=_(`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4`,a),t[16]=a,t[17]=ae);let oe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-accent/10`,children:(0,j.jsx)(O,{className:`size-5 text-accent`})}),t[18]=oe):oe=t[18];let se=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,k;t[19]===se?k=t[20]:(k=_(`flex size-8 shrink-0 items-center justify-center rounded-full transition-colors`,se),t[19]=se,t[20]=k);let ce=g?`Pause`:`Play`,le;t[21]!==v||t[22]!==g?(le=v?(0,j.jsx)(p,{className:`size-4 animate-spin`}):g?(0,j.jsx)(xe,{className:`size-4`}):(0,j.jsx)(_e,{className:`size-4 ml-0.5`}),t[21]=v,t[22]=g,t[23]=le):le=t[23];let ue;t[24]!==E||t[25]!==ce||t[26]!==le||t[27]!==k?(ue=(0,j.jsx)(`button`,{type:`button`,onClick:E,className:k,"aria-label":ce,children:le}),t[24]=E,t[25]=ce,t[26]=le,t[27]=k,t[28]=ue):ue=t[28];let de=b||1,fe=`linear-gradient(to right, var(--color-accent) ${x}%, var(--color-accent-alpha-10, rgba(59,130,246,0.1)) ${x}%)`,pe;t[29]===fe?pe=t[30]:(pe={background:fe},t[29]=fe,t[30]=pe);let me;t[31]!==ee||t[32]!==y||t[33]!==de||t[34]!==pe?(me=(0,j.jsx)(`input`,{ref:w,type:`range`,min:0,max:de,step:.1,value:y,onChange:ee,className:`voice-progress-range h-1.5 w-full cursor-pointer appearance-none rounded-full bg-accent/10 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent`,style:pe}),t[31]=ee,t[32]=y,t[33]=de,t[34]=pe,t[35]=me):me=t[35];let he;t[36]===y?he=t[37]:(he=Oj(y),t[36]=y,t[37]=he);let ge;t[38]===he?ge=t[39]:(ge=(0,j.jsx)(`span`,{children:he}),t[38]=he,t[39]=ge);let ye;t[40]===b?ye=t[41]:(ye=Oj(b),t[40]=b,t[41]=ye);let be;t[42]===ye?be=t[43]:(be=(0,j.jsx)(`span`,{children:ye}),t[42]=ye,t[43]=be);let Se;t[44]!==ge||t[45]!==be?(Se=(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] tabular-nums text-fg-muted`,children:[ge,be]}),t[44]=ge,t[45]=be,t[46]=Se):Se=t[46];let Ce;t[47]!==me||t[48]!==Se?(Ce=(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[me,Se]}),t[47]=me,t[48]=Se,t[49]=Ce):Ce=t[49];let we=Dj[S],Te;t[50]!==ne||t[51]!==we?(Te=(0,j.jsxs)(`button`,{type:`button`,onClick:ne,className:`shrink-0 rounded-md px-1.5 py-0.5 text-[11px] font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,"aria-label":`Playback speed`,children:[we,`x`]}),t[50]=ne,t[51]=we,t[52]=Te):Te=t[52];let Ee;t[53]!==ue||t[54]!==Ce||t[55]!==Te?(Ee=(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[oe,(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ue,Ce,Te]})})]}),t[53]=ue,t[54]=Ce,t[55]=Te,t[56]=Ee):Ee=t[56];let De;t[57]===i?De=t[58]:(De=i&&(0,j.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2`,children:(0,j.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i})}),t[57]=i,t[58]=De);let Oe;return t[59]!==Ee||t[60]!==De||t[61]!==ae?(Oe=(0,j.jsxs)(`div`,{className:ae,children:[Ee,De]}),t[59]=Ee,t[60]=De,t[61]=ae,t[62]=Oe):Oe=t[62],Oe}function Aj(e){return e.seek}function jj(e){return e.toggle}function Mj(e){let t=(0,dr.c)(11),{node:n}=e,{href:r,label:i}=n.attrs,a;t[0]===r?a=t[1]:(a=ue(r),t[0]=r,t[1]=a);let o=a;if(!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,j.jsx)(gh,{as:`span`,className:`inline text-fg-muted italic text-sm`,children:`[audio unavailable]`}),t[2]=e):e=t[2],e}let s;t[3]===i?s=t[4]:(s=i?.match(/(\d+):(\d+)/),t[3]=i,t[4]=s);let c=s,l=c?Number(c[1])*60+Number(c[2]):void 0,u;t[5]!==l||t[6]!==o.attachmentId?(u={id:o.attachmentId,type:`audio`,mimeType:`audio/webm`,fileName:``,size:0,relativePath:``,duration:l},t[5]=l,t[6]=o.attachmentId,t[7]=u):u=t[7];let d=u,f;return t[8]!==d||t[9]!==o.noteId?(f=(0,j.jsx)(gh,{className:`my-3`,children:(0,j.jsx)(kj,{noteId:o.noteId,attachment:d,className:`max-w-md`})}),t[8]=d,t[9]=o.noteId,t[10]=f):f=t[10],f}var Nj=/^\[([^\]]*)\]\((xopc-attachment:\/\/notes\/[^)]+)\)$/,Pj=K.create({name:`audioAttachment`,group:`block`,atom:!0,draggable:!1,selectable:!0,addAttributes(){return{href:{default:null},label:{default:null}}},parseHTML(){return[{tag:`a[data-audio-attachment]`,getAttrs:e=>typeof e==`string`?!1:{href:e.getAttribute(`href`),label:e.textContent}}]},renderHTML({HTMLAttributes:e}){return[`a`,W(e,{"data-audio-attachment":``}),e.label||`Audio`]},addNodeView(){return wh(Mj)},addProseMirrorPlugins(){let e=this.type;return[new z({key:new B(`audioAttachmentTransform`),appendTransaction(t,n,r){let{tr:i}=r,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name!==`paragraph`||t.childCount!==1)return;let r=t.firstChild;if(!r||r.type.name!==`text`)return;let o=r.text??``,s=o.match(Nj);if(s){let r=s[1],o=s[2];if(o.includes(`xopc-attachment://notes/`)){let s=e.create({href:o,label:r});i.replaceWith(n,n+t.nodeSize,s),a=!0;return}}let c=r.marks.find(e=>e.type.name===`link`&&typeof e.attrs.href==`string`&&e.attrs.href.includes(`xopc-attachment://notes/`));if(c){let r=e.create({href:c.attrs.href,label:o});i.replaceWith(n,n+t.nodeSize,r),a=!0}}),a?i:null}})]}});function Fj(e){let t=(0,dr.c)(27),{node:n,editor:r,getPos:i}=e,a=g(Rj),o;t[0]===a?o=t[1]:(o=h(a),t[0]=a,t[1]=o);let s=o.notes,c=String(n.attrs.language??``),l;t[2]===c?l=t[3]:(l=c.toLowerCase(),t[2]=c,t[3]=l);let u=l===`mermaid`,[f,p]=(0,A.useState)(!1),m,_;t[4]!==r||t[5]!==i||t[6]!==u||t[7]!==n.nodeSize?(m=()=>{if(!u)return;let e=()=>{let e=i(),{from:t,to:a}=r.state.selection;typeof e==`number`&&t>e&&a<e+n.nodeSize&&p(!0)};return r.on(`selectionUpdate`,e),()=>{r.off(`selectionUpdate`,e)}},_=[r,i,u,n.nodeSize],t[4]=r,t[5]=i,t[6]=u,t[7]=n.nodeSize,t[8]=m,t[9]=_):(m=t[8],_=t[9]),(0,A.useEffect)(m,_);let v;t[10]===n.textContent?v=t[11]:(v="`".repeat(Math.max(3,...Array.from(n.textContent.matchAll(/`+/g),Lj))),t[10]=n.textContent,t[11]=v);let y=v,b=u?`block-editor-mermaid min-w-0`:void 0,x;t[12]!==y||t[13]!==u||t[14]!==s||t[15]!==n.textContent||t[16]!==f?(x=u&&(0,j.jsxs)(`div`,{contentEditable:!1,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,j.jsx)(`span`,{children:`Mermaid`}),(0,j.jsx)(`button`,{type:`button`,"aria-pressed":f,className:`rounded-md px-2 py-1 hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>p(Ij),children:f?s.modePreview:s.modeSource})]}),!f&&(0,j.jsx)(d,{content:`${y}mermaid\n${n.textContent}\n${y}`,mermaidActions:!0})]}),t[12]=y,t[13]=u,t[14]=s,t[15]=n.textContent,t[16]=f,t[17]=x):x=t[17];let S=u&&!f,C=n.attrs.language?`language-${n.attrs.language}`:void 0,w;t[18]===C?w=t[19]:(w=(0,j.jsx)(hh,{as:`code`,className:C}),t[18]=C,t[19]=w);let T;t[20]!==w||t[21]!==S?(T=(0,j.jsx)(`pre`,{className:`block-editor-code`,hidden:S,children:w}),t[20]=w,t[21]=S,t[22]=T):T=t[22];let E;return t[23]!==T||t[24]!==b||t[25]!==x?(E=(0,j.jsxs)(gh,{className:b,children:[x,T]}),t[23]=T,t[24]=b,t[25]=x,t[26]=E):E=t[26],E}function Ij(e){return!e}function Lj(e){return e[0].length+1}function Rj(e){return e.language}var zj=v_.extend({addNodeView(){return wh(Fj)}});function Bj(e){let{selection:t,doc:n}=e,r=n.type.schema,i=t.from;if(t instanceof R)i=t.to;else{if(n.resolve(i).parent.isTextblock)return!0;i=Math.min(i+1,n.content.size)}let a=n.resolve(Math.min(i,n.content.size));if(a.parent.isTextblock)return e.setSelection(L.near(a,1)),!0;let o=r.nodes.paragraph;if(!o)return!1;let s=n.content.size;return e.insert(s,o.create()),e.setSelection(L.near(e.doc.resolve(s+1),1)),!0}function Vj(e){e.commands.command(({tr:e,dispatch:t})=>(t&&Bj(e),!0))}var Hj=G.create({name:`extraKeyboardShortcuts`,addKeyboardShortcuts(){return{"Mod-Shift-1":()=>this.editor.chain().focus().toggleHeading({level:1}).run(),"Mod-Shift-2":()=>this.editor.chain().focus().toggleHeading({level:2}).run(),"Mod-Shift-3":()=>this.editor.chain().focus().toggleHeading({level:3}).run(),"Mod-Shift-8":()=>this.editor.chain().focus().toggleBulletList().run(),"Mod-Shift-9":()=>this.editor.chain().focus().toggleOrderedList().run(),"Mod-Shift-0":()=>this.editor.chain().focus().toggleTaskList().run()}}});function Uj(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Bp(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function Wj(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
185
|
-
`);return/\s/.test(n)}):!1}var Gj=new B(`suggestion`);function Kj({pluginKey:e=Gj,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=Uj,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!Wj(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new z({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),bl.create(e.doc,[_l.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var qj=Kj,Jj=[{id:`heading1`,label:`Heading 1`,description:`Large section heading`,keywords:[`h1`,`title`,`heading`]},{id:`heading2`,label:`Heading 2`,description:`Medium section heading`,keywords:[`h2`,`heading`]},{id:`heading3`,label:`Heading 3`,description:`Small section heading`,keywords:[`h3`,`heading`]},{id:`bulletList`,label:`Bullet List`,description:`Unordered list`,keywords:[`ul`,`list`,`bullet`]},{id:`orderedList`,label:`Numbered List`,description:`Ordered list`,keywords:[`ol`,`list`,`numbered`]},{id:`taskList`,label:`Task List`,description:`List with checkboxes`,keywords:[`todo`,`task`,`checkbox`]},{id:`blockquote`,label:`Quote`,description:`Block quotation`,keywords:[`quote`,`blockquote`]},{id:`codeBlock`,label:`Code Block`,description:`Fenced code snippet`,keywords:[`code`,`snippet`]},{id:`divider`,label:`Divider`,description:`Horizontal rule`,keywords:[`hr`,`rule`,`line`]},{id:`image`,label:`Image`,description:`Upload an image`,keywords:[`img`,`photo`,`picture`]}];function Yj(e){let t=e.trim().toLowerCase();return t?Jj.filter(e=>[e.label,e.description,...e.keywords].join(` `).toLowerCase().includes(t)):Jj}function Xj(e,t,n,r){if(e.id===`image`){t.chain().focus().deleteRange(n).run(),r.requestImagePicker&&setTimeout(()=>r.requestImagePicker?.(),0);return}let i=t.chain().focus().deleteRange(n);switch(e.id){case`heading1`:i.setHeading({level:1}).run();return;case`heading2`:i.setHeading({level:2}).run();return;case`heading3`:i.setHeading({level:3}).run();return;case`bulletList`:i.toggleBulletList().run();return;case`orderedList`:i.toggleOrderedList().run();return;case`taskList`:i.toggleTaskList().run();return;case`blockquote`:i.toggleBlockquote().run();return;case`codeBlock`:i.toggleCodeBlock().run();return;case`divider`:i.setHorizontalRule().run(),Vj(t);return;default:return}}var Zj=`slash-menu-panel fixed z-[9999] w-64 overflow-hidden rounded-lg border border-edge bg-surface-base shadow-lg`,Qj=`flex w-full items-center gap-3 rounded-md px-2.5 py-2 text-left transition-colors text-fg-muted hover:bg-surface-hover hover:text-fg`,$j=`bg-surface-hover text-fg`;function eM({editor:e,getRuntime:t}){let n=null,r=null,i=null,a=null,o=0,s=``,c=null,l=()=>{n?.remove(),n=null,r=null,i=null,a=null,c=null,o=0,s=``},u=()=>{n||(n=document.createElement(`div`),n.setAttribute(`data-slash-menu-root`,`true`),r=document.createElement(`div`),r.className=Zj,i=document.createElement(`div`),i.className=`slash-menu-scroll max-h-72 overflow-y-auto p-1`,a=document.createElement(`input`),a.type=`file`,a.accept=`image/*`,a.className=`hidden`,a.addEventListener(`change`,()=>{let e=a?.files?.[0],n=t();e&&n.onImageUpload&&n.onImageUpload(e),a&&(a.value=``)}),r.appendChild(i),n.append(r,a),document.body.appendChild(n))},d=()=>{if(!r||!c)return;let e=c.clientRect?.()??null;if(e){r.style.top=`${e.bottom+6}px`,r.style.left=`${e.left}px`;return}let t=c.editor.view.coordsAtPos(c.range.to);r.style.top=`${t.bottom+6}px`,r.style.left=`${t.left}px`},f=()=>{if(!c||!i||!r)return;i.replaceChildren();let e=i;c.items.forEach((n,r)=>{let i=document.createElement(`button`);i.type=`button`,i.className=`${Qj}${r===o?` ${$j}`:``}`;let s=document.createElement(`span`);s.className=`flex size-8 shrink-0 items-center justify-center rounded-md border border-edge bg-surface-raised text-xs font-semibold uppercase text-fg-muted`,s.textContent=n.label.slice(0,2);let l=document.createElement(`span`);l.className=`min-w-0 flex-1`;let u=document.createElement(`span`);u.className=`block truncate text-sm font-medium text-fg`,u.textContent=n.label;let d=document.createElement(`span`);d.className=`block truncate text-xs text-fg-muted`,d.textContent=n.description,l.append(u,d),i.append(s,l),i.addEventListener(`mousedown`,e=>{if(e.preventDefault(),c){if(n.id===`image`){Xj(n,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())});return}c.command(n)}}),e.appendChild(i)}),d()},p=e=>{e.query!==s&&(o=0,s=e.query),c=e,u(),f()};return e.on(`destroy`,l),{onStart:e=>{p(e)},onUpdate:e=>{p(e)},onExit:()=>{l()},onKeyDown:({event:e})=>{let n=c?.items??[];if(!n.length)return!1;if(e.key===`ArrowDown`)return o=(o+1)%n.length,f(),!0;if(e.key===`ArrowUp`)return o=(o-1+n.length)%n.length,f(),!0;if(e.key===`Enter`){let e=n[o];return e&&c&&(e.id===`image`?Xj(e,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())}):c.command(e)),!0}return!1},destroy:l}}var tM=new B(`slashCommands`),nM=G.create({name:`slashCommands`,addOptions(){return{getRuntime:()=>({})}},addStorage(){return{active:!1}},onDestroy(){this.storage.active=!1},addProseMirrorPlugins(){let e=this,t=eM({editor:this.editor,getRuntime:()=>e.options.getRuntime()});return[qj({pluginKey:tM,editor:this.editor,char:`/`,allowedPrefixes:null,items:({query:e})=>Yj(e),command:({editor:t,range:n,props:r})=>{Xj(r,t,n,e.options.getRuntime())},render:()=>({onStart:n=>{e.storage.active=!0,t.onStart(n)},onUpdate:e=>{t.onUpdate(e)},onExit:()=>{e.storage.active=!1,t.onExit()},onKeyDown:t.onKeyDown})})]}}),rM=iE.configure({node:`paragraph`,notAfter:[`paragraph`]});function iM(e){let t=String(e.getAttributes(`link`).href??``),n=window.prompt(`URL`,t);if(n!==null){if(!n.trim()){e.chain().focus().extendMarkRange(`link`).unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:n.trim()}).run()}}function aM(e){return!e.metaKey&&!e.ctrlKey?null:(e.target instanceof Element?e.target:null)?.closest(`a[href]`)?.getAttribute(`href`)?.trim()||null}function oM(e){let t=(0,dr.c)(9),{onClick:n,isActive:r,disabled:i,title:a,children:o}=e,s=r&&`bg-surface-hover text-accent`,c=i&&`pointer-events-none opacity-40`,l;t[0]!==s||t[1]!==c?(l=_(`rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,s,c),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==l||t[7]!==a?(u=(0,j.jsx)(`button`,{type:`button`,onClick:n,disabled:i,title:a,className:l,children:o}),t[3]=o,t[4]=i,t[5]=n,t[6]=l,t[7]=a,t[8]=u):u=t[8],u}function sM(){let e=(0,dr.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(`div`,{className:`mx-1 h-5 w-px bg-edge`}),e[0]=t):t=e[0],t}function cM(e){let t=(0,dr.c)(131),{editor:n,onImageUpload:r,imageUploading:i}=e,a=i===void 0?!1:i,o=(0,A.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o.current?.click()},t[0]=s):s=t[0];let c=s,l;t[1]!==a||t[2]!==r?(l=e=>{let t=e.target.files?.[0];t&&r&&!a&&r(t),o.current&&(o.current.value=``)},t[1]=a,t[2]=r,t[3]=l):l=t[3];let d=l,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>n.chain().focus().undo().run(),p=n.can().undo(),t[4]=n,t[5]=f,t[6]=p);let m=!p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,j.jsx)(te,{size:16}),t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==m?(g=(0,j.jsx)(oM,{onClick:f,disabled:m,title:`Undo`,children:h}),t[8]=f,t[9]=m,t[10]=g):g=t[10];let _,v;t[11]===n?(_=t[12],v=t[13]):(v=()=>n.chain().focus().redo().run(),_=n.can().redo(),t[11]=n,t[12]=_,t[13]=v);let y=!_,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,j.jsx)(he,{size:16}),t[14]=b):b=t[14];let x;t[15]!==y||t[16]!==v?(x=(0,j.jsx)(oM,{onClick:v,disabled:y,title:`Redo`,children:b}),t[15]=y,t[16]=v,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,j.jsx)(sM,{}),t[18]=S):S=t[18];let C,w;t[19]===n?(C=t[20],w=t[21]):(C=()=>n.chain().focus().toggleHeading({level:1}).run(),w=n.isActive(`heading`,{level:1}),t[19]=n,t[20]=C,t[21]=w);let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,j.jsx)(pe,{size:16}),t[22]=T):T=t[22];let E;t[23]!==C||t[24]!==w?(E=(0,j.jsx)(oM,{onClick:C,isActive:w,title:`Heading 1`,children:T}),t[23]=C,t[24]=w,t[25]=E):E=t[25];let D,ee;t[26]===n?(D=t[27],ee=t[28]):(D=()=>n.chain().focus().toggleHeading({level:2}).run(),ee=n.isActive(`heading`,{level:2}),t[26]=n,t[27]=D,t[28]=ee);let ne;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,j.jsx)(fe,{size:16}),t[29]=ne):ne=t[29];let O;t[30]!==D||t[31]!==ee?(O=(0,j.jsx)(oM,{onClick:D,isActive:ee,title:`Heading 2`,children:ne}),t[30]=D,t[31]=ee,t[32]=O):O=t[32];let k,le;t[33]===n?(k=t[34],le=t[35]):(k=()=>n.chain().focus().toggleHeading({level:3}).run(),le=n.isActive(`heading`,{level:3}),t[33]=n,t[34]=k,t[35]=le);let ue;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,j.jsx)(be,{size:16}),t[36]=ue):ue=t[36];let de;t[37]!==k||t[38]!==le?(de=(0,j.jsx)(oM,{onClick:k,isActive:le,title:`Heading 3`,children:ue}),t[37]=k,t[38]=le,t[39]=de):de=t[39];let _e;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,j.jsx)(sM,{}),t[40]=_e):_e=t[40];let ve,xe;t[41]===n?(ve=t[42],xe=t[43]):(ve=()=>n.chain().focus().toggleBold().run(),xe=n.isActive(`bold`),t[41]=n,t[42]=ve,t[43]=xe);let Ce;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,j.jsx)(ge,{size:16}),t[44]=Ce):Ce=t[44];let we;t[45]!==ve||t[46]!==xe?(we=(0,j.jsx)(oM,{onClick:ve,isActive:xe,title:`Bold (⌘B)`,children:Ce}),t[45]=ve,t[46]=xe,t[47]=we):we=t[47];let Te,Ee;t[48]===n?(Te=t[49],Ee=t[50]):(Te=()=>n.chain().focus().toggleItalic().run(),Ee=n.isActive(`italic`),t[48]=n,t[49]=Te,t[50]=Ee);let De;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,j.jsx)(oe,{size:16}),t[51]=De):De=t[51];let Oe;t[52]!==Te||t[53]!==Ee?(Oe=(0,j.jsx)(oM,{onClick:Te,isActive:Ee,title:`Italic (⌘I)`,children:De}),t[52]=Te,t[53]=Ee,t[54]=Oe):Oe=t[54];let M,ke;t[55]===n?(M=t[56],ke=t[57]):(M=()=>n.chain().focus().toggleStrike().run(),ke=n.isActive(`strike`),t[55]=n,t[56]=M,t[57]=ke);let Ae;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(ae,{size:16}),t[58]=Ae):Ae=t[58];let je;t[59]!==M||t[60]!==ke?(je=(0,j.jsx)(oM,{onClick:M,isActive:ke,title:`Strikethrough`,children:Ae}),t[59]=M,t[60]=ke,t[61]=je):je=t[61];let Me,N;t[62]===n?(Me=t[63],N=t[64]):(Me=()=>n.chain().focus().toggleCode().run(),N=n.isActive(`code`),t[62]=n,t[63]=Me,t[64]=N);let Ne;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(ie,{size:16}),t[65]=Ne):Ne=t[65];let Pe;t[66]!==Me||t[67]!==N?(Pe=(0,j.jsx)(oM,{onClick:Me,isActive:N,title:`Inline code`,children:Ne}),t[66]=Me,t[67]=N,t[68]=Pe):Pe=t[68];let Fe,P;t[69]===n?(Fe=t[70],P=t[71]):(Fe=()=>iM(n),P=n.isActive(`link`),t[69]=n,t[70]=Fe,t[71]=P);let Ie;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,j.jsx)(ce,{size:16}),t[72]=Ie):Ie=t[72];let F;t[73]!==Fe||t[74]!==P?(F=(0,j.jsx)(oM,{onClick:Fe,isActive:P,title:`Link`,children:Ie}),t[73]=Fe,t[74]=P,t[75]=F):F=t[75];let Le;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,j.jsx)(sM,{}),t[76]=Le):Le=t[76];let Re,ze;t[77]===n?(Re=t[78],ze=t[79]):(Re=()=>n.chain().focus().toggleBulletList().run(),ze=n.isActive(`bulletList`),t[77]=n,t[78]=Re,t[79]=ze);let Be;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,j.jsx)(re,{size:16}),t[80]=Be):Be=t[80];let Ve;t[81]!==Re||t[82]!==ze?(Ve=(0,j.jsx)(oM,{onClick:Re,isActive:ze,title:`Bullet list`,children:Be}),t[81]=Re,t[82]=ze,t[83]=Ve):Ve=t[83];let He,Ue;t[84]===n?(He=t[85],Ue=t[86]):(He=()=>n.chain().focus().toggleOrderedList().run(),Ue=n.isActive(`orderedList`),t[84]=n,t[85]=He,t[86]=Ue);let We;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,j.jsx)(Se,{size:16}),t[87]=We):We=t[87];let Ge;t[88]!==He||t[89]!==Ue?(Ge=(0,j.jsx)(oM,{onClick:He,isActive:Ue,title:`Ordered list`,children:We}),t[88]=He,t[89]=Ue,t[90]=Ge):Ge=t[90];let Ke,qe;t[91]===n?(Ke=t[92],qe=t[93]):(Ke=()=>n.chain().focus().toggleTaskList().run(),qe=n.isActive(`taskList`),t[91]=n,t[92]=Ke,t[93]=qe);let Je;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,j.jsx)(se,{size:16}),t[94]=Je):Je=t[94];let Ye;t[95]!==Ke||t[96]!==qe?(Ye=(0,j.jsx)(oM,{onClick:Ke,isActive:qe,title:`Task list`,children:Je}),t[95]=Ke,t[96]=qe,t[97]=Ye):Ye=t[97];let Xe,Ze;t[98]===n?(Xe=t[99],Ze=t[100]):(Xe=()=>n.chain().focus().toggleBlockquote().run(),Ze=n.isActive(`blockquote`),t[98]=n,t[99]=Xe,t[100]=Ze);let Qe;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,j.jsx)(ye,{size:16}),t[101]=Qe):Qe=t[101];let $e;t[102]!==Xe||t[103]!==Ze?($e=(0,j.jsx)(oM,{onClick:Xe,isActive:Ze,title:`Quote`,children:Qe}),t[102]=Xe,t[103]=Ze,t[104]=$e):$e=t[104];let et;t[105]===n?et=t[106]:(et=()=>{n.chain().focus().setHorizontalRule().run(),Vj(n)},t[105]=n,t[106]=et);let tt;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,j.jsx)(u,{size:16}),t[107]=tt):tt=t[107];let nt;t[108]===et?nt=t[109]:(nt=(0,j.jsx)(oM,{onClick:et,title:`Divider`,children:tt}),t[108]=et,t[109]=nt);let rt;t[110]!==d||t[111]!==a||t[112]!==r?(rt=r&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(sM,{}),(0,j.jsx)(oM,{onClick:c,disabled:a,title:a?`Uploading…`:`Insert image`,children:(0,j.jsx)(me,{size:16,className:a?`animate-pulse`:void 0})}),(0,j.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,onChange:d,className:`hidden`})]}),t[110]=d,t[111]=a,t[112]=r,t[113]=rt):rt=t[113];let it;return t[114]!==x||t[115]!==E||t[116]!==O||t[117]!==de||t[118]!==we||t[119]!==Oe||t[120]!==je||t[121]!==Pe||t[122]!==F||t[123]!==Ve||t[124]!==Ge||t[125]!==Ye||t[126]!==$e||t[127]!==nt||t[128]!==rt||t[129]!==g?(it=(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-edge px-3 py-1.5`,children:[g,x,S,E,O,de,_e,we,Oe,je,Pe,F,Le,Ve,Ge,Ye,$e,nt,rt]}),t[114]=x,t[115]=E,t[116]=O,t[117]=de,t[118]=we,t[119]=Oe,t[120]=je,t[121]=Pe,t[122]=F,t[123]=Ve,t[124]=Ge,t[125]=Ye,t[126]=$e,t[127]=nt,t[128]=rt,t[129]=g,t[130]=it):it=t[130],it}var lM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uM=K.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,W(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=W(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new Rp({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Pp({find:lM,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function dM(e){let t=(0,dr.c)(28),{node:n,updateAttributes:r,selected:i}=e,{src:a,alt:o,title:s}=n.attrs,{openImage:c}=Ee(),[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(null),[f,p]=(0,A.useState)(!1),m=(0,A.useRef)(0),h=(0,A.useRef)(0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),e.stopPropagation(),p(!0),m.current=e.clientX,h.current=d.current?.offsetWidth??400},t[0]=g):g=t[0];let v=g,y,b;t[1]!==f||t[2]!==r?(y=()=>{if(!f)return;let e=e=>{let t=e.clientX-m.current;r({width:Math.max(100,h.current+t)})},t=()=>{p(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},b=[f,r],t[1]=f,t[2]=r,t[3]=y,t[4]=b):(y=t[3],b=t[4]),(0,A.useEffect)(y,b);let x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{u(!1)},t[5]=x):x=t[5];let S;t[6]===a?S=t[7]:(S=[a],t[6]=a,t[7]=S),(0,A.useEffect)(x,S);let C=n.attrs.width,w=i&&`ring-2 ring-accent ring-offset-2 ring-offset-surface-base rounded-lg`,T;t[8]===w?T=t[9]:(T=_(`relative inline-block`,w),t[8]=w,t[9]=T);let E=C?`${C}px`:void 0,D;t[10]===E?D=t[11]:(D={width:E,maxWidth:`100%`},t[10]=E,t[11]=D);let te;t[12]!==o||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==s?(te=l?(0,j.jsx)(`div`,{className:`flex min-h-24 min-w-[12rem] items-center justify-center rounded-lg border border-dashed border-edge bg-surface-hover text-fg-muted`,children:(0,j.jsx)(`span`,{className:`text-xs`,children:`Image unavailable`})}):(0,j.jsx)(ee,{src:a,alt:o??``,title:s??void 0,className:`block h-auto w-full cursor-zoom-in rounded-lg`,draggable:!1,onClick:e=>c(e,o??void 0),onLoadFailed:()=>u(!0)}),t[12]=o,t[13]=l,t[14]=c,t[15]=a,t[16]=s,t[17]=te):te=t[17];let ne=(i||f)&&`opacity-100`,re;t[18]===ne?re=t[19]:(re=_(`absolute bottom-1 right-1 size-4 cursor-se-resize rounded-sm opacity-0 transition-opacity`,`bg-accent/70 hover:bg-accent`,ne),t[18]=ne,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,j.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,className:`m-0.5 text-white`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,j.jsx)(`path`,{d:`M10 2L2 10M10 6L6 10M10 10L10 10`,strokeLinecap:`round`})}),t[20]=ie):ie=t[20];let O;t[21]===re?O=t[22]:(O=(0,j.jsx)(`div`,{onMouseDown:v,className:re,title:`Drag to resize`,children:ie}),t[21]=re,t[22]=O);let ae;return t[23]!==te||t[24]!==O||t[25]!==T||t[26]!==D?(ae=(0,j.jsx)(gh,{className:`block-editor-image-wrapper`,children:(0,j.jsxs)(`div`,{ref:d,className:T,style:D,children:[te,O]})}),t[23]=te,t[24]=O,t[25]=T,t[26]=D,t[27]=ae):ae=t[27],ae}var fM=uM.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute(`width`)||e.style.width;return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width: ${e.width}px`}:{}}}},addNodeView(){return wh(dM)}}),pM,mM;if(typeof WeakMap<`u`){let e=new WeakMap;pM=t=>e.get(t),mM=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;pM=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},mM=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var hM=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return pM(e)||mM(e,gM(e))}};function gM(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=_M(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new hM(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&vM(s,o,e),s}function _M(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function vM(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=yM(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function yM(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function bM(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new B(`selectingCells`);function xM(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function SM(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function CM(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=xM(t.$head)||wM(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function wM(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function TM(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function EM(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function DM(e,t,n){let r=e.node(-1),i=hM.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function OM(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var kM=class e extends I{constructor(e,t=e){let n=e.node(-1),r=hM.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Ei(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(TM(r)&&TM(i)&&EM(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return L.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=hM.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=OM(e,0,l)),u>0&&(e=OM(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(N.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new F(N.from(o),1,1)}replace(e,t=F.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?F.empty:t)}let i=I.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new F(N.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=hM.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=hM.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=hM.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=hM.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new AM(this.$anchorCell.pos,this.$headCell.pos)}};kM.prototype.visible=!1,I.jsonID(`cell`,kM);var AM=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&EM(t,n)?new kM(t,n):I.near(n,1)}};new B(`fix-tables`);function jM(e){let t=e.selection,n=CM(e),r=n.node(-1),i=n.start(-1),a=hM.get(r);return{...t instanceof kM?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function MM(e){return function(t,n){if(!SM(t))return!1;if(n){let r=bM(t.schema),i=jM(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function NM(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function PM(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?MM(e):function(t,n){if(!SM(t))return!1;if(n){let r=bM(t.schema),i=jM(t),a=t.tr,o=NM(`row`,i,r),s=NM(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}PM(`row`,{useDeprecatedLogic:!0}),PM(`column`,{useDeprecatedLogic:!0}),PM(`cell`,{useDeprecatedLogic:!0});function FM(e,t){let n=e.selection;if(!(n instanceof kM))return!1;if(t){let r=e.tr,i=bM(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new F(i,0,0))}),r.docChanged&&t(r)}return!0}mu({ArrowLeft:LM(`horiz`,-1),ArrowRight:LM(`horiz`,1),ArrowUp:LM(`vert`,-1),ArrowDown:LM(`vert`,1),"Shift-ArrowLeft":RM(`horiz`,-1),"Shift-ArrowRight":RM(`horiz`,1),"Shift-ArrowUp":RM(`vert`,-1),"Shift-ArrowDown":RM(`vert`,1),Backspace:FM,"Mod-Backspace":FM,Delete:FM,"Mod-Delete":FM});function IM(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function LM(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof kM)return IM(n,r,I.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=zM(i,e,t);if(o==null)return!1;if(e==`horiz`)return IM(n,r,I.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=DM(i,e,t),s;return s=a?I.near(a,1):t<0?I.near(n.doc.resolve(i.before(-1)),-1):I.near(n.doc.resolve(i.after(-1)),1),IM(n,r,s)}}}function RM(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof kM)o=a;else{let r=zM(i,e,t);if(r==null)return!1;o=new kM(n.doc.resolve(r))}let s=DM(o.$headCell,e,t);return s?IM(n,r,new kM(o.$anchorCell,s)):!1}}function zM(e,t,n){if(!(e.state.selection instanceof L))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new B(`tableColumnResizing`);function BM(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var VM=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&Uu(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(y(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(D(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(S(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(E(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(b(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(C(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(w(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(T(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Df(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof R){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof kM){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():BM(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&x(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},HM=e=>new z({key:typeof e.pluginKey==`string`?new B(e.pluginKey):e.pluginKey,view:t=>new VM({view:t,...e})});G.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[HM({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var UM=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return nf(e,{textSerializers:rf(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(y(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(D(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(S(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(E(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(b(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(C(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(w(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(T(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Df(this.view,e.from,e.to);x({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},WM=e=>new z({key:typeof e.pluginKey==`string`?new B(e.pluginKey):e.pluginKey,view:t=>new UM({view:t,...e})});G.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[WM({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function GM(e,t){return e??new B(t)}var KM=typeof window<`u`?A.useLayoutEffect:A.useEffect,qM=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),JM=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),YM=new Set([`children`,`className`,`style`]),XM=new Set([`tabIndex`]),ZM=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),QM={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function $M(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function eN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function tN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||ZM.has(e)}function nN(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function rN(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:QM[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function iN(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function aN(e){return XM.has(e)}function oN(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function sN(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function cN(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||JM.has(e)?String(t):`${t}px`}function lN(e,t){qM.has(t)||e.style.removeProperty(nN(t))}function uN(e,t,n){qM.has(t)||e.style.setProperty(nN(t),cN(t,n))}function dN(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(YM.has(r)||!tN(r)||$M(r,t[r])||$M(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=eN(r);if(a==null||a===!1){aN(r)&&sN(e,r),e.removeAttribute(o);return}if(a===!0){aN(r)&&oN(e,r,!0),e.setAttribute(o,``);return}if(aN(r)){oN(e,r,a);return}e.setAttribute(o,String(a))})}function fN(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function pN(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){lN(e,t);return}uN(e,t,a)}})}function mN(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!$M(t,n))return;let{eventName:i,options:a}=rN(t),o=t=>{n(iN(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function hN(e,t){let n=(0,A.useRef)({}),r=(0,A.useRef)([]);KM(()=>{let i=n.current;return fN(e,i.className,t.className),pN(e,i.style,t.style),dN(e,i,t),r.current=mN(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var gN=A.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,A.useRef)(document.createElement(`div`)),f=(0,A.useRef)(GM(e,`bubbleMenu`)).current;hN(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=fh(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,A.useRef)(h);g.current=h;let[_,v]=(0,A.useState)(!1),y=(0,A.useRef)(!0);return(0,A.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=HM({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,A.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,De.createPortal)(c,d.current)});A.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,A.useRef)(document.createElement(`div`)),d=(0,A.useRef)(GM(e,`floatingMenu`)).current;hN(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=fh(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,A.useRef)(m);h.current=m;let[g,_]=(0,A.useState)(!1),v=(0,A.useRef)(!0);return(0,A.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=WM({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,A.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,De.createPortal)(s,u.current)});function _N(e){let t=(0,dr.c)(49),{editor:n,labels:r}=e,i=f(),[a,o]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),p;t[0]===n?p=t[1]:(p={editor:n,selector:yN},t[0]=n,t[1]=p);let h=ah(p),g;t[2]!==h||t[3]!==r.openFailed||t[4]!==i?(g=async()=>{d(null),(await i(h)).ok||d(r.openFailed)},t[2]=h,t[3]=r.openFailed,t[4]=i,t[5]=g):g=t[5];let _=g,v;t[6]===h?v=t[7]:(v=async()=>{await m(h)&&(o(!0),window.setTimeout(()=>o(!1),1500))},t[6]=h,t[7]=v);let y=v,b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b={placement:`bottom`,offset:8},t[8]=b):b=t[8];let x;t[9]===h?x=t[10]:(x=(0,j.jsx)(`p`,{className:`max-w-xs truncate px-1 pb-2 text-xs text-fg-muted`,title:h,children:h}),t[9]=h,t[10]=x);let S;t[11]===_?S=t[12]:(S=()=>void _(),t[11]=_,t[12]=S);let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,j.jsx)(l,{}),t[13]=C):C=t[13];let w;t[14]!==r.open||t[15]!==S?(w=(0,j.jsx)(bN,{label:r.open,onClick:S,children:C}),t[14]=r.open,t[15]=S,t[16]=w):w=t[16];let T;t[17]===n?T=t[18]:(T=()=>iM(n),t[17]=n,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,j.jsx)(de,{}),t[19]=E):E=t[19];let D;t[20]!==r.edit||t[21]!==T?(D=(0,j.jsx)(bN,{label:r.edit,onClick:T,children:E}),t[20]=r.edit,t[21]=T,t[22]=D):D=t[22];let ee=a?r.copied:r.copy,te;t[23]===y?te=t[24]:(te=()=>void y(),t[23]=y,t[24]=te);let re;t[25]===a?re=t[26]:(re=a?(0,j.jsx)(s,{}):(0,j.jsx)(c,{}),t[25]=a,t[26]=re);let ie;t[27]!==ee||t[28]!==te||t[29]!==re?(ie=(0,j.jsx)(bN,{label:ee,onClick:te,children:re}),t[27]=ee,t[28]=te,t[29]=re,t[30]=ie):ie=t[30];let O;t[31]===n?O=t[32]:(O=()=>n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t[31]=n,t[32]=O);let ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,j.jsx)(ne,{}),t[33]=ae):ae=t[33];let oe;t[34]!==r.remove||t[35]!==O?(oe=(0,j.jsx)(bN,{label:r.remove,onClick:O,children:ae}),t[34]=r.remove,t[35]=O,t[36]=oe):oe=t[36];let se;t[37]!==D||t[38]!==ie||t[39]!==oe||t[40]!==w?(se=(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[w,D,ie,oe]}),t[37]=D,t[38]=ie,t[39]=oe,t[40]=w,t[41]=se):se=t[41];let k;t[42]===u?k=t[43]:(k=u?(0,j.jsx)(`p`,{className:`px-1 pt-2 text-xs text-danger`,role:`alert`,children:u}):null,t[42]=u,t[43]=k);let ce;return t[44]!==n||t[45]!==se||t[46]!==k||t[47]!==x?(ce=(0,j.jsxs)(gN,{editor:n,shouldShow:vN,options:b,className:`max-w-sm rounded-lg border border-edge bg-surface-panel p-2 shadow-xl`,children:[x,se,k]}),t[44]=n,t[45]=se,t[46]=k,t[47]=x,t[48]=ce):ce=t[48],ce}function vN(e){let{editor:t}=e;return t.isActive(`link`)}function yN(e){let{editor:t}=e;return String(t.getAttributes(`link`).href??``)}function bN(e){let t=(0,dr.c)(9),{children:n,label:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,j.jsx)(`span`,{className:`[&_svg]:size-3.5`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,j.jsx)(`span`,{children:r}),t[2]=r,t[3]=o);let s;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==o?(s=(0,j.jsxs)(`button`,{type:`button`,onClick:i,title:r,"aria-label":r,className:`inline-flex items-center gap-1 rounded-md px-2 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[a,o]}),t[4]=r,t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function xN(e,t){let{doc:n}=e.state,r=n.resolve(t);return r.index(0)===0?`first`:r.index(0)===n.childCount-1?`last`:null}function SN({initialContent:e,onChange:t,placeholder:n=`Start writing, or type "/" for commands…`,className:r,noteId:i}){let a=h(g(e=>e.language)).notes,o=f(),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),d=(0,A.useRef)(t);d.current=t;let p=(0,A.useRef)(null),m=(0,A.useRef)({}),v=(0,A.useRef)(()=>void 0),y=(0,A.useRef)(e),b=(0,A.useRef)(e),x=(0,A.useRef)(!1),S=uh({extensions:[oE.configure({...Sj,codeBlock:!1}),zj.configure({HTMLAttributes:{class:`block-editor-code`}}),rM,fM.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:`block-editor-image`}}),sE,cE.configure(Cj),lE.configure({placeholder:({editor:e,node:t,pos:r})=>{if(t.type.name!==`paragraph`||t.content.size>0)return``;let i=xN(e,r);return i===`first`||i===`last`?n:``},includeChildren:!0}),By.configure({...wj,HTMLAttributes:{class:`block-editor-link`}}),xj.configure(Tj),Pj,Hj,nM.configure({getRuntime:()=>m.current})],content:``,onUpdate:({editor:e})=>{let t=Ej(e);y.current=t,b.current=t,d.current(t)},editorProps:{attributes:{class:`block-editor-content`},handlePaste:(e,t)=>{let n=t.clipboardData?.items;if(!n)return!1;for(let e of n)if(e.type.startsWith(`image/`)){t.preventDefault();let n=e.getAsFile();return n&&v.current(n),!0}return!1},handleClick:(e,t,n)=>{let r=aM(n);return r?(n.preventDefault(),o(r),!0):!1},handleDrop:(e,t)=>{let n=t.dataTransfer?.files;if(!n?.length)return!1;for(let e of n)if(e.type.startsWith(`image/`))return t.preventDefault(),v.current(e),!0;return!1}}}),C=(0,A.useCallback)(async e=>{if(!(!i||!S))try{c(!0),u(null);let t=await k(i,e);S.chain().focus().setImage({src:le(i,t.id),alt:e.name}).run(),Vj(S)}catch(e){u(e instanceof Error?e.message:a.imageUploadFailedHint)}finally{c(!1)}},[S,i,a.imageUploadFailed,a.imageUploadFailedHint]);v.current=e=>{C(e)};let w=(0,A.useCallback)(()=>{p.current?.click()},[]);return m.current={onImageUpload:i?C:void 0,requestImagePicker:i?w:void 0},(0,A.useEffect)(()=>{if(!S)return;let t=e!==y.current,n=y.current===b.current;if(x.current&&(!t||!n))return;let r=!1,i=null,a=e,o=()=>{if(!(r||S.isDestroyed)){if(!S.isEditorContentInitialized){i=window.requestAnimationFrame(o);return}S.commands.setContent(a,{emitUpdate:!1}),y.current=a,b.current=a,x.current=!0}};return o(),()=>{r=!0,i!==null&&window.cancelAnimationFrame(i)}},[S,e]),S?(0,j.jsxs)(`div`,{className:_(`flex h-full flex-col overflow-hidden`,r),children:[(0,j.jsx)(cM,{editor:S,onImageUpload:i?C:void 0,imageUploading:s}),l?(0,j.jsxs)(`div`,{className:`border-b border-danger/20 bg-danger-soft px-6 py-2 text-xs text-danger`,role:`alert`,children:[(0,j.jsx)(`span`,{className:`font-medium`,children:a.imageUploadFailed}),` · `,l]}):null,(0,j.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:[(0,j.jsx)(nh,{editor:S}),(0,j.jsx)(_N,{editor:S,labels:{open:a.linkOpen,edit:a.linkEdit,copy:a.linkCopy,copied:a.linkCopied,remove:a.linkRemove,openFailed:a.linkOpenFailed}})]}),(0,j.jsx)(`input`,{ref:p,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&i&&C(t),p.current&&(p.current.value=``)},className:`hidden`})]}):null}export{SN as BlockEditor};
|
|
184
|
+
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},bj=G.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new z({key:new B(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return At.fromSchema(this.editor.schema).parseSlice(qA(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),xj=G.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=_p.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new yj(this.editor,this.options),serializer:new vj(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[LA.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),bj.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),Sj={heading:{levels:[1,2,3,4]},link:!1,underline:!1},Cj={nested:!0},wj={autolink:!0,protocols:[`xopc`],openOnClick:!1,enableClickSelection:!0},Tj={html:!0,transformCopiedText:!0,transformPastedText:!0};function Ej(e){let t=e.storage.markdown;if(!t?.getMarkdown)throw Error(`The note editor requires the Markdown extension`);return t.getMarkdown()}var Dj=[1,1.5,2];function Oj(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function kj(e){let t=(0,dr.c)(63),{noteId:n,attachment:r,transcript:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=ue(),f=ue(jj),m=ue(Aj),h=u===n&&d===r.id,g=h&&o,v=h&&s,y=h?c:0,b=h&&l>0?l:r.duration??0,x=b>0?Math.min(y/b*100,100):0,[S,C]=(0,A.useState)(0),w=(0,A.useRef)(null),T;t[0]!==r.duration||t[1]!==r.id||t[2]!==n||t[3]!==f?(T=()=>{f(n,r.id,r.duration)},t[0]=r.duration,t[1]=r.id,t[2]=n,t[3]=f,t[4]=T):T=t[4];let E=T,D;t[5]===m?D=t[6]:(D=e=>{m(Number(e.target.value))},t[5]=m,t[6]=D);let ee=D,O;t[7]===S?O=t[8]:(O=()=>{C((S+1)%Dj.length)},t[7]=S,t[8]=O);let k=O,ne;t[9]!==h||t[10]!==S?(ne=()=>{if(!h)return;let e=document.querySelector(`audio`);e&&(e.playbackRate=Dj[S])},t[9]=h,t[10]=S,t[11]=ne):ne=t[11];let re;t[12]!==h||t[13]!==g||t[14]!==S?(re=[S,h,g],t[12]=h,t[13]=g,t[14]=S,t[15]=re):re=t[15],(0,A.useEffect)(ne,re);let ie;t[16]===a?ie=t[17]:(ie=_(`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4`,a),t[16]=a,t[17]=ie);let oe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-accent/10`,children:(0,j.jsx)(te,{className:`size-5 text-accent`})}),t[18]=oe):oe=t[18];let se=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,ce;t[19]===se?ce=t[20]:(ce=_(`flex size-8 shrink-0 items-center justify-center rounded-full transition-colors`,se),t[19]=se,t[20]=ce);let le=g?`Pause`:`Play`,de;t[21]!==v||t[22]!==g?(de=v?(0,j.jsx)(p,{className:`size-4 animate-spin`}):g?(0,j.jsx)(fe,{className:`size-4`}):(0,j.jsx)(ae,{className:`size-4 ml-0.5`}),t[21]=v,t[22]=g,t[23]=de):de=t[23];let pe;t[24]!==E||t[25]!==le||t[26]!==de||t[27]!==ce?(pe=(0,j.jsx)(`button`,{type:`button`,onClick:E,className:ce,"aria-label":le,children:de}),t[24]=E,t[25]=le,t[26]=de,t[27]=ce,t[28]=pe):pe=t[28];let me=b||1,he=`linear-gradient(to right, var(--color-accent) ${x}%, var(--color-accent-alpha-10, rgba(59,130,246,0.1)) ${x}%)`,ge;t[29]===he?ge=t[30]:(ge={background:he},t[29]=he,t[30]=ge);let _e;t[31]!==ee||t[32]!==y||t[33]!==me||t[34]!==ge?(_e=(0,j.jsx)(`input`,{ref:w,type:`range`,min:0,max:me,step:.1,value:y,onChange:ee,className:`voice-progress-range h-1.5 w-full cursor-pointer appearance-none rounded-full bg-accent/10 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent`,style:ge}),t[31]=ee,t[32]=y,t[33]=me,t[34]=ge,t[35]=_e):_e=t[35];let ve;t[36]===y?ve=t[37]:(ve=Oj(y),t[36]=y,t[37]=ve);let ye;t[38]===ve?ye=t[39]:(ye=(0,j.jsx)(`span`,{children:ve}),t[38]=ve,t[39]=ye);let be;t[40]===b?be=t[41]:(be=Oj(b),t[40]=b,t[41]=be);let xe;t[42]===be?xe=t[43]:(xe=(0,j.jsx)(`span`,{children:be}),t[42]=be,t[43]=xe);let Se;t[44]!==ye||t[45]!==xe?(Se=(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] tabular-nums text-fg-muted`,children:[ye,xe]}),t[44]=ye,t[45]=xe,t[46]=Se):Se=t[46];let Ce;t[47]!==_e||t[48]!==Se?(Ce=(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[_e,Se]}),t[47]=_e,t[48]=Se,t[49]=Ce):Ce=t[49];let we=Dj[S],Te;t[50]!==k||t[51]!==we?(Te=(0,j.jsxs)(`button`,{type:`button`,onClick:k,className:`shrink-0 rounded-md px-1.5 py-0.5 text-[11px] font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,"aria-label":`Playback speed`,children:[we,`x`]}),t[50]=k,t[51]=we,t[52]=Te):Te=t[52];let Ee;t[53]!==pe||t[54]!==Ce||t[55]!==Te?(Ee=(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[oe,(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[pe,Ce,Te]})})]}),t[53]=pe,t[54]=Ce,t[55]=Te,t[56]=Ee):Ee=t[56];let De;t[57]===i?De=t[58]:(De=i&&(0,j.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2`,children:(0,j.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:i})}),t[57]=i,t[58]=De);let Oe;return t[59]!==Ee||t[60]!==De||t[61]!==ie?(Oe=(0,j.jsxs)(`div`,{className:ie,children:[Ee,De]}),t[59]=Ee,t[60]=De,t[61]=ie,t[62]=Oe):Oe=t[62],Oe}function Aj(e){return e.seek}function jj(e){return e.toggle}function Mj(e){let t=(0,dr.c)(11),{node:n}=e,{href:r,label:i}=n.attrs,a;t[0]===r?a=t[1]:(a=he(r),t[0]=r,t[1]=a);let o=a;if(!o){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,j.jsx)(gh,{as:`span`,className:`inline text-fg-muted italic text-sm`,children:`[audio unavailable]`}),t[2]=e):e=t[2],e}let s;t[3]===i?s=t[4]:(s=i?.match(/(\d+):(\d+)/),t[3]=i,t[4]=s);let c=s,l=c?Number(c[1])*60+Number(c[2]):void 0,u;t[5]!==l||t[6]!==o.attachmentId?(u={id:o.attachmentId,type:`audio`,mimeType:`audio/webm`,fileName:``,size:0,relativePath:``,duration:l},t[5]=l,t[6]=o.attachmentId,t[7]=u):u=t[7];let d=u,f;return t[8]!==d||t[9]!==o.noteId?(f=(0,j.jsx)(gh,{className:`my-3`,children:(0,j.jsx)(kj,{noteId:o.noteId,attachment:d,className:`max-w-md`})}),t[8]=d,t[9]=o.noteId,t[10]=f):f=t[10],f}var Nj=/^\[([^\]]*)\]\((xopc-attachment:\/\/notes\/[^)]+)\)$/,Pj=K.create({name:`audioAttachment`,group:`block`,atom:!0,draggable:!1,selectable:!0,addAttributes(){return{href:{default:null},label:{default:null}}},parseHTML(){return[{tag:`a[data-audio-attachment]`,getAttrs:e=>typeof e==`string`?!1:{href:e.getAttribute(`href`),label:e.textContent}}]},renderHTML({HTMLAttributes:e}){return[`a`,W(e,{"data-audio-attachment":``}),e.label||`Audio`]},addNodeView(){return wh(Mj)},addProseMirrorPlugins(){let e=this.type;return[new z({key:new B(`audioAttachmentTransform`),appendTransaction(t,n,r){let{tr:i}=r,a=!1;return r.doc.descendants((t,n)=>{if(t.type.name!==`paragraph`||t.childCount!==1)return;let r=t.firstChild;if(!r||r.type.name!==`text`)return;let o=r.text??``,s=o.match(Nj);if(s){let r=s[1],o=s[2];if(o.includes(`xopc-attachment://notes/`)){let s=e.create({href:o,label:r});i.replaceWith(n,n+t.nodeSize,s),a=!0;return}}let c=r.marks.find(e=>e.type.name===`link`&&typeof e.attrs.href==`string`&&e.attrs.href.includes(`xopc-attachment://notes/`));if(c){let r=e.create({href:c.attrs.href,label:o});i.replaceWith(n,n+t.nodeSize,r),a=!0}}),a?i:null}})]}});function Fj(e){let t=(0,dr.c)(27),{node:n,editor:r,getPos:i}=e,a=g(Rj),o;t[0]===a?o=t[1]:(o=h(a),t[0]=a,t[1]=o);let s=o.notes,c=String(n.attrs.language??``),l;t[2]===c?l=t[3]:(l=c.toLowerCase(),t[2]=c,t[3]=l);let u=l===`mermaid`,[f,p]=(0,A.useState)(!1),m,_;t[4]!==r||t[5]!==i||t[6]!==u||t[7]!==n.nodeSize?(m=()=>{if(!u)return;let e=()=>{let e=i(),{from:t,to:a}=r.state.selection;typeof e==`number`&&t>e&&a<e+n.nodeSize&&p(!0)};return r.on(`selectionUpdate`,e),()=>{r.off(`selectionUpdate`,e)}},_=[r,i,u,n.nodeSize],t[4]=r,t[5]=i,t[6]=u,t[7]=n.nodeSize,t[8]=m,t[9]=_):(m=t[8],_=t[9]),(0,A.useEffect)(m,_);let v;t[10]===n.textContent?v=t[11]:(v="`".repeat(Math.max(3,...Array.from(n.textContent.matchAll(/`+/g),Lj))),t[10]=n.textContent,t[11]=v);let y=v,b=u?`block-editor-mermaid min-w-0`:void 0,x;t[12]!==y||t[13]!==u||t[14]!==s||t[15]!==n.textContent||t[16]!==f?(x=u&&(0,j.jsxs)(`div`,{contentEditable:!1,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-fg-muted`,children:[(0,j.jsx)(`span`,{children:`Mermaid`}),(0,j.jsx)(`button`,{type:`button`,"aria-pressed":f,className:`rounded-md px-2 py-1 hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>p(Ij),children:f?s.modePreview:s.modeSource})]}),!f&&(0,j.jsx)(d,{content:`${y}mermaid\n${n.textContent}\n${y}`,mermaidActions:!0})]}),t[12]=y,t[13]=u,t[14]=s,t[15]=n.textContent,t[16]=f,t[17]=x):x=t[17];let S=u&&!f,C=n.attrs.language?`language-${n.attrs.language}`:void 0,w;t[18]===C?w=t[19]:(w=(0,j.jsx)(hh,{as:`code`,className:C}),t[18]=C,t[19]=w);let T;t[20]!==w||t[21]!==S?(T=(0,j.jsx)(`pre`,{className:`block-editor-code`,hidden:S,children:w}),t[20]=w,t[21]=S,t[22]=T):T=t[22];let E;return t[23]!==T||t[24]!==b||t[25]!==x?(E=(0,j.jsxs)(gh,{className:b,children:[x,T]}),t[23]=T,t[24]=b,t[25]=x,t[26]=E):E=t[26],E}function Ij(e){return!e}function Lj(e){return e[0].length+1}function Rj(e){return e.language}var zj=y_.extend({addNodeView(){return wh(Fj)}});function Bj(e){let{selection:t,doc:n}=e,r=n.type.schema,i=t.from;if(t instanceof R)i=t.to;else{if(n.resolve(i).parent.isTextblock)return!0;i=Math.min(i+1,n.content.size)}let a=n.resolve(Math.min(i,n.content.size));if(a.parent.isTextblock)return e.setSelection(L.near(a,1)),!0;let o=r.nodes.paragraph;if(!o)return!1;let s=n.content.size;return e.insert(s,o.create()),e.setSelection(L.near(e.doc.resolve(s+1),1)),!0}function Vj(e){e.commands.command(({tr:e,dispatch:t})=>(t&&Bj(e),!0))}var Hj=G.create({name:`extraKeyboardShortcuts`,addKeyboardShortcuts(){return{"Mod-Shift-1":()=>this.editor.chain().focus().toggleHeading({level:1}).run(),"Mod-Shift-2":()=>this.editor.chain().focus().toggleHeading({level:2}).run(),"Mod-Shift-3":()=>this.editor.chain().focus().toggleHeading({level:3}).run(),"Mod-Shift-8":()=>this.editor.chain().focus().toggleBulletList().run(),"Mod-Shift-9":()=>this.editor.chain().focus().toggleOrderedList().run(),"Mod-Shift-0":()=>this.editor.chain().focus().toggleTaskList().run()}}});function Uj(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Bp(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function Wj(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
185
|
+
`);return/\s/.test(n)}):!1}var Gj=new B(`suggestion`);function Kj({pluginKey:e=Gj,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=Uj,shouldShow:g,shouldResetDismissed:_}){let v,y=p?.(),b=r&&!i,x=()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=t.view.coordsAtPos(e);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}},S=(n,r)=>r?()=>{let r=e.getState(t.state)?.decorationId;return n.dom.querySelector(`[data-decoration-id="${r}"]`)?.getBoundingClientRect()||null}:x,C=({match:e,dismissedRange:n,state:r,transaction:i})=>_?.({editor:t,state:r,range:n,match:e,transaction:i,allowSpaces:b})?!1:b?e.range.from===n.from:e.range.from===n.from&&!Wj(i);function w(n,r){var i;try{let r=e.getState(n.state),a=r?.decorationId?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,o={editor:t,range:r?.range||{from:0,to:0},query:r?.query||null,text:r?.text||null,items:[],command:e=>d({editor:t,range:r?.range||{from:0,to:0},props:e}),decorationNode:a,clientRect:S(n,a)};(i=y?.onExit)==null||i.call(y,o)}catch{}let a=n.state.tr.setMeta(r,{exit:!0});n.dispatch(a)}let T=new z({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,g=p||u&&h,_=h||u,b=m||u&&h;if(!g&&!_&&!b)return;let x=b&&!g?c:l,C=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);v={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:C,clientRect:S(e,C)},g&&((r=y?.onBeforeStart)==null||r.call(y,v)),_&&((i=y?.onBeforeUpdate)==null||i.call(y,v)),(_||g)&&(v.items=await f({editor:t,query:x.query})),b&&((a=y?.onExit)==null||a.call(y,v)),_&&((o=y?.onUpdate)==null||o.call(y,v)),g&&((s=y?.onStart)==null||s.call(y,v))},destroy:()=>{var e;v&&((e=y?.onExit)==null||e.call(y,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(s,c,l,u){let{isEditable:d}=t,{composing:f}=t.view,{selection:p}=s,{empty:_,from:v}=p,y={...c},b=s.getMeta(e);if(b&&b.exit)return y.active=!1,y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null,y.dismissedRange=c.active?{...c.range}:c.dismissedRange,y;if(y.composing=f,s.docChanged&&y.dismissedRange!==null&&(y.dismissedRange={from:s.mapping.map(y.dismissedRange.from),to:s.mapping.map(y.dismissedRange.to)}),d&&(_||t.view.composing)){(v<c.range.from||v>c.range.to)&&!f&&!c.composing&&(y.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:p.$from}),l=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:u,range:e.range,isActive:c.active})&&(!g||g({editor:t,range:e.range,query:e.query,text:e.text,transaction:s}))?(y.dismissedRange!==null&&!C({match:e,dismissedRange:y.dismissedRange,state:u,transaction:s})&&(y.dismissedRange=null),y.dismissedRange===null?(y.active=!0,y.decorationId=c.decorationId?c.decorationId:l,y.range=e.range,y.query=e.query,y.text=e.text):y.active=!1):(e||(y.dismissedRange=null),y.active=!1)}else y.active=!1;return y.active||(y.decorationId=null,y.range={from:0,to:0},y.query=null,y.text=null),y}},props:{handleKeyDown(t,n){var r;let{active:i,range:a}=T.getState(t.state);if(!i)return!1;if(n.key===`Escape`||n.key===`Esc`){let i=T.getState(t.state);return(r=y?.onKeyDown)==null||r.call(y,{view:t,event:n,range:i.range}),w(t,e),!0}return(y?.onKeyDown)?.call(y,{view:t,event:n,range:a})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=T.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),bl.create(e.doc,[_l.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return T}var qj=Kj,Jj=[{id:`heading1`,label:`Heading 1`,description:`Large section heading`,keywords:[`h1`,`title`,`heading`]},{id:`heading2`,label:`Heading 2`,description:`Medium section heading`,keywords:[`h2`,`heading`]},{id:`heading3`,label:`Heading 3`,description:`Small section heading`,keywords:[`h3`,`heading`]},{id:`bulletList`,label:`Bullet List`,description:`Unordered list`,keywords:[`ul`,`list`,`bullet`]},{id:`orderedList`,label:`Numbered List`,description:`Ordered list`,keywords:[`ol`,`list`,`numbered`]},{id:`taskList`,label:`Task List`,description:`List with checkboxes`,keywords:[`todo`,`task`,`checkbox`]},{id:`blockquote`,label:`Quote`,description:`Block quotation`,keywords:[`quote`,`blockquote`]},{id:`codeBlock`,label:`Code Block`,description:`Fenced code snippet`,keywords:[`code`,`snippet`]},{id:`divider`,label:`Divider`,description:`Horizontal rule`,keywords:[`hr`,`rule`,`line`]},{id:`image`,label:`Image`,description:`Upload an image`,keywords:[`img`,`photo`,`picture`]}];function Yj(e){let t=e.trim().toLowerCase();return t?Jj.filter(e=>[e.label,e.description,...e.keywords].join(` `).toLowerCase().includes(t)):Jj}function Xj(e,t,n,r){if(e.id===`image`){t.chain().focus().deleteRange(n).run(),r.requestImagePicker&&setTimeout(()=>r.requestImagePicker?.(),0);return}let i=t.chain().focus().deleteRange(n);switch(e.id){case`heading1`:i.setHeading({level:1}).run();return;case`heading2`:i.setHeading({level:2}).run();return;case`heading3`:i.setHeading({level:3}).run();return;case`bulletList`:i.toggleBulletList().run();return;case`orderedList`:i.toggleOrderedList().run();return;case`taskList`:i.toggleTaskList().run();return;case`blockquote`:i.toggleBlockquote().run();return;case`codeBlock`:i.toggleCodeBlock().run();return;case`divider`:i.setHorizontalRule().run(),Vj(t);return;default:return}}var Zj=`slash-menu-panel fixed z-[9999] w-64 overflow-hidden rounded-lg border border-edge bg-surface-base shadow-lg`,Qj=`flex w-full items-center gap-3 rounded-md px-2.5 py-2 text-left transition-colors text-fg-muted hover:bg-surface-hover hover:text-fg`,$j=`bg-surface-hover text-fg`;function eM({editor:e,getRuntime:t}){let n=null,r=null,i=null,a=null,o=0,s=``,c=null,l=()=>{n?.remove(),n=null,r=null,i=null,a=null,c=null,o=0,s=``},u=()=>{n||(n=document.createElement(`div`),n.setAttribute(`data-slash-menu-root`,`true`),r=document.createElement(`div`),r.className=Zj,i=document.createElement(`div`),i.className=`slash-menu-scroll max-h-72 overflow-y-auto p-1`,a=document.createElement(`input`),a.type=`file`,a.accept=`image/*`,a.className=`hidden`,a.addEventListener(`change`,()=>{let e=a?.files?.[0],n=t();e&&n.onImageUpload&&n.onImageUpload(e),a&&(a.value=``)}),r.appendChild(i),n.append(r,a),document.body.appendChild(n))},d=()=>{if(!r||!c)return;let e=c.clientRect?.()??null;if(e){r.style.top=`${e.bottom+6}px`,r.style.left=`${e.left}px`;return}let t=c.editor.view.coordsAtPos(c.range.to);r.style.top=`${t.bottom+6}px`,r.style.left=`${t.left}px`},f=()=>{if(!c||!i||!r)return;i.replaceChildren();let e=i;c.items.forEach((n,r)=>{let i=document.createElement(`button`);i.type=`button`,i.className=`${Qj}${r===o?` ${$j}`:``}`;let s=document.createElement(`span`);s.className=`flex size-8 shrink-0 items-center justify-center rounded-md border border-edge bg-surface-raised text-xs font-semibold uppercase text-fg-muted`,s.textContent=n.label.slice(0,2);let l=document.createElement(`span`);l.className=`min-w-0 flex-1`;let u=document.createElement(`span`);u.className=`block truncate text-sm font-medium text-fg`,u.textContent=n.label;let d=document.createElement(`span`);d.className=`block truncate text-xs text-fg-muted`,d.textContent=n.description,l.append(u,d),i.append(s,l),i.addEventListener(`mousedown`,e=>{if(e.preventDefault(),c){if(n.id===`image`){Xj(n,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())});return}c.command(n)}}),e.appendChild(i)}),d()},p=e=>{e.query!==s&&(o=0,s=e.query),c=e,u(),f()};return e.on(`destroy`,l),{onStart:e=>{p(e)},onUpdate:e=>{p(e)},onExit:()=>{l()},onKeyDown:({event:e})=>{let n=c?.items??[];if(!n.length)return!1;if(e.key===`ArrowDown`)return o=(o+1)%n.length,f(),!0;if(e.key===`ArrowUp`)return o=(o-1+n.length)%n.length,f(),!0;if(e.key===`Enter`){let e=n[o];return e&&c&&(e.id===`image`?Xj(e,c.editor,c.range,{...t(),requestImagePicker:t().requestImagePicker??(()=>a?.click())}):c.command(e)),!0}return!1},destroy:l}}var tM=new B(`slashCommands`),nM=G.create({name:`slashCommands`,addOptions(){return{getRuntime:()=>({})}},addStorage(){return{active:!1}},onDestroy(){this.storage.active=!1},addProseMirrorPlugins(){let e=this,t=eM({editor:this.editor,getRuntime:()=>e.options.getRuntime()});return[qj({pluginKey:tM,editor:this.editor,char:`/`,allowedPrefixes:null,items:({query:e})=>Yj(e),command:({editor:t,range:n,props:r})=>{Xj(r,t,n,e.options.getRuntime())},render:()=>({onStart:n=>{e.storage.active=!0,t.onStart(n)},onUpdate:e=>{t.onUpdate(e)},onExit:()=>{e.storage.active=!1,t.onExit()},onKeyDown:t.onKeyDown})})]}}),rM=iE.configure({node:`paragraph`,notAfter:[`paragraph`]});function iM(e){let t=String(e.getAttributes(`link`).href??``),n=window.prompt(`URL`,t);if(n!==null){if(!n.trim()){e.chain().focus().extendMarkRange(`link`).unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:n.trim()}).run()}}function aM(e){return!e.metaKey&&!e.ctrlKey?null:(e.target instanceof Element?e.target:null)?.closest(`a[href]`)?.getAttribute(`href`)?.trim()||null}function oM(e){let t=(0,dr.c)(9),{onClick:n,isActive:r,disabled:i,title:a,children:o}=e,s=r&&`bg-surface-hover text-accent`,c=i&&`pointer-events-none opacity-40`,l;t[0]!==s||t[1]!==c?(l=_(`rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,s,c),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==l||t[7]!==a?(u=(0,j.jsx)(`button`,{type:`button`,onClick:n,disabled:i,title:a,className:l,children:o}),t[3]=o,t[4]=i,t[5]=n,t[6]=l,t[7]=a,t[8]=u):u=t[8],u}function sM(){let e=(0,dr.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,j.jsx)(`div`,{className:`mx-1 h-5 w-px bg-edge`}),e[0]=t):t=e[0],t}function cM(e){let t=(0,dr.c)(131),{editor:n,onImageUpload:r,imageUploading:i}=e,a=i===void 0?!1:i,o=(0,A.useRef)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o.current?.click()},t[0]=s):s=t[0];let c=s,l;t[1]!==a||t[2]!==r?(l=e=>{let t=e.target.files?.[0];t&&r&&!a&&r(t),o.current&&(o.current.value=``)},t[1]=a,t[2]=r,t[3]=l):l=t[3];let d=l,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>n.chain().focus().undo().run(),p=n.can().undo(),t[4]=n,t[5]=f,t[6]=p);let m=!p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,j.jsx)(Se,{size:16}),t[7]=h):h=t[7];let g;t[8]!==f||t[9]!==m?(g=(0,j.jsx)(oM,{onClick:f,disabled:m,title:`Undo`,children:h}),t[8]=f,t[9]=m,t[10]=g):g=t[10];let _,v;t[11]===n?(_=t[12],v=t[13]):(v=()=>n.chain().focus().redo().run(),_=n.can().redo(),t[11]=n,t[12]=_,t[13]=v);let y=!_,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,j.jsx)(_e,{size:16}),t[14]=b):b=t[14];let x;t[15]!==y||t[16]!==v?(x=(0,j.jsx)(oM,{onClick:v,disabled:y,title:`Redo`,children:b}),t[15]=y,t[16]=v,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,j.jsx)(sM,{}),t[18]=S):S=t[18];let C,w;t[19]===n?(C=t[20],w=t[21]):(C=()=>n.chain().focus().toggleHeading({level:1}).run(),w=n.isActive(`heading`,{level:1}),t[19]=n,t[20]=C,t[21]=w);let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,j.jsx)(ye,{size:16}),t[22]=T):T=t[22];let E;t[23]!==C||t[24]!==w?(E=(0,j.jsx)(oM,{onClick:C,isActive:w,title:`Heading 1`,children:T}),t[23]=C,t[24]=w,t[25]=E):E=t[25];let D,te;t[26]===n?(D=t[27],te=t[28]):(D=()=>n.chain().focus().toggleHeading({level:2}).run(),te=n.isActive(`heading`,{level:2}),t[26]=n,t[27]=D,t[28]=te);let O;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,j.jsx)(de,{size:16}),t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==te?(k=(0,j.jsx)(oM,{onClick:D,isActive:te,title:`Heading 2`,children:O}),t[30]=D,t[31]=te,t[32]=k):k=t[32];let ie,ae;t[33]===n?(ie=t[34],ae=t[35]):(ie=()=>n.chain().focus().toggleHeading({level:3}).run(),ae=n.isActive(`heading`,{level:3}),t[33]=n,t[34]=ie,t[35]=ae);let se;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,j.jsx)(xe,{size:16}),t[36]=se):se=t[36];let ue;t[37]!==ie||t[38]!==ae?(ue=(0,j.jsx)(oM,{onClick:ie,isActive:ae,title:`Heading 3`,children:se}),t[37]=ie,t[38]=ae,t[39]=ue):ue=t[39];let fe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,j.jsx)(sM,{}),t[40]=fe):fe=t[40];let pe,he;t[41]===n?(pe=t[42],he=t[43]):(pe=()=>n.chain().focus().toggleBold().run(),he=n.isActive(`bold`),t[41]=n,t[42]=pe,t[43]=he);let Ce;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,j.jsx)(ve,{size:16}),t[44]=Ce):Ce=t[44];let we;t[45]!==pe||t[46]!==he?(we=(0,j.jsx)(oM,{onClick:pe,isActive:he,title:`Bold (⌘B)`,children:Ce}),t[45]=pe,t[46]=he,t[47]=we):we=t[47];let Te,Ee;t[48]===n?(Te=t[49],Ee=t[50]):(Te=()=>n.chain().focus().toggleItalic().run(),Ee=n.isActive(`italic`),t[48]=n,t[49]=Te,t[50]=Ee);let De;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,j.jsx)(ge,{size:16}),t[51]=De):De=t[51];let Oe;t[52]!==Te||t[53]!==Ee?(Oe=(0,j.jsx)(oM,{onClick:Te,isActive:Ee,title:`Italic (⌘I)`,children:De}),t[52]=Te,t[53]=Ee,t[54]=Oe):Oe=t[54];let M,ke;t[55]===n?(M=t[56],ke=t[57]):(M=()=>n.chain().focus().toggleStrike().run(),ke=n.isActive(`strike`),t[55]=n,t[56]=M,t[57]=ke);let Ae;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(re,{size:16}),t[58]=Ae):Ae=t[58];let je;t[59]!==M||t[60]!==ke?(je=(0,j.jsx)(oM,{onClick:M,isActive:ke,title:`Strikethrough`,children:Ae}),t[59]=M,t[60]=ke,t[61]=je):je=t[61];let Me,N;t[62]===n?(Me=t[63],N=t[64]):(Me=()=>n.chain().focus().toggleCode().run(),N=n.isActive(`code`),t[62]=n,t[63]=Me,t[64]=N);let Ne;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(oe,{size:16}),t[65]=Ne):Ne=t[65];let Pe;t[66]!==Me||t[67]!==N?(Pe=(0,j.jsx)(oM,{onClick:Me,isActive:N,title:`Inline code`,children:Ne}),t[66]=Me,t[67]=N,t[68]=Pe):Pe=t[68];let Fe,P;t[69]===n?(Fe=t[70],P=t[71]):(Fe=()=>iM(n),P=n.isActive(`link`),t[69]=n,t[70]=Fe,t[71]=P);let Ie;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,j.jsx)(ee,{size:16}),t[72]=Ie):Ie=t[72];let F;t[73]!==Fe||t[74]!==P?(F=(0,j.jsx)(oM,{onClick:Fe,isActive:P,title:`Link`,children:Ie}),t[73]=Fe,t[74]=P,t[75]=F):F=t[75];let Le;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,j.jsx)(sM,{}),t[76]=Le):Le=t[76];let Re,ze;t[77]===n?(Re=t[78],ze=t[79]):(Re=()=>n.chain().focus().toggleBulletList().run(),ze=n.isActive(`bulletList`),t[77]=n,t[78]=Re,t[79]=ze);let Be;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,j.jsx)(ne,{size:16}),t[80]=Be):Be=t[80];let Ve;t[81]!==Re||t[82]!==ze?(Ve=(0,j.jsx)(oM,{onClick:Re,isActive:ze,title:`Bullet list`,children:Be}),t[81]=Re,t[82]=ze,t[83]=Ve):Ve=t[83];let He,Ue;t[84]===n?(He=t[85],Ue=t[86]):(He=()=>n.chain().focus().toggleOrderedList().run(),Ue=n.isActive(`orderedList`),t[84]=n,t[85]=He,t[86]=Ue);let We;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,j.jsx)(le,{size:16}),t[87]=We):We=t[87];let Ge;t[88]!==He||t[89]!==Ue?(Ge=(0,j.jsx)(oM,{onClick:He,isActive:Ue,title:`Ordered list`,children:We}),t[88]=He,t[89]=Ue,t[90]=Ge):Ge=t[90];let Ke,qe;t[91]===n?(Ke=t[92],qe=t[93]):(Ke=()=>n.chain().focus().toggleTaskList().run(),qe=n.isActive(`taskList`),t[91]=n,t[92]=Ke,t[93]=qe);let Je;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,j.jsx)(ce,{size:16}),t[94]=Je):Je=t[94];let Ye;t[95]!==Ke||t[96]!==qe?(Ye=(0,j.jsx)(oM,{onClick:Ke,isActive:qe,title:`Task list`,children:Je}),t[95]=Ke,t[96]=qe,t[97]=Ye):Ye=t[97];let Xe,Ze;t[98]===n?(Xe=t[99],Ze=t[100]):(Xe=()=>n.chain().focus().toggleBlockquote().run(),Ze=n.isActive(`blockquote`),t[98]=n,t[99]=Xe,t[100]=Ze);let Qe;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,j.jsx)(be,{size:16}),t[101]=Qe):Qe=t[101];let $e;t[102]!==Xe||t[103]!==Ze?($e=(0,j.jsx)(oM,{onClick:Xe,isActive:Ze,title:`Quote`,children:Qe}),t[102]=Xe,t[103]=Ze,t[104]=$e):$e=t[104];let et;t[105]===n?et=t[106]:(et=()=>{n.chain().focus().setHorizontalRule().run(),Vj(n)},t[105]=n,t[106]=et);let tt;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,j.jsx)(u,{size:16}),t[107]=tt):tt=t[107];let nt;t[108]===et?nt=t[109]:(nt=(0,j.jsx)(oM,{onClick:et,title:`Divider`,children:tt}),t[108]=et,t[109]=nt);let rt;t[110]!==d||t[111]!==a||t[112]!==r?(rt=r&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(sM,{}),(0,j.jsx)(oM,{onClick:c,disabled:a,title:a?`Uploading…`:`Insert image`,children:(0,j.jsx)(me,{size:16,className:a?`animate-pulse`:void 0})}),(0,j.jsx)(`input`,{ref:o,type:`file`,accept:`image/*`,onChange:d,className:`hidden`})]}),t[110]=d,t[111]=a,t[112]=r,t[113]=rt):rt=t[113];let it;return t[114]!==x||t[115]!==E||t[116]!==k||t[117]!==ue||t[118]!==we||t[119]!==Oe||t[120]!==je||t[121]!==Pe||t[122]!==F||t[123]!==Ve||t[124]!==Ge||t[125]!==Ye||t[126]!==$e||t[127]!==nt||t[128]!==rt||t[129]!==g?(it=(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5 border-b border-edge px-3 py-1.5`,children:[g,x,S,E,k,ue,fe,we,Oe,je,Pe,F,Le,Ve,Ge,Ye,$e,nt,rt]}),t[114]=x,t[115]=E,t[116]=k,t[117]=ue,t[118]=we,t[119]=Oe,t[120]=je,t[121]=Pe,t[122]=F,t[123]=Ve,t[124]=Ge,t[125]=Ye,t[126]=$e,t[127]=nt,t[128]=rt,t[129]=g,t[130]=it):it=t[130],it}var lM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uM=K.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,W(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=W(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new Rp({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Pp({find:lM,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}});function dM(e){let t=(0,dr.c)(28),{node:n,updateAttributes:r,selected:i}=e,{src:a,alt:o,title:s}=n.attrs,{openImage:c}=Ee(),[l,u]=(0,A.useState)(!1),d=(0,A.useRef)(null),[f,p]=(0,A.useState)(!1),m=(0,A.useRef)(0),h=(0,A.useRef)(0),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),e.stopPropagation(),p(!0),m.current=e.clientX,h.current=d.current?.offsetWidth??400},t[0]=g):g=t[0];let v=g,y,b;t[1]!==f||t[2]!==r?(y=()=>{if(!f)return;let e=e=>{let t=e.clientX-m.current;r({width:Math.max(100,h.current+t)})},t=()=>{p(!1)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},b=[f,r],t[1]=f,t[2]=r,t[3]=y,t[4]=b):(y=t[3],b=t[4]),(0,A.useEffect)(y,b);let x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{u(!1)},t[5]=x):x=t[5];let S;t[6]===a?S=t[7]:(S=[a],t[6]=a,t[7]=S),(0,A.useEffect)(x,S);let C=n.attrs.width,w=i&&`ring-2 ring-accent ring-offset-2 ring-offset-surface-base rounded-lg`,T;t[8]===w?T=t[9]:(T=_(`relative inline-block`,w),t[8]=w,t[9]=T);let E=C?`${C}px`:void 0,D;t[10]===E?D=t[11]:(D={width:E,maxWidth:`100%`},t[10]=E,t[11]=D);let ee;t[12]!==o||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==s?(ee=l?(0,j.jsx)(`div`,{className:`flex min-h-24 min-w-[12rem] items-center justify-center rounded-lg border border-dashed border-edge bg-surface-hover text-fg-muted`,children:(0,j.jsx)(`span`,{className:`text-xs`,children:`Image unavailable`})}):(0,j.jsx)(se,{src:a,alt:o??``,title:s??void 0,className:`block h-auto w-full cursor-zoom-in rounded-lg`,draggable:!1,onClick:e=>c(e,o??void 0),onLoadFailed:()=>u(!0)}),t[12]=o,t[13]=l,t[14]=c,t[15]=a,t[16]=s,t[17]=ee):ee=t[17];let te=(i||f)&&`opacity-100`,O;t[18]===te?O=t[19]:(O=_(`absolute bottom-1 right-1 size-4 cursor-se-resize rounded-sm opacity-0 transition-opacity`,`bg-accent/70 hover:bg-accent`,te),t[18]=te,t[19]=O);let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,j.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,className:`m-0.5 text-white`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,j.jsx)(`path`,{d:`M10 2L2 10M10 6L6 10M10 10L10 10`,strokeLinecap:`round`})}),t[20]=k):k=t[20];let ne;t[21]===O?ne=t[22]:(ne=(0,j.jsx)(`div`,{onMouseDown:v,className:O,title:`Drag to resize`,children:k}),t[21]=O,t[22]=ne);let re;return t[23]!==ee||t[24]!==ne||t[25]!==T||t[26]!==D?(re=(0,j.jsx)(gh,{className:`block-editor-image-wrapper`,children:(0,j.jsxs)(`div`,{ref:d,className:T,style:D,children:[ee,ne]})}),t[23]=ee,t[24]=ne,t[25]=T,t[26]=D,t[27]=re):re=t[27],re}var fM=uM.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{let t=e.getAttribute(`width`)||e.style.width;return t?parseInt(t,10):null},renderHTML:e=>e.width?{width:e.width,style:`width: ${e.width}px`}:{}}}},addNodeView(){return wh(dM)}}),pM,mM;if(typeof WeakMap<`u`){let e=new WeakMap;pM=t=>e.get(t),mM=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;pM=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},mM=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var hM=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return pM(e)||mM(e,gM(e))}};function gM(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=_M(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new hM(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&vM(s,o,e),s}function _M(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function vM(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=yM(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function yM(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function bM(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}new B(`selectingCells`);function xM(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function SM(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function CM(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=xM(t.$head)||wM(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function wM(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function TM(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function EM(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function DM(e,t,n){let r=e.node(-1),i=hM.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function OM(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}var kM=class e extends I{constructor(e,t=e){let n=e.node(-1),r=hM.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Ei(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(TM(r)&&TM(i)&&EM(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return L.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=hM.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=OM(e,0,l)),u>0&&(e=OM(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(N.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new F(N.from(o),1,1)}replace(e,t=F.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?F.empty:t)}let i=I.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new F(N.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=hM.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=hM.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=hM.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=hM.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new AM(this.$anchorCell.pos,this.$headCell.pos)}};kM.prototype.visible=!1,I.jsonID(`cell`,kM);var AM=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&EM(t,n)?new kM(t,n):I.near(n,1)}};new B(`fix-tables`);function jM(e){let t=e.selection,n=CM(e),r=n.node(-1),i=n.start(-1),a=hM.get(r);return{...t instanceof kM?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function MM(e){return function(t,n){if(!SM(t))return!1;if(n){let r=bM(t.schema),i=jM(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function NM(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function PM(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?MM(e):function(t,n){if(!SM(t))return!1;if(n){let r=bM(t.schema),i=jM(t),a=t.tr,o=NM(`row`,i,r),s=NM(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}PM(`row`,{useDeprecatedLogic:!0}),PM(`column`,{useDeprecatedLogic:!0}),PM(`cell`,{useDeprecatedLogic:!0});function FM(e,t){let n=e.selection;if(!(n instanceof kM))return!1;if(t){let r=e.tr,i=bM(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new F(i,0,0))}),r.docChanged&&t(r)}return!0}mu({ArrowLeft:LM(`horiz`,-1),ArrowRight:LM(`horiz`,1),ArrowUp:LM(`vert`,-1),ArrowDown:LM(`vert`,1),"Shift-ArrowLeft":RM(`horiz`,-1),"Shift-ArrowRight":RM(`horiz`,1),"Shift-ArrowUp":RM(`vert`,-1),"Shift-ArrowDown":RM(`vert`,1),Backspace:FM,"Mod-Backspace":FM,Delete:FM,"Mod-Delete":FM});function IM(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function LM(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof kM)return IM(n,r,I.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=zM(i,e,t);if(o==null)return!1;if(e==`horiz`)return IM(n,r,I.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=DM(i,e,t),s;return s=a?I.near(a,1):t<0?I.near(n.doc.resolve(i.before(-1)),-1):I.near(n.doc.resolve(i.after(-1)),1),IM(n,r,s)}}}function RM(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof kM)o=a;else{let r=zM(i,e,t);if(r==null)return!1;o=new kM(n.doc.resolve(r))}let s=DM(o.$headCell,e,t);return s?IM(n,r,new kM(o.$anchorCell,s)):!1}}function zM(e,t,n){if(!(e.state.selection instanceof L))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}new B(`tableColumnResizing`);function BM(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var VM=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&Uu(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(y(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(D(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(S(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(E(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(b(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(C(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(w(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(T(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Df(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof R){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof kM){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():BM(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&x(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},HM=e=>new z({key:typeof e.pluginKey==`string`?new B(e.pluginKey):e.pluginKey,view:t=>new VM({view:t,...e})});G.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[HM({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var UM=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return nf(e,{textSerializers:rf(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(y(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(D(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(S(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(E(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(b(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(C(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(w(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(T(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Df(this.view,e.from,e.to);x({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},WM=e=>new z({key:typeof e.pluginKey==`string`?new B(e.pluginKey):e.pluginKey,view:t=>new UM({view:t,...e})});G.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[WM({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function GM(e,t){return e??new B(t)}var KM=typeof window<`u`?A.useLayoutEffect:A.useEffect,qM=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),JM=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),YM=new Set([`children`,`className`,`style`]),XM=new Set([`tabIndex`]),ZM=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),QM={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function $M(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function eN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function tN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||ZM.has(e)}function nN(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function rN(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:QM[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function iN(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function aN(e){return XM.has(e)}function oN(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function sN(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function cN(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||JM.has(e)?String(t):`${t}px`}function lN(e,t){qM.has(t)||e.style.removeProperty(nN(t))}function uN(e,t,n){qM.has(t)||e.style.setProperty(nN(t),cN(t,n))}function dN(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(YM.has(r)||!tN(r)||$M(r,t[r])||$M(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=eN(r);if(a==null||a===!1){aN(r)&&sN(e,r),e.removeAttribute(o);return}if(a===!0){aN(r)&&oN(e,r,!0),e.setAttribute(o,``);return}if(aN(r)){oN(e,r,a);return}e.setAttribute(o,String(a))})}function fN(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function pN(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){lN(e,t);return}uN(e,t,a)}})}function mN(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!$M(t,n))return;let{eventName:i,options:a}=rN(t),o=t=>{n(iN(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function hN(e,t){let n=(0,A.useRef)({}),r=(0,A.useRef)([]);KM(()=>{let i=n.current;return fN(e,i.className,t.className),pN(e,i.style,t.style),dN(e,i,t),r.current=mN(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var gN=A.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,A.useRef)(document.createElement(`div`)),f=(0,A.useRef)(GM(e,`bubbleMenu`)).current;hN(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=fh(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,A.useRef)(h);g.current=h;let[_,v]=(0,A.useState)(!1),y=(0,A.useRef)(!0);return(0,A.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=HM({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,A.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,De.createPortal)(c,d.current)});A.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,A.useRef)(document.createElement(`div`)),d=(0,A.useRef)(GM(e,`floatingMenu`)).current;hN(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=fh(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,A.useRef)(m);h.current=m;let[g,_]=(0,A.useState)(!1),v=(0,A.useRef)(!0);return(0,A.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=WM({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,A.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,De.createPortal)(s,u.current)});function _N(e){let t=(0,dr.c)(49),{editor:n,labels:r}=e,i=f(),[a,o]=(0,A.useState)(!1),[u,d]=(0,A.useState)(null),p;t[0]===n?p=t[1]:(p={editor:n,selector:yN},t[0]=n,t[1]=p);let h=ah(p),g;t[2]!==h||t[3]!==r.openFailed||t[4]!==i?(g=async()=>{d(null),(await i(h)).ok||d(r.openFailed)},t[2]=h,t[3]=r.openFailed,t[4]=i,t[5]=g):g=t[5];let _=g,v;t[6]===h?v=t[7]:(v=async()=>{await m(h)&&(o(!0),window.setTimeout(()=>o(!1),1500))},t[6]=h,t[7]=v);let y=v,b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b={placement:`bottom`,offset:8},t[8]=b):b=t[8];let x;t[9]===h?x=t[10]:(x=(0,j.jsx)(`p`,{className:`max-w-xs truncate px-1 pb-2 text-xs text-fg-muted`,title:h,children:h}),t[9]=h,t[10]=x);let S;t[11]===_?S=t[12]:(S=()=>void _(),t[11]=_,t[12]=S);let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,j.jsx)(l,{}),t[13]=C):C=t[13];let w;t[14]!==r.open||t[15]!==S?(w=(0,j.jsx)(bN,{label:r.open,onClick:S,children:C}),t[14]=r.open,t[15]=S,t[16]=w):w=t[16];let T;t[17]===n?T=t[18]:(T=()=>iM(n),t[17]=n,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,j.jsx)(pe,{}),t[19]=E):E=t[19];let D;t[20]!==r.edit||t[21]!==T?(D=(0,j.jsx)(bN,{label:r.edit,onClick:T,children:E}),t[20]=r.edit,t[21]=T,t[22]=D):D=t[22];let ee=a?r.copied:r.copy,te;t[23]===y?te=t[24]:(te=()=>void y(),t[23]=y,t[24]=te);let O;t[25]===a?O=t[26]:(O=a?(0,j.jsx)(s,{}):(0,j.jsx)(c,{}),t[25]=a,t[26]=O);let k;t[27]!==ee||t[28]!==te||t[29]!==O?(k=(0,j.jsx)(bN,{label:ee,onClick:te,children:O}),t[27]=ee,t[28]=te,t[29]=O,t[30]=k):k=t[30];let ne;t[31]===n?ne=t[32]:(ne=()=>n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t[31]=n,t[32]=ne);let re;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,j.jsx)(ie,{}),t[33]=re):re=t[33];let ae;t[34]!==r.remove||t[35]!==ne?(ae=(0,j.jsx)(bN,{label:r.remove,onClick:ne,children:re}),t[34]=r.remove,t[35]=ne,t[36]=ae):ae=t[36];let oe;t[37]!==D||t[38]!==k||t[39]!==ae||t[40]!==w?(oe=(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[w,D,k,ae]}),t[37]=D,t[38]=k,t[39]=ae,t[40]=w,t[41]=oe):oe=t[41];let se;t[42]===u?se=t[43]:(se=u?(0,j.jsx)(`p`,{className:`px-1 pt-2 text-xs text-danger`,role:`alert`,children:u}):null,t[42]=u,t[43]=se);let ce;return t[44]!==n||t[45]!==oe||t[46]!==se||t[47]!==x?(ce=(0,j.jsxs)(gN,{editor:n,shouldShow:vN,options:b,className:`max-w-sm rounded-lg border border-edge bg-surface-panel p-2 shadow-xl`,children:[x,oe,se]}),t[44]=n,t[45]=oe,t[46]=se,t[47]=x,t[48]=ce):ce=t[48],ce}function vN(e){let{editor:t}=e;return t.isActive(`link`)}function yN(e){let{editor:t}=e;return String(t.getAttributes(`link`).href??``)}function bN(e){let t=(0,dr.c)(9),{children:n,label:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,j.jsx)(`span`,{className:`[&_svg]:size-3.5`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,j.jsx)(`span`,{children:r}),t[2]=r,t[3]=o);let s;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==o?(s=(0,j.jsxs)(`button`,{type:`button`,onClick:i,title:r,"aria-label":r,className:`inline-flex items-center gap-1 rounded-md px-2 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[a,o]}),t[4]=r,t[5]=i,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function xN(e,t){let{doc:n}=e.state,r=n.resolve(t);return r.index(0)===0?`first`:r.index(0)===n.childCount-1?`last`:null}function SN({initialContent:e,onChange:t,placeholder:n=`Start writing, or type "/" for commands…`,className:r,noteId:i}){let a=h(g(e=>e.language)).notes,o=f(),[s,c]=(0,A.useState)(!1),[l,u]=(0,A.useState)(null),d=(0,A.useRef)(t);d.current=t;let p=(0,A.useRef)(null),m=(0,A.useRef)({}),v=(0,A.useRef)(()=>void 0),y=(0,A.useRef)(e),b=(0,A.useRef)(e),x=(0,A.useRef)(!1),S=uh({extensions:[oE.configure({...Sj,codeBlock:!1}),zj.configure({HTMLAttributes:{class:`block-editor-code`}}),rM,fM.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:`block-editor-image`}}),sE,cE.configure(Cj),lE.configure({placeholder:({editor:e,node:t,pos:r})=>{if(t.type.name!==`paragraph`||t.content.size>0)return``;let i=xN(e,r);return i===`first`||i===`last`?n:``},includeChildren:!0}),Vy.configure({...wj,HTMLAttributes:{class:`block-editor-link`}}),xj.configure(Tj),Pj,Hj,nM.configure({getRuntime:()=>m.current})],content:``,onUpdate:({editor:e})=>{let t=Ej(e);y.current=t,b.current=t,d.current(t)},editorProps:{attributes:{class:`block-editor-content`},handlePaste:(e,t)=>{let n=t.clipboardData?.items;if(!n)return!1;for(let e of n)if(e.type.startsWith(`image/`)){t.preventDefault();let n=e.getAsFile();return n&&v.current(n),!0}return!1},handleClick:(e,t,n)=>{let r=aM(n);return r?(n.preventDefault(),o(r),!0):!1},handleDrop:(e,t)=>{let n=t.dataTransfer?.files;if(!n?.length)return!1;for(let e of n)if(e.type.startsWith(`image/`))return t.preventDefault(),v.current(e),!0;return!1}}}),C=(0,A.useCallback)(async e=>{if(!(!i||!S))try{c(!0),u(null);let t=await k(i,e);S.chain().focus().setImage({src:O(i,t.id),alt:e.name}).run(),Vj(S)}catch(e){u(e instanceof Error?e.message:a.imageUploadFailedHint)}finally{c(!1)}},[S,i,a.imageUploadFailed,a.imageUploadFailedHint]);v.current=e=>{C(e)};let w=(0,A.useCallback)(()=>{p.current?.click()},[]);return m.current={onImageUpload:i?C:void 0,requestImagePicker:i?w:void 0},(0,A.useEffect)(()=>{if(!S)return;let t=e!==y.current,n=y.current===b.current;if(x.current&&(!t||!n))return;let r=!1,i=null,a=e,o=()=>{if(!(r||S.isDestroyed)){if(!S.isEditorContentInitialized){i=window.requestAnimationFrame(o);return}S.commands.setContent(a,{emitUpdate:!1}),y.current=a,b.current=a,x.current=!0}};return o(),()=>{r=!0,i!==null&&window.cancelAnimationFrame(i)}},[S,e]),S?(0,j.jsxs)(`div`,{className:_(`flex h-full flex-col overflow-hidden`,r),children:[(0,j.jsx)(cM,{editor:S,onImageUpload:i?C:void 0,imageUploading:s}),l?(0,j.jsxs)(`div`,{className:`border-b border-danger/20 bg-danger-soft px-6 py-2 text-xs text-danger`,role:`alert`,children:[(0,j.jsx)(`span`,{className:`font-medium`,children:a.imageUploadFailed}),` · `,l]}):null,(0,j.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:[(0,j.jsx)(nh,{editor:S}),(0,j.jsx)(_N,{editor:S,labels:{open:a.linkOpen,edit:a.linkEdit,copy:a.linkCopy,copied:a.linkCopied,remove:a.linkRemove,openFailed:a.linkOpenFailed}})]}),(0,j.jsx)(`input`,{ref:p,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&i&&C(t),p.current&&(p.current.value=``)},className:`hidden`})]}):null}export{SN as BlockEditor};
|