From 55da0369049d05e7cb632967aedbb5c1ceb12973 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 18 Dec 2023 12:14:45 +0800 Subject: [PATCH] refactor: refactor ai module --- demos/docs-ts/dist/assets/index-007e5dcb.css | 1 + .../{index-1eb550dd.js => index-a9c8b2b1.js} | 230 +++++++++--------- demos/docs-ts/dist/assets/index-f350fe0a.css | 1 - demos/docs-ts/dist/index.html | 194 ++++++++------- .../bubbles/TextSelectionBubbleMenu.ts | 17 +- 5 files changed, 235 insertions(+), 208 deletions(-) create mode 100644 demos/docs-ts/dist/assets/index-007e5dcb.css rename demos/docs-ts/dist/assets/{index-1eb550dd.js => index-a9c8b2b1.js} (67%) delete mode 100644 demos/docs-ts/dist/assets/index-f350fe0a.css diff --git a/demos/docs-ts/dist/assets/index-007e5dcb.css b/demos/docs-ts/dist/assets/index-007e5dcb.css new file mode 100644 index 0000000..c0e8aa6 --- /dev/null +++ b/demos/docs-ts/dist/assets/index-007e5dcb.css @@ -0,0 +1 @@ +:root,:root .aie-theme-light{--aie-text-color: #333;--aie-text-placeholder-color: #adb5bd;--aie-bg-color: #fff;--aie-container-border: #e9e9e9;--aie-pre-bg-color: #f6f6f7;--aie-blockquote-bg-color: #f6f6f7;--aie-blockquote-border-color: #e3e3e3;--aie-blockquote-text-color: #888888;--aie-dropdown-container-bg-color: #ffffff;--aie-dropdown-container-border-color: #e9e9e9;--aie-dropdown-container-item-hover-color: #efefef;--aie-dropdown-color-panel-title-color: #666;--aie-dropdown-color-panel-button-border-color: #eaeaea;--aie-aie-popover-border-color: #e3e3e3;--aie-aie-popover-text-color: #333;--aie-suggestion-selected-border-color: #e3e3e3;--aie-suggestion-selected-bg-color: #e3e3e3;--aie-menus-text-color: var(--aie-text-color);--aie-menus-bg-color: #ffffff;--aie-menus-svg-color: #353535;--aie-menus-item-hover-color: #eee;--aie-menus-divider-color: #eaeaea;--aie-menus-ai-bg-color: var(--aie-menus-svg-color);--aie-menus-ai-color: #ffffff;--aie-menus-tip-bg-color: #333;--aie-menus-tip-text-color: #eee;--aie-menus-table-cell-border-color: #ccc;--aie-menus-table-cell-border-active-color: #000;--aie-content-container-info-color: #eff1f3;--aie-content-container-warning-color: #fcf5e4;--aie-content-container-danger-color: #ffe7ea;--aie-content-table-th-bg-color: #efefef;--aie-content-table-selected-bg-color: rgba(200, 200, 255, .3);--aie-content-table-border-color: #ced4da;--aie-content-table-handler-color: #adf;--aie-ai-panel-bg-color: #fff;--aie-ai-panel-border: #e9e9e9;--aie-textarea-border: #eaeaea;--aie-textarea-bg-color: #e9e9e9;--aie-actions-button-bg-color: #eaeaea;--aie-actions-button-color: #666;--aie-input-bg-color: #fff;--aie-input-border-color: #e9e9e9;--aie-input-button-bg-color: #e9e9e9}:root .aie-theme-dark{--aie-text-color: #ccc;--aie-text-placeholder-color: #5d5d5d;--aie-bg-color: #1e2022;--aie-container-border: #333;--aie-pre-bg-color: #282c34;--aie-blockquote-bg-color: #282c34;--aie-blockquote-border-color: #505050;--aie-blockquote-text-color: #888888;--aie-dropdown-container-bg-color: #505050;--aie-dropdown-container-border-color: #606060;--aie-dropdown-container-item-hover-color: #696969;--aie-dropdown-color-panel-title-color: #ccc;--aie-dropdown-color-panel-button-border-color: #606060;--aie-aie-popover-border-color: #606060;--aie-aie-popover-text-color: #ccc;--aie-suggestion-selected-border-color: #444;--aie-suggestion-selected-bg-color: #444;--aie-menus-text-color: var(--aie-text-color);--aie-menus-bg-color: #1a1b1e;--aie-menus-svg-color: #cccccc;--aie-menus-item-hover-color: #333;--aie-menus-divider-color: #2c2c2c;--aie-menus-ai-bg-color: var(--aie-menus-svg-color);--aie-menus-ai-color: #000;--aie-menus-tip-bg-color: #eee;--aie-menus-tip-text-color: #333;--aie-menus-table-cell-border-color: #888;--aie-menus-table-cell-border-active-color: #ccc;--aie-content-container-info-color: #2a2c30;--aie-content-container-warning-color: #40361d;--aie-content-container-danger-color: #46222a;--aie-content-table-th-bg-color: #2c2c2c;--aie-content-table-selected-bg-color: rgba(200, 200, 255, .2);--aie-content-table-border-color: #353535;--aie-content-table-handler-color: #566a77;--aie-ai-panel-bg-color: #505050;--aie-ai-panel-border: #444;--aie-textarea-border: #666;--aie-textarea-bg-color: #505050;--aie-actions-button-bg-color: #999;--aie-actions-button-color: #444;--aie-input-bg-color: #505050;--aie-input-border-color: #666;--aie-input-button-bg-color: #999}.aie-container{display:flex;flex-direction:column;height:100%;border:1px solid;border-color:var(--aie-container-border);background:var(--aie-bg-color)}.aie-container *,.aie-container :before,.aie-container :after{box-sizing:content-box}.aie-container .aie-ai-panel{width:500px;height:180px;border:solid 1px;border-color:var(--aie-ai-panel-border);background:var(--aie-ai-panel-bg-color);border-radius:5px;padding:10px;box-shadow:0 0 7px #00000026;display:flex;flex-direction:column}.aie-container .aie-ai-panel-content{width:100%;height:160px;position:relative}.aie-container .aie-ai-panel-content .loader{position:absolute;top:2px;right:2px;display:none}.aie-container .aie-ai-panel-content .loader svg{width:16px;animation:rotate 2s linear infinite}.aie-container .aie-ai-panel-content textarea{width:100%;height:100%;border:1px solid;border-color:var(--aie-textarea-border);background:var(--aie-textarea-bg-color);border-radius:3px;padding:5px;box-sizing:border-box}.aie-container .aie-ai-panel-content textarea:focus-visible{outline:none}.aie-container .aie-ai-panel-actions{margin:10px 0;display:flex;justify-content:end}.aie-container .aie-ai-panel-actions button{margin-left:5px;border:none;background:var(--aie-actions-button-bg-color);color:var(--aie-actions-button-color);border-radius:3px;padding:2px 12px}.aie-container .aie-ai-panel-actions button:hover{background:#dadada;cursor:pointer}.aie-container .aie-ai-panel-input{display:flex;justify-content:space-between;box-sizing:border-box;border:1px solid;border-color:var(--aie-input-border-color);align-items:center;padding:6px 10px;border-radius:3px}.aie-container .aie-ai-panel-input input{width:90%;height:100%;border:none;border-radius:3px;margin:0;padding:0;background:var(--aie-input-bg-color)}.aie-container .aie-ai-panel-input input::-webkit-input-placeholder{color:#ccc}.aie-container .aie-ai-panel-input input:focus-visible{outline:none}.aie-container .aie-ai-panel-input button{border:none;border-radius:50%;padding:0;background:var(--aie-input-button-bg-color)}.aie-container .aie-ai-panel-input button svg{fill:#666;width:18px}.aie-container .aie-ai-panel-input button:hover{background:#ccc;cursor:pointer}.aie-container aie-header{color:var(--aie-menus-text-color);background:var(--aie-menus-bg-color);z-index:1}.aie-container aie-header>div{border-bottom:1px solid var(--aie-container-border)}.aie-container aie-header svg{fill:var(--aie-menus-svg-color);width:16px;height:16px}.aie-container aie-header .menu-ai{display:flex;align-items:center;font-size:14px;text-align:center;background:var(--aie-menus-ai-bg-color);color:var(--aie-menus-ai-color);border-radius:3px;width:30px;padding:0 1px 0 5px}.aie-container aie-header .menu-ai svg{fill:var(--aie-menus-ai-color)}.aie-container aie-header .aie-menu-divider{background:var(--aie-menus-divider-color);width:1px;height:16px;margin:auto}.aie-container aie-header .aie-menu-item{height:25px;padding:5px 1px;display:flex;align-items:center}.aie-container aie-header .aie-menu-item .active{background:var(--aie-menus-item-hover-color)}.aie-container aie-header .aie-menu-item>div{height:18px;padding:5px;display:flex;justify-content:center}.aie-container aie-header .aie-menu-item>div:hover:not([no-hover]){background:var(--aie-menus-item-hover-color);cursor:pointer}.aie-container .aie-content:focus-visible{outline:none}.aie-container .aie-content ::selection{background:none}.aie-container .aie-content .selection-marker{background:#85c3ff6d;padding:2px 0}.aie-container .suggestion{background:var(--aie-menus-bg-color);border:1px solid var(--aie-dropdown-container-border-color);min-width:100px}.aie-container .suggestion .items .item{display:block;width:100%;height:30px;margin:0;color:var(--aie-text-color);background:var(--aie-menus-bg-color);border:none;text-align:left;padding:0 10px;cursor:pointer}.aie-container .suggestion .items .item-selected{background:var(--aie-suggestion-selected-bg-color)}.aie-container .aie-bubble-menu{height:30px;background:var(--aie-dropdown-container-bg-color);border:solid 1px var(--aie-dropdown-container-border-color);border-radius:3px;box-shadow:0 2px 5px 2px #0000001a;display:flex;align-items:center;padding:5px}.aie-container .aie-bubble-menu-item{height:20px;margin:3px;padding:5px}.aie-container .aie-bubble-menu-item svg{width:20px;height:20px;fill:var(--aie-text-color)}.aie-container .aie-bubble-menu-item:hover{background:var(--aie-menus-item-hover-color);cursor:pointer}.aie-container .aie-dropdown-container{background:var(--aie-dropdown-container-bg-color);border:solid 1px var(--aie-dropdown-container-border-color);overflow:auto;box-shadow:0 2px 5px 2px #0000001a;padding:5px 0;border-radius:3px;color:var(--aie-menus-text-color)}.aie-container .aie-dropdown-container svg{fill:var(--aie-menus-text-color)}.aie-container .aie-dropdown-container .aie-dropdown-item{display:flex;padding:3px 0}.aie-container .aie-dropdown-container .aie-dropdown-item .text{padding:2px 0;overflow:hidden;font-size:14px;display:flex}.aie-container .aie-dropdown-container .aie-dropdown-item .text h1,.aie-container .aie-dropdown-container .aie-dropdown-item .text h2,.aie-container .aie-dropdown-container .aie-dropdown-item .text h3,.aie-container .aie-dropdown-container .aie-dropdown-item .text h4,.aie-container .aie-dropdown-container .aie-dropdown-item .text h5,.aie-container .aie-dropdown-container .aie-dropdown-item .text h6{padding:0;margin:0;border:none}.aie-container .aie-dropdown-container .aie-dropdown-item .text h1{font-size:1.7em}.aie-container .aie-dropdown-container .aie-dropdown-item .text h2{font-size:1.6em}.aie-container .aie-dropdown-container .aie-dropdown-item .text h3{font-size:1.5em}.aie-container .aie-dropdown-container .aie-dropdown-item .text h4{font-size:1.4em}.aie-container .aie-dropdown-container .aie-dropdown-item .text h5{font-size:1.3em}.aie-container .aie-dropdown-container .aie-dropdown-item .text h6{font-size:1.2em}.aie-container .aie-dropdown-container .aie-dropdown-item .red-dot-container{display:flex;width:30px;overflow:hidden;padding-bottom:5px}.aie-container .aie-dropdown-container .aie-dropdown-item .red-dot-container .red-dot{width:10px;height:6px;border-left:2px solid var(--aie-text-color);border-bottom:2px solid var(--aie-text-color);rotate:-45deg;margin:auto}.aie-container .aie-dropdown-container .aie-dropdown-item:hover{background:var(--aie-dropdown-container-item-hover-color);cursor:pointer}.aie-container .aie-dropdown-container .emoji-cells{display:flex;flex-wrap:wrap;align-items:center;margin-top:-10px}.aie-container .aie-dropdown-container .emoji-cells .emoji-cell{width:20px;height:20px;margin:2px;cursor:pointer}.aie-container .aie-dropdown-container #table-cells .table-cell{border:solid 1px var(--aie-menus-table-cell-border-color)}.aie-container .aie-dropdown-container #table-cells .active{background:var(--aie-dropdown-container-item-hover-color)}.aie-container .aie-dropdown-container .color-panel{margin:0 5px}.aie-container .aie-dropdown-container .color-panel-title{padding-top:5px;font-size:14px;color:var(--aie-dropdown-color-panel-title-color)}.aie-container .aie-dropdown-container .color-panel-default-button{text-align:center;border:1px solid var(--aie-dropdown-color-panel-button-border-color);color:var(--aie-dropdown-color-panel-title-color);line-height:24px;font-size:14px;border-radius:3px}.aie-container .aie-resize-wrapper{position:relative;display:inline-flex}.aie-container .aie-resize-wrapper img{position:relative}.aie-container .aie-resize-wrapper:hover .aie-resize{display:inline-block}.aie-container .aie-resize-wrapper .aie-resize{display:none;position:absolute;top:-2px;left:-2px;border:2px solid #609eec;width:100%;height:100%}.aie-container .aie-resize-wrapper .aie-resize div{position:absolute;display:flex;width:20px;height:20px;z-index:1}.aie-container .aie-resize-wrapper .aie-resize div:after{content:"";display:block;margin:auto;width:8px;height:8px;background:#609eec;border-radius:50%}.aie-container .aie-resize-wrapper .aie-resize .aie-resize-btn-top-left{left:-10px;top:-10px;cursor:nwse-resize}.aie-container .aie-resize-wrapper .aie-resize .aie-resize-btn-top-right{right:-10px;top:-10px;cursor:nesw-resize}.aie-container .aie-resize-wrapper .aie-resize .aie-resize-btn-bottom-left{left:-10px;bottom:-10px;cursor:nesw-resize}.aie-container .aie-resize-wrapper .aie-resize .aie-resize-btn-bottom-right{right:-10px;bottom:-10px;cursor:nwse-resize}.aie-container .aie-loader-placeholder{width:200px;height:200px;background:#efefef;display:flex}.aie-container .aie-loader-placeholder svg{margin:auto;width:80px;fill:#ccc;animation:rotate 2s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.aie-container .aie-codeblock-wrapper{background:var(--aie-pre-bg-color);word-wrap:normal;white-space:normal;padding-top:5px;border-radius:5px}.aie-container .aie-codeblock-wrapper:hover .aie-codeblock-tools{display:flex}.aie-container .aie-codeblock-wrapper .aie-codeblock-tools{display:flex;justify-content:flex-end}.aie-container .aie-codeblock-wrapper .aie-codeblock-tools div{color:var(--aie-text-color);display:flex;cursor:pointer;align-items:center;font-size:14px;margin:0 3px}.aie-container .aie-codeblock-wrapper .aie-codeblock-tools-lang svg{fill:var(--aie-text-color);margin:2px;height:16px;width:16px}.aie-container .aie-codeblock-wrapper .aie-codeblock-tools-autowrap{margin:0 10px}.aie-container .aie-codeblock-wrapper .aie-codeblock-tools-autowrap svg{fill:var(--aie-text-color);margin:2px;height:14px;width:14px}.aie-container .aie-codeblock-langs{background:var(--aie-dropdown-container-bg-color);width:150px;height:300px;overflow:auto;border:solid 1px var(--aie-dropdown-container-border-color);color:var(--aie-menus-text-color)}.aie-container .aie-codeblock-langs-item{padding:5px;font-size:14px;height:20px;line-height:20px;cursor:pointer}.aie-container .aie-codeblock-langs-item:hover{background:var(--aie-dropdown-container-item-hover-color)}.aie-container aie-footer>div{border-top:solid 1px var(--aie-container-border);height:20px;line-height:20px;font-size:14px;text-align:right;color:#666}.aie-container aie-footer>div span{margin-left:auto}.aie-container aie-footer>div svg{fill:#666;rotate:-45deg;transform:translateY(5px);cursor:nwse-resize}.aie-container .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}.aie-container [data-tippy-root]{max-width:calc(100vw - 10px)}.aie-container .tippy-box{position:relative;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.aie-container .tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.aie-container .tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.aie-container .tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.aie-container .tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.aie-container .tippy-box[data-placement^=left]>.tippy-arrow{right:0}.aie-container .tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.aie-container .tippy-box[data-placement^=right]>.tippy-arrow{left:0}.aie-container .tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.aie-container .tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.aie-container .tippy-arrow{width:16px;height:16px}.aie-container .tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.aie-container .tippy-content{position:relative;padding:5px 9px;z-index:1}.aie-container .tippy-box[data-theme~=aietip]{background-color:var(--aie-menus-tip-bg-color);color:var(--aie-menus-tip-text-color)}.aie-container .tippy-box[data-theme~=aietip][data-placement^=top]>.tippy-arrow:before{border-top-color:var(--aie-menus-tip-bg-color)}.aie-container .tippy-box[data-theme~=aietip][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:var(--aie-menus-tip-bg-color)}.aie-container .tippy-box[data-theme~=aietip][data-placement^=left]>.tippy-arrow:before{border-left-color:var(--aie-menus-tip-bg-color)}.aie-container .tippy-box[data-theme~=aietip][data-placement^=right]>.tippy-arrow:before{border-right-color:var(--aie-menus-tip-bg-color)}.aie-theme-light pre code.hljs{display:block;overflow-x:auto;padding:1em}.aie-theme-light code.hljs{padding:3px 5px}.aie-theme-light .hljs{color:#383a42;background:#fafafa}.aie-theme-light .hljs-comment,.aie-theme-light .hljs-quote{color:#a0a1a7;font-style:italic}.aie-theme-light .hljs-doctag,.aie-theme-light .hljs-keyword,.aie-theme-light .hljs-formula{color:#a626a4}.aie-theme-light .hljs-section,.aie-theme-light .hljs-name,.aie-theme-light .hljs-selector-tag,.aie-theme-light .hljs-deletion,.aie-theme-light .hljs-subst{color:#e45649}.aie-theme-light .hljs-literal{color:#0184bb}.aie-theme-light .hljs-string,.aie-theme-light .hljs-regexp,.aie-theme-light .hljs-addition,.aie-theme-light .hljs-attribute,.aie-theme-light .hljs-meta .hljs-string{color:#50a14f}.aie-theme-light .hljs-attr,.aie-theme-light .hljs-variable,.aie-theme-light .hljs-template-variable,.aie-theme-light .hljs-type,.aie-theme-light .hljs-selector-class,.aie-theme-light .hljs-selector-attr,.aie-theme-light .hljs-selector-pseudo,.aie-theme-light .hljs-number{color:#986801}.aie-theme-light .hljs-symbol,.aie-theme-light .hljs-bullet,.aie-theme-light .hljs-link,.aie-theme-light .hljs-meta,.aie-theme-light .hljs-selector-id,.aie-theme-light .hljs-title{color:#4078f2}.aie-theme-light .hljs-built_in,.aie-theme-light .hljs-title.class_,.aie-theme-light .hljs-class .hljs-title{color:#c18401}.aie-theme-light .hljs-emphasis{font-style:italic}.aie-theme-light .hljs-strong{font-weight:700}.aie-theme-light .hljs-link{text-decoration:underline}.aie-theme-dark pre code.hljs{display:block;overflow-x:auto;padding:1em}.aie-theme-dark code.hljs{padding:3px 5px}.aie-theme-dark .hljs{color:#abb2bf;background:#282c34}.aie-theme-dark .hljs-comment,.aie-theme-dark .hljs-quote{color:#5c6370;font-style:italic}.aie-theme-dark .hljs-doctag,.aie-theme-dark .hljs-keyword,.aie-theme-dark .hljs-formula{color:#c678dd}.aie-theme-dark .hljs-section,.aie-theme-dark .hljs-name,.aie-theme-dark .hljs-selector-tag,.aie-theme-dark .hljs-deletion,.aie-theme-dark .hljs-subst{color:#e06c75}.aie-theme-dark .hljs-literal{color:#56b6c2}.aie-theme-dark .hljs-string,.aie-theme-dark .hljs-regexp,.aie-theme-dark .hljs-addition,.aie-theme-dark .hljs-attribute,.aie-theme-dark .hljs-meta .hljs-string{color:#98c379}.aie-theme-dark .hljs-attr,.aie-theme-dark .hljs-variable,.aie-theme-dark .hljs-template-variable,.aie-theme-dark .hljs-type,.aie-theme-dark .hljs-selector-class,.aie-theme-dark .hljs-selector-attr,.aie-theme-dark .hljs-selector-pseudo,.aie-theme-dark .hljs-number{color:#d19a66}.aie-theme-dark .hljs-symbol,.aie-theme-dark .hljs-bullet,.aie-theme-dark .hljs-link,.aie-theme-dark .hljs-meta,.aie-theme-dark .hljs-selector-id,.aie-theme-dark .hljs-title{color:#61aeee}.aie-theme-dark .hljs-built_in,.aie-theme-dark .hljs-title.class_,.aie-theme-dark .hljs-class .hljs-title{color:#e6c07b}.aie-theme-dark .hljs-emphasis{font-style:italic}.aie-theme-dark .hljs-strong{font-weight:700}.aie-theme-dark .hljs-link{text-decoration:underline}.aie-popover{min-width:100px;min-height:100px;background:#fff;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 2px 5px 2px #0000001a;background:var(--aie-dropdown-container-bg-color);border:1px solid var(--aie-aie-popover-border-color);border-radius:3px}.aie-popover-header{height:20px;display:flex;padding:5px 5px 0}.aie-popover-header-close{height:20px;width:20px;margin-left:auto;cursor:pointer}.aie-popover-header svg{fill:var(--aie-aie-popover-text-color)}.aie-popover-content{flex-grow:1;padding:0 10px 10px}.aie-popover-content>div{color:var(--aie-aie-popover-text-color);font-size:14px}.aie-popover-content input,.aie-popover-content select{border:solid 1px #ccc;height:25px;padding-inline:5px;border-radius:3px}.aie-popover-content input:focus-visible,.aie-popover-content select:focus-visible{outline:0px;border:solid 1px #999999}.aie-popover-content select{height:30px}.aie-popover-footer{display:flex;padding:10px}.aie-popover-footer-confirm{margin-left:auto;background:#ffffff;border:solid 1px #ccc;padding:5px 10px;font-size:14px;border-radius:3px}.aie-popover-footer-confirm:hover{border-color:#999;color:#333;cursor:pointer}.aie-content{overflow:auto;padding:10px;margin:0;color:var(--aie-text-color)}.aie-content>:first-child{margin-top:0}.aie-content p{margin:16px 0;line-height:26px}.aie-content ul,.aie-content ol{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0px;margin-inline-end:0px;padding-inline-start:20px}.aie-content li p{padding:0;margin:5px 0}.aie-content ul[data-type=taskList]{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0px;margin-inline-end:0px;padding-inline-start:0px}.aie-content ul[data-type=taskList] li{display:flex;align-items:center}.aie-content ul[data-type=taskList] li p{padding-left:2px}.aie-content blockquote{margin:16px 0;padding:5px 10px;border-left:2px solid var(--aie-blockquote-border-color);background:var(--aie-blockquote-bg-color)}.aie-content blockquote p{margin:5px 0;color:var(--aie-blockquote-text-color)}.aie-content img{border:1px solid #efefef}.aie-content code{border-radius:3px;padding:3px 6px;background:var(--aie-pre-bg-color)}.aie-content pre{margin:0;padding:0 10px 10px;border-radius:5px;background:var(--aie-pre-bg-color);overflow:auto}.aie-content pre code{padding:0;background:var(--aie-pre-bg-color)}.aie-content h1{padding-top:24px;letter-spacing:-.02em;line-height:40px;font-size:32px}.aie-content h2{padding-top:24px;letter-spacing:-.02em;line-height:32px;font-size:24px}.aie-content h3{margin:32px 0 0;letter-spacing:-.01em;line-height:28px;font-size:20px}.aie-content strong{font-weight:600}.aie-content table{border-collapse:collapse;margin:0;overflow:hidden;table-layout:fixed;width:100%}.aie-content table td,.aie-content table th{border:2px solid var(--aie-content-table-border-color);box-sizing:border-box;min-width:1em;padding:3px 5px;position:relative;vertical-align:top}.aie-content table td>*,.aie-content table th>*{margin-bottom:0}.aie-content table th{background-color:var(--aie-content-table-th-bg-color);font-weight:700;text-align:left}.aie-content table .selectedCell:after{background:var(--aie-content-table-selected-bg-color);content:"";left:0;right:0;top:0;bottom:0;pointer-events:none;position:absolute;z-index:2}.aie-content table .column-resize-handle{background-color:var(--aie-content-table-handler-color);bottom:-2px;position:absolute;right:-2px;pointer-events:none;top:0;width:3px}.aie-content table p{margin:0}.aie-content .align-left{text-align:left}.aie-content .align-right{text-align:right}.aie-content .align-center{text-align:center}.aie-content span[data-type=mention]{border:1px solid #cccccc;border-radius:5px;padding:0 3px}.aie-content p.is-editor-empty:first-child:before{color:var(--aie-text-placeholder-color);content:attr(data-placeholder);float:left;height:0;pointer-events:none}.aie-content div.container-wrapper{margin:1rem 0;padding:0 1rem;border:1px solid var(--aie-container-border);border-radius:3px}.aie-content div.info{background:var(--aie-content-container-info-color)}.aie-content div.warning{background:var(--aie-content-container-warning-color)}.aie-content div.danger{background:var(--aie-content-container-danger-color)}.tableWrapper{padding:1rem 0}.resize-cursor{cursor:ew-resize;cursor:col-resize} diff --git a/demos/docs-ts/dist/assets/index-1eb550dd.js b/demos/docs-ts/dist/assets/index-a9c8b2b1.js similarity index 67% rename from demos/docs-ts/dist/assets/index-1eb550dd.js rename to demos/docs-ts/dist/assets/index-a9c8b2b1.js index e57deba..a8a580e 100644 --- a/demos/docs-ts/dist/assets/index-1eb550dd.js +++ b/demos/docs-ts/dist/assets/index-a9c8b2b1.js @@ -1,15 +1,15 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function Ve(n){this.content=n}Ve.prototype={constructor:Ve,find:function(n){for(var e=0;e>1}};Ve.from=function(n){if(n instanceof Ve)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ve(e)};function Bp(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Bp(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Hp(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;ce&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{a.isText?(s+=a.text.slice(Math.max(e,l)-l,t-l),o=!r):a.isLeaf?(i?s+=typeof i=="function"?i(a):i:a.type.spec.leafText&&(s+=a.type.spec.leafText(a)),o=!r):!o&&a.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new R(r,i)}cutByIndex(e,t){return e==t?R.empty:e==0&&t==this.content.length?this:new R(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new R(i,s)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Yi(r+1,o):Yi(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return R.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new R(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};be.none=[];class Os extends Error{}class F{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$p(this.content,e+this.openStart,t);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F(Pp(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return F.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(R.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(R.empty,0,0);function Pp(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Pp(s.content,e-i-1,t-i-1)))}function $p(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=$p(o.content,e-s-1,t);return a&&n.replaceChild(i,o.copy(a))}function yb(n,e,t){if(t.openStart>n.depth)throw new Os("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Os("Inconsistent open depths");return Fp(n,e,t,0)}function Fp(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ui(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Kn(n.nodeAfter,r),s++));for(let a=s;ai&&il(n,e,i+1),o=r.depth>i&&il(t,r,i+1),a=[];return ui(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(zp(s,o),Kn(Wn(s,Vp(n,e,t,r,i+1)),a)):(s&&Kn(Wn(s,Ls(n,e,i+1)),a),ui(e,t,i,a),o&&Kn(Wn(o,Ls(t,r,i+1)),a)),ui(r,null,i,a),new R(a)}function Ls(n,e,t){let r=[];if(ui(null,n,t,r),n.depth>t){let i=il(n,e,t+1);Kn(Wn(i,Ls(n,e,t+1)),r)}return ui(e,null,t,r),new R(r)}function vb(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(R.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ei{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,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 new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}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 r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Rs(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Ei(t,r,s)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),qp(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=R.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;lt.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=R.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Gn.prototype.text=void 0;class Ds extends Gn{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):qp(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ds(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ds(this.type,this.attrs,e,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 qp(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Qn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Eb(e,t);if(r.next==null)return Qn.empty;let i=Up(r);r.next&&r.err("Unexpected trailing text");let s=Tb(Ab(i));return Nb(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` -`)}}Qn.empty=new Qn(!0);class Eb{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Up(n){let e=[];do e.push(xb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function xb(n){let e=[];do e.push(Cb(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Cb(n){let e=Mb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Sb(n,e);else break;return e}function au(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Sb(n,e){let t=au(n),r=t;return n.eat(",")&&(n.next!="}"?r=au(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function _b(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Mb(n){if(n.eat("(")){let e=Up(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=_b(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ab(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Qn(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new jp(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Ob{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class wo{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Zp(i.attrs),this.excluded=null;let s=Wp(this.attrs);this.instance=s?new be(this,s):null}create(e=null){return!e&&this.instance?this.instance:new be(this,Gp(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new wo(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Jp{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ve.from(e.nodes),t.marks=Ve.from(e.marks||{}),this.nodes=cu.compile(this.spec.nodes,this),this.marks=wo.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;s.contentMatch=r[o]||(r[o]=Qn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=a=="_"?null:a?uu(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:uu(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof cu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Ds(r,r.defaultAttrs,e,be.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Gn.fromJSON(this,e)}markFromJSON(e){return be.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function uu(n,e){let t=[];for(let r=0;r-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class An{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new fu(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new fu(this,t,!0);return r.addAll(e,t.from,t.to),F.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=pu(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=pu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new An(e,An.schemaRules(e)))}}const Yp={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Lb={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xp={ol:!0,ul:!0},Is=1,Bs=2,di=4;function du(n,e,t){return e!=null?(e?Is:0)|(e==="full"?Bs:0):n&&n.whitespace=="pre"?Is|Bs:t&~di}class Xi{constructor(e,t,r,i,s,o,a){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=be.none,this.stashMarks=[],this.match=o||(a&di?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(R.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Is)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=R.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(R.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;tthis.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=be.none,r=be.none;for(let i=0;i{o.clearMark(a)&&(r=a.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=Hb(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function Rb(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xp.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Db(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Ib(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function pu(n){let e={};for(let t in n)e[t]=n[t];return e}function Bb(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l{if(s.length||o.marks.length){let a=0,l=0;for(;a=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Vt.renderSpec(na(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,a=r?e.createElementNS(r,i):e.createElement(i),l=t[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;uc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Vt.renderSpec(e,d,r);if(a.appendChild(f),p){if(o)throw new RangeError("Multiple content holes");o=p}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=hu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return hu(e.marks)}}function hu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function na(n){return n.document||window.document}const Qp=65535,eh=Math.pow(2,16);function Pb(n,e){return n+e*eh}function gu(n){return n&Qp}function $b(n){return(n-(n&Qp))/eh}const th=1,nh=2,Es=4,rh=8;class ol{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&rh)>0}get deletedBefore(){return(this.delInfo&(th|Es))>0}get deletedAfter(){return(this.delInfo&(nh|Es))>0}get deletedAcross(){return(this.delInfo&Es)>0}}class ht{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ht.empty)return ht.empty}recover(e){let t=0,r=gu(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,p=l+i+(f<0?0:u);if(r)return p;let h=e==(t<0?l:d)?null:Pb(a/3,e-l),g=e==l?nh:e==d?th:Es;return(t<0?e!=l:e!=d)&&(g|=rh),new ol(p,g,h)}i+=u-c}return r?e+i:new ol(e+i,0,null)}touches(e,t){let r=0,i=gu(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Or;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return De.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yn(t.pos,r.pos,this.mark)}merge(e){return e instanceof yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new yn(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("addMark",yn);class qt extends Ye{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new F(Ul(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return De.fromReplace(e,this.from,this.to,r)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new qt(t.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("removeMark",qt);class vn extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return De.fromReplace(e,this.pos,this.pos+1,new F(R.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new He(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new He(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ye.jsonID("replaceAround",He);function al(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Fb(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,t),h=r.addToSet(d);for(let g=0;gn.step(l)),s.forEach(l=>n.step(l))}function zb(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof wo){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;un.step(new qt(o.from,o.to,o.style)))}function Vb(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let a=0;a=0;a--)n.step(s[a])}function qb(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Gr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;h--)g||r.index(h)>0?(g=!0,u=R.from(r.node(h).copy(u)),d++):l--;let f=R.empty,p=0;for(let h=s,g=!1;h>t;h--)g||i.after(h+1)=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=R.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new He(i,s,i,s,new F(r,0,0),t.length,!0))}function Zb(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&jb(n.doc,n.mapping.slice(s).map(a),r)){n.clearIncompatible(n.mapping.slice(s).map(a,1),r);let l=n.mapping.slice(s),c=l.map(a,1),u=l.map(a+o.nodeSize,1);return n.step(new He(c,u,c+1,u-1,new F(R.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function jb(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Jb(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new He(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new F(R.from(o),0,0),1,!0))}function Lr(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Yb(n,e,t=1,r){let i=n.doc.resolve(e),s=R.empty,o=R.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=R.from(i.node(a).copy(s));let u=r&&r[c];o=R.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}n.step(new qe(e,e,new F(s.append(o),t,t),!0))}function On(n,e){let t=n.resolve(e),r=t.index();return ih(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function ih(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function ko(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&ih(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Xb(n,e,t){let r=new qe(e-t,e+t,F.empty,!0);n.step(r)}function Qb(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Wl(n,e,t=e,r=F.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return oh(i,s,r)?new qe(e,t,r):new e0(i,s,r).fit()}function oh(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class e0{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=R.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=R.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new F(s,o,a);return e>-1?new He(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new qe(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=ia(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(R.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ia(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ia(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new F(ai(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new F(ai(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g1||l==0||g.content.size)&&(d=m,u.push(ah(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=li(this.placed,t,R.from(u)),this.frontier[t].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;a--){let{match:l,type:c}=this.frontier[a],u=sa(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=li(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=li(this.placed,this.depth,R.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(R.empty,!0);t.childCount&&(this.placed=li(this.placed,this.frontier.length,t))}}function ai(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ai(n.firstChild.content,e-1,t)))}function li(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(li(n.lastChild.content,e-1,t)))}function ia(n,e){for(let t=0;t1&&(r=r.replaceChild(0,ah(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(R.empty,!0)))),n.copy(r)}function sa(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!t0(t,s.content,o)?a:null}function t0(n,e,t){for(let r=t;r0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=n0(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let g=0;g=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let p=o[f];p<0||(e=i.before(p),t=s.after(p))}}function lh(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(R.empty,!0))}return n}function i0(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Qb(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new F(R.from(r),0,0))}function s0(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=ch(r,i);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function ch(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Rr extends Ye{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return De.fromReplace(e,this.pos,this.pos+1,new F(R.from(i),0,t.isLeaf?0:1))}getMap(){return ht.empty}invert(e){return new Rr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Rr(t.pos,t.attr,t.value)}}Ye.jsonID("attr",Rr);class xi extends Ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return De.ok(r)}getMap(){return ht.empty}invert(e){return new xi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xi(t.attr,t.value)}}Ye.jsonID("docAttr",xi);let Hr=class extends Error{};Hr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Hr.prototype=Object.create(Error.prototype);Hr.prototype.constructor=Hr;Hr.prototype.name="TransformError";class Gl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Or}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Hr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=F.empty){let i=Wl(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new F(R.from(r),0,0))}delete(e,t){return this.replace(e,t,F.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return r0(this,e,t,r),this}replaceRangeWith(e,t,r){return i0(this,e,t,r),this}deleteRange(e,t){return s0(this,e,t),this}lift(e,t){return Ub(this,e,t),this}join(e,t=1){return Xb(this,e,t),this}wrap(e,t){return Gb(this,e,t),this}setBlockType(e,t=e,r,i=null){return Zb(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Jb(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Rr(e,t,r)),this}setDocAttribute(e,t){return this.step(new xi(e,t)),this}addNodeMark(e,t){return this.step(new vn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof be)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Br(e,t)),this}split(e,t=1,r){return Yb(this,e,t,r),this}addMark(e,t,r){return Fb(this,e,t,r),this}removeMark(e,t,r){return zb(this,e,t,r),this}clearIncompatible(e,t,r){return Vb(this,e,t,r),this}}const oa=Object.create(null);class te{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new uh(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=0;s--){let o=t<0?wr(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):wr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Et(e.node(0))}static atStart(e){return wr(e,e,0,0,1)||new Et(e)}static atEnd(e){return wr(e,e,e.content.size,e.childCount,-1)||new Et(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=oa[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in oa)throw new RangeError("Duplicate use of selection JSON ID "+e);return oa[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Y.between(this.$anchor,this.$head).getBookmark()}}te.prototype.visible=!0;class uh{constructor(e,t){this.$from=e,this.$to=t}}let bu=!1;function yu(n){!bu&&!n.parent.inlineContent&&(bu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Y extends te{constructor(e,t=e){yu(e),yu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return te.near(r);let i=e.resolve(t.map(this.anchor));return new Y(i.parent.inlineContent?i:r,r)}replace(e,t=F.empty){if(super.replace(e,t),t==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Y&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Eo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Y(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=te.findFrom(t,r,!0)||te.findFrom(t,-r,!0);if(s)t=s.$head;else return te.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(te.findFrom(e,-r,!0)||te.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&X.isSelectable(a))return X.create(n,t-(i<0?a.nodeSize:0))}else{let l=wr(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function vu(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(te.near(n.doc.resolve(o),t))}const wu=1,Qi=2,ku=4;class a0 extends Gl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Qi,this}ensureMarks(e){return be.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Qi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Qi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||be.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(te.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=ku,this}get scrolledIntoView(){return(this.updated&ku)>0}}function Eu(n,e){return!e||!n?n:n.bind(e)}class ci{constructor(e,t,r){this.name=e,this.init=Eu(t.init,r),this.apply=Eu(t.apply,r)}}const l0=[new ci("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ci("selection",{init(n,e){return n.selection||te.atStart(e.doc)},apply(n){return n.selection}}),new ci("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ci("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class aa{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=l0.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ci(r.key,r.spec.state,r))})}}class _r{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new aa(e.schema,e.plugins),s=new _r(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Gn.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=te.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function dh(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=dh(i,e,{})),t[r]=i}return t}class Ce{constructor(e){this.spec=e,this.props={},e.props&&dh(e.props,this,this.props),this.key=e.key?e.key.key:fh("plugin")}getState(e){return e[this.key]}}const la=Object.create(null);function fh(n){return n in la?n+"$"+ ++la[n]:(la[n]=0,n+"$")}class _e{constructor(e="key"){this.key=fh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const et=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ci=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let xu=null;const rn=function(n,e,t){let r=xu||(xu=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},er=function(n,e,t,r){return t&&(Cu(n,e,t,r,-1)||Cu(n,e,t,r,1))},c0=/^(img|br|input|textarea|hr)$/i;function Cu(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:zt(n))){let s=n.parentNode;if(!s||s.nodeType!=1||jl(n)||c0.test(n.nodeName)||n.contentEditable=="false")return!1;e=et(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?zt(n):0}else return!1}}function zt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function u0(n,e,t){for(let r=e==0,i=e==zt(n);r||i;){if(n==t)return!0;let s=et(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==zt(n)}}function jl(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const xo=function(n){return n.focusNode&&er(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Pn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function d0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function f0(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Zt=typeof navigator<"u"?navigator:null,Su=typeof document<"u"?document:null,Ln=Zt&&Zt.userAgent||"",ll=/Edge\/(\d+)/.exec(Ln),ph=/MSIE \d/.exec(Ln),cl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ln),lt=!!(ph||cl||ll),Cn=ph?document.documentMode:cl?+cl[1]:ll?+ll[1]:0,Lt=!lt&&/gecko\/(\d+)/i.test(Ln);Lt&&+(/Firefox\/(\d+)/.exec(Ln)||[0,0])[1];const ul=!lt&&/Chrome\/(\d+)/.exec(Ln),je=!!ul,p0=ul?+ul[1]:0,tt=!lt&&!!Zt&&/Apple Computer/.test(Zt.vendor),Pr=tt&&(/Mobile\/\w+/.test(Ln)||!!Zt&&Zt.maxTouchPoints>2),wt=Pr||(Zt?/Mac/.test(Zt.platform):!1),h0=Zt?/Win/.test(Zt.platform):!1,Tt=/Android \d/.test(Ln),zi=!!Su&&"webkitFontSmoothing"in Su.documentElement.style,g0=zi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function m0(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function en(n,e){return typeof n=="number"?n:n[e]}function b0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function _u(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Ci(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?m0(s):b0(a),u=0,d=0;if(e.topc.bottom-en(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+en(i,"top")-c.top:e.bottom-c.bottom+en(i,"bottom")),e.leftc.right-en(r,"right")&&(u=e.right-c.right+en(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let h=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-h,top:e.top-g,right:e.right-h,bottom:e.bottom-g}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function y0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:hh(n.dom)}}function hh(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ci(r));return e}function v0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;gh(t,r==0?0:r-e)}function gh(n,e){for(let t=0;t=a){o=Math.max(h.bottom,o),a=Math.min(h.top,a);let g=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?k0(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:mh(t,i)}function k0(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Jl(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function E0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function C0(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!o||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!o&&(o=!0,l.left>r.left||l.top>r.top?i=a.posBefore:(l.right-1?i:n.docView.posFromDOM(e,t,-1)}function bh(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;zi&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=C0(n,r,i,e))}a==null&&(a=x0(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Mu(n){return n.top=0&&i==r.nodeValue.length?(l--,u=1):t<0?l--:c++,ei(un(rn(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==zt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return ca(l.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==zt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?rn(l,zt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ei(un(c,1),!1)}if(s==null&&i=0)}function ei(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ca(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function vh(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function M0(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return vh(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=yh(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=rn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const A0=/[\u0590-\u08ac]/;function T0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return!A0.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:vh(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:g}=n.domSelectionRange(),m=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),m})}let Au=null,Tu=null,Nu=!1;function N0(n,e,t){return Au==e&&Tu==t?Nu:(Au=e,Tu=t,Nu=t=="up"||t=="down"?M0(n,e,t):T0(n,e,t))}const xt=0,Ou=1,zn=2,jt=3;class Vi{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=xt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tet(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof kh){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof wh&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?et(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=et(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;up&&ot){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?zn:Ou,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=jt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?zn:jt}r=o}this.dirty=zn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?zn:Ou;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==xt&&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 side(){return this.widget.type.side}}class O0 extends Vi{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class tr extends Vi{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Vt.renderSpec(document,t.type.spec.toDOM(t,r))),new tr(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=xt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=pl(s,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Vt.renderSpec(document,t.type.spec.toDOM(t)));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Ch(u,r,t),c?l=new L0(e,t,r,i,u,d||null,f,c,s,o+1):t.isText?new Co(e,t,r,i,u,f,s):new Sn(e,t,r,i,u,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>R.empty)}return e}matchesNode(e,t,r){return this.dirty==xt&&e.eq(this.node)&&fl(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new D0(this,o&&o.node,e);H0(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?be.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==zn)&&(o&&this.protectLocalComposition(e,o),Eh(this.contentDOM,this.children,e),Pr&&P0(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Y)||rt+this.node.content.size)return null;let s=e.domSelectionRange(),o=$0(s.focusNode,s.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,l=F0(this.node.content,a,r-t,i-t);return l<0?null:{node:o,pos:l,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new O0(this,s,t,i);e.input.compositionNodes.push(o),this.children=pl(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=xt}updateOuterDeco(e){if(fl(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=xh(this.dom,this.nodeDOM,dl(this.outerDeco,this.node,t),dl(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Lu(n,e,t,r,i){Ch(r,e,n);let s=new Sn(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Co extends Sn{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==jt||this.dirty!=xt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=xt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=xt,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Co(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=jt)}get domAtom(){return!1}}class kh extends Vi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==xt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class L0 extends Sn{constructor(e,t,r,i,s,o,a,l,c,u){super(e,t,r,i,s,o,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==jt)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Eh(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=tr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof tr)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function B0(n,e){return n.type.side-e.type.side}function H0(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)a.push(i[o++]);let h=s+f.nodeSize;if(f.isText){let m=h;o!m.inline):a.slice();r(f,g,e.forChild(s,f),p),s=h}}function P0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function $0(n,e){for(;;){if(n.nodeType==3)return n;if(n.nodeType==1&&e>0){if(n.childNodes.length>e&&n.childNodes[e].nodeType==3)return n.childNodes[e];n=n.childNodes[e-1],e=zt(n)}else if(n.nodeType==1&&e=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function pl(n,e,t,r,i){let s=[];for(let o=0,a=0;o=t||u<=e?s.push(l):(ct&&s.push(l.slice(t-c,l.size,r)))}return s}function Yl(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(xo(t)){for(l=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&X.isSelectable(u)&&i.parent&&!(u.isInline&&u0(t.focusNode,t.focusOffset,i.dom))){let d=i.posBefore;c=new X(o==d?a:r.resolve(d))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Sh(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function V0(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,et(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&<&&Cn<=11&&(r.disabled=!0,r.disabled=!1)}function _h(n,e){if(e instanceof X){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Hu(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Hu(n)}function Hu(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Xl(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||Y.between(e,t,r)}function Pu(n){return n.editable&&!n.hasFocus()?!1:Mh(n)}function Mh(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function q0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return er(e.node,e.offset,t.anchorNode,t.anchorOffset)}function hl(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function dn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function $u(n,e,t){let r=n.state.selection;if(r instanceof Y)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return dn(n,new Y(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=hl(n.state,e);return i&&i instanceof X?dn(n,i):!1}else if(!(wt&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?X.isSelectable(s)?dn(n,new X(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):zi?dn(n,new Y(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof X&&r.node.isInline)return dn(n,new Y(e>0?r.$to:r.$from));{let i=hl(n.state,e);return i?dn(n,i):!1}}}function Hs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function pi(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function pr(n,e){return e<0?U0(n):K0(n)}function U0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Lt&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(pi(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Ah(t))break;{let a=t.previousSibling;for(;a&&pi(a,-1);)i=t.parentNode,s=et(a),a=a.previousSibling;if(a)t=a,r=Hs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?gl(n,t,r):i&&gl(n,i,s)}function K0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Hs(t),s,o;for(;;)if(r{n.state==i&&on(n)},50)}function Fu(n,e){let t=n.state.doc.resolve(e);if(!(je||h0)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function zu(n,e,t){let r=n.state.selection;if(r instanceof Y&&!r.empty||t.indexOf("s")>-1||wt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=hl(n.state,e);if(o&&o instanceof X)return dn(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Et?te.near(o,e):te.findFrom(o,e);return a?dn(n,a):!1}return!1}function Vu(n,e){if(!(n.state.selection instanceof Y))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function qu(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Z0(n){if(!tt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;qu(n,r,"true"),setTimeout(()=>qu(n,r,"false"),20)}return!1}function j0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function J0(n,e){let t=e.keyCode,r=j0(e);if(t==8||wt&&t==72&&r=="c")return Vu(n,-1)||pr(n,-1);if(t==46&&!e.shiftKey||wt&&t==68&&r=="c")return Vu(n,1)||pr(n,1);if(t==13||t==27)return!0;if(t==37||wt&&t==66&&r=="c"){let i=t==37?Fu(n,n.state.selection.from)=="ltr"?-1:1:-1;return $u(n,i,r)||pr(n,i)}else if(t==39||wt&&t==70&&r=="c"){let i=t==39?Fu(n,n.state.selection.from)=="ltr"?1:-1:1;return $u(n,i,r)||pr(n,i)}else{if(t==38||wt&&t==80&&r=="c")return zu(n,-1,r)||pr(n,-1);if(t==40||wt&&t==78&&r=="c")return Z0(n)||zu(n,1,r)||pr(n,1);if(r==(wt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Th(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||Vt.fromSchema(n.state.schema),a=Ih(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Dh[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function qe(n){this.content=n}qe.prototype={constructor:qe,find:function(n){for(var e=0;e>1}};qe.from=function(n){if(n instanceof qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new qe(e)};function Hp(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Hp(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Pp(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;ce&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{a.isText?(s+=a.text.slice(Math.max(e,l)-l,t-l),o=!r):a.isLeaf?(i?s+=typeof i=="function"?i(a):i:a.type.spec.leafText&&(s+=a.type.spec.leafText(a)),o=!r):!o&&a.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new R(r,i)}cutByIndex(e,t){return e==t?R.empty:e==0&&t==this.content.length?this:new R(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new R(i,s)}addToStart(e){return new R([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new R(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Yi(r+1,o):Yi(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return R.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new R(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return R.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};be.none=[];class Ls extends Error{}class F{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Fp(this.content,e+this.openStart,t);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F($p(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return F.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(R.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(R.empty,0,0);function $p(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy($p(s.content,e-i-1,t-i-1)))}function Fp(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Fp(o.content,e-s-1,t);return a&&n.replaceChild(i,o.copy(a))}function wb(n,e,t){if(t.openStart>n.depth)throw new Ls("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ls("Inconsistent open depths");return zp(n,e,t,0)}function zp(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function di(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Kn(n.nodeAfter,r),s++));for(let a=s;ai&&ll(n,e,i+1),o=r.depth>i&&ll(t,r,i+1),a=[];return di(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(Vp(s,o),Kn(Wn(s,qp(n,e,t,r,i+1)),a)):(s&&Kn(Wn(s,Rs(n,e,i+1)),a),di(e,t,i,a),o&&Kn(Wn(o,Rs(t,r,i+1)),a)),di(r,null,i,a),new R(a)}function Rs(n,e,t){let r=[];if(di(null,n,t,r),n.depth>t){let i=ll(n,e,t+1);Kn(Wn(i,Rs(n,e,t+1)),r)}return di(e,null,t,r),new R(r)}function kb(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(R.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ei{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,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 new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}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 r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ds(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new Ei(t,r,s)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Up(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=R.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;lt.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=R.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Zn.prototype.text=void 0;class Is extends Zn{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Up(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Is(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Is(this.type,this.attrs,e,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 Up(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Qn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Cb(e,t);if(r.next==null)return Qn.empty;let i=Kp(r);r.next&&r.err("Unexpected trailing text");let s=Ob(Nb(i));return Lb(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +`)}}Qn.empty=new Qn(!0);class Cb{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Kp(n){let e=[];do e.push(Sb(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Sb(n){let e=[];do e.push(_b(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _b(n){let e=Tb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Mb(n,e);else break;return e}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Mb(n,e){let t=lu(n),r=t;return n.eat(",")&&(n.next!="}"?r=lu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Ab(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Tb(n){if(n.eat("(")){let e=Kp(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Ab(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Nb(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Qn(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new Jp(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Rb{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ko{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=jp(i.attrs),this.excluded=null;let s=Zp(this.attrs);this.instance=s?new be(this,s):null}create(e=null){return!e&&this.instance?this.instance:new be(this,Gp(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ko(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Yp{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=qe.from(e.nodes),t.marks=qe.from(e.marks||{}),this.nodes=uu.compile(this.spec.nodes,this),this.marks=ko.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;s.contentMatch=r[o]||(r[o]=Qn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=a=="_"?null:a?du(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:du(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof uu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Is(r,r.defaultAttrs,e,be.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Zn.fromJSON(this,e)}markFromJSON(e){return be.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function du(n,e){let t=[];for(let r=0;r-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class An{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new pu(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new pu(this,t,!0);return r.addAll(e,t.from,t.to),F.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=hu(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=hu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new An(e,An.schemaRules(e)))}}const Xp={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Db={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qp={ol:!0,ul:!0},Bs=1,Hs=2,fi=4;function fu(n,e,t){return e!=null?(e?Bs:0)|(e==="full"?Hs:0):n&&n.whitespace=="pre"?Bs|Hs:t&~fi}class Xi{constructor(e,t,r,i,s,o,a){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=be.none,this.stashMarks=[],this.match=o||(a&fi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(R.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Bs)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=R.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(R.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;tthis.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` +`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=be.none,r=be.none;for(let i=0;i{o.clearMark(a)&&(r=a.addToSet(r))}):t=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(t),o.consuming===!1)s=o;else break}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=$b(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function Ib(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Qp.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Bb(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Hb(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function hu(n){let e={};for(let t in n)e[t]=n[t];return e}function Pb(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l{if(s.length||o.marks.length){let a=0,l=0;for(;a=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Vt.renderSpec(oa(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,a=r?e.createElementNS(r,i):e.createElement(i),l=t[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;uc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Vt.renderSpec(e,d,r);if(a.appendChild(f),p){if(o)throw new RangeError("Multiple content holes");o=p}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=gu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return gu(e.marks)}}function gu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function oa(n){return n.document||window.document}const eh=65535,th=Math.pow(2,16);function Fb(n,e){return n+e*th}function mu(n){return n&eh}function zb(n){return(n-(n&eh))/th}const nh=1,rh=2,Es=4,ih=8;class ul{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&ih)>0}get deletedBefore(){return(this.delInfo&(nh|Es))>0}get deletedAfter(){return(this.delInfo&(rh|Es))>0}get deletedAcross(){return(this.delInfo&Es)>0}}class ht{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ht.empty)return ht.empty}recover(e){let t=0,r=mu(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,p=l+i+(f<0?0:u);if(r)return p;let h=e==(t<0?l:d)?null:Fb(a/3,e-l),g=e==l?rh:e==d?nh:Es;return(t<0?e!=l:e!=d)&&(g|=ih),new ul(p,g,h)}i+=u-c}return r?e+i:new ul(e+i,0,null)}touches(e,t){let r=0,i=mu(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Or;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return De.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yn(t.pos,r.pos,this.mark)}merge(e){return e instanceof yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new yn(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("addMark",yn);class qt extends Ye{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new F(Gl(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return De.fromReplace(e,this.from,this.to,r)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new qt(t.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(t.from,t.to,e.markFromJSON(t.mark))}}Ye.jsonID("removeMark",qt);class vn extends Ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return De.fromReplace(e,this.pos,this.pos+1,new F(R.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new He(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new He(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ye.jsonID("replaceAround",He);function dl(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Vb(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,t),h=r.addToSet(d);for(let g=0;gn.step(l)),s.forEach(l=>n.step(l))}function qb(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ko){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;un.step(new qt(o.from,o.to,o.style)))}function Ub(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let a=0;a=0;a--)n.step(s[a])}function Kb(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Gr(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;h--)g||r.index(h)>0?(g=!0,u=R.from(r.node(h).copy(u)),d++):l--;let f=R.empty,p=0;for(let h=s,g=!1;h>t;h--)g||i.after(h+1)=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=R.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new He(i,s,i,s,new F(r,0,0),t.length,!0))}function Jb(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&Yb(n.doc,n.mapping.slice(s).map(a),r)){n.clearIncompatible(n.mapping.slice(s).map(a,1),r);let l=n.mapping.slice(s),c=l.map(a,1),u=l.map(a+o.nodeSize,1);return n.step(new He(c,u,c+1,u-1,new F(R.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function Yb(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Xb(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new He(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new F(R.from(o),0,0),1,!0))}function Lr(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Qb(n,e,t=1,r){let i=n.doc.resolve(e),s=R.empty,o=R.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=R.from(i.node(a).copy(s));let u=r&&r[c];o=R.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}n.step(new Ue(e,e,new F(s.append(o),t,t),!0))}function On(n,e){let t=n.resolve(e),r=t.index();return sh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function sh(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function xo(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&sh(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function e1(n,e,t){let r=new Ue(e-t,e+t,F.empty,!0);n.step(r)}function t1(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Jl(n,e,t=e,r=F.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return ah(i,s,r)?new Ue(e,t,r):new n1(i,s,r).fit()}function ah(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class n1{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=R.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=R.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new F(s,o,a);return e>-1?new He(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new Ue(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=la(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(R.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=la(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=la(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new F(li(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new F(li(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g1||l==0||g.content.size)&&(d=m,u.push(lh(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=ci(this.placed,t,R.from(u)),this.frontier[t].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;a--){let{match:l,type:c}=this.frontier[a],u=ca(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ci(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ci(this.placed,this.depth,R.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(R.empty,!0);t.childCount&&(this.placed=ci(this.placed,this.frontier.length,t))}}function li(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(li(n.firstChild.content,e-1,t)))}function ci(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ci(n.lastChild.content,e-1,t)))}function la(n,e){for(let t=0;t1&&(r=r.replaceChild(0,lh(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(R.empty,!0)))),n.copy(r)}function ca(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!r1(t,s.content,o)?a:null}function r1(n,e,t){for(let r=t;r0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=i1(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let g=0;g=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let p=o[f];p<0||(e=i.before(p),t=s.after(p))}}function ch(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(R.empty,!0))}return n}function o1(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=t1(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new F(R.from(r),0,0))}function a1(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=uh(r,i);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function uh(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Rr extends Ye{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return De.fromReplace(e,this.pos,this.pos+1,new F(R.from(i),0,t.isLeaf?0:1))}getMap(){return ht.empty}invert(e){return new Rr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Rr(t.pos,t.attr,t.value)}}Ye.jsonID("attr",Rr);class Ci extends Ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return De.ok(r)}getMap(){return ht.empty}invert(e){return new Ci(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ci(t.attr,t.value)}}Ye.jsonID("docAttr",Ci);let Hr=class extends Error{};Hr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Hr.prototype=Object.create(Error.prototype);Hr.prototype.constructor=Hr;Hr.prototype.name="TransformError";class Yl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Or}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Hr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=F.empty){let i=Jl(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new F(R.from(r),0,0))}delete(e,t){return this.replace(e,t,F.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return s1(this,e,t,r),this}replaceRangeWith(e,t,r){return o1(this,e,t,r),this}deleteRange(e,t){return a1(this,e,t),this}lift(e,t){return Wb(this,e,t),this}join(e,t=1){return e1(this,e,t),this}wrap(e,t){return jb(this,e,t),this}setBlockType(e,t=e,r,i=null){return Jb(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Xb(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Rr(e,t,r)),this}setDocAttribute(e,t){return this.step(new Ci(e,t)),this}addNodeMark(e,t){return this.step(new vn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof be)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Br(e,t)),this}split(e,t=1,r){return Qb(this,e,t,r),this}addMark(e,t,r){return Vb(this,e,t,r),this}removeMark(e,t,r){return qb(this,e,t,r),this}clearIncompatible(e,t,r){return Ub(this,e,t,r),this}}const ua=Object.create(null);class te{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new dh(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=0;s--){let o=t<0?wr(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):wr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new xt(e.node(0))}static atStart(e){return wr(e,e,0,0,1)||new xt(e)}static atEnd(e){return wr(e,e,e.content.size,e.childCount,-1)||new xt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ua[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ua)throw new RangeError("Duplicate use of selection JSON ID "+e);return ua[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Y.between(this.$anchor,this.$head).getBookmark()}}te.prototype.visible=!0;class dh{constructor(e,t){this.$from=e,this.$to=t}}let yu=!1;function vu(n){!yu&&!n.parent.inlineContent&&(yu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Y extends te{constructor(e,t=e){vu(e),vu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return te.near(r);let i=e.resolve(t.map(this.anchor));return new Y(i.parent.inlineContent?i:r,r)}replace(e,t=F.empty){if(super.replace(e,t),t==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Y&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Eo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Y(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=te.findFrom(t,r,!0)||te.findFrom(t,-r,!0);if(s)t=s.$head;else return te.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(te.findFrom(e,-r,!0)||te.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&X.isSelectable(a))return X.create(n,t-(i<0?a.nodeSize:0))}else{let l=wr(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function wu(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(te.near(n.doc.resolve(o),t))}const ku=1,Qi=2,xu=4;class c1 extends Yl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Qi,this}ensureMarks(e){return be.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Qi)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Qi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||be.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(te.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=xu,this}get scrolledIntoView(){return(this.updated&xu)>0}}function Eu(n,e){return!e||!n?n:n.bind(e)}class ui{constructor(e,t,r){this.name=e,this.init=Eu(t.init,r),this.apply=Eu(t.apply,r)}}const u1=[new ui("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ui("selection",{init(n,e){return n.selection||te.atStart(e.doc)},apply(n){return n.selection}}),new ui("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ui("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class da{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=u1.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ui(r.key,r.spec.state,r))})}}class _r{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new da(e.schema,e.plugins),s=new _r(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Zn.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=te.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function fh(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=fh(i,e,{})),t[r]=i}return t}class Ce{constructor(e){this.spec=e,this.props={},e.props&&fh(e.props,this,this.props),this.key=e.key?e.key.key:ph("plugin")}getState(e){return e[this.key]}}const fa=Object.create(null);function ph(n){return n in fa?n+"$"+ ++fa[n]:(fa[n]=0,n+"$")}class _e{constructor(e="key"){this.key=ph(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const et=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Si=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Cu=null;const rn=function(n,e,t){let r=Cu||(Cu=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},er=function(n,e,t,r){return t&&(Su(n,e,t,r,-1)||Su(n,e,t,r,1))},d1=/^(img|br|input|textarea|hr)$/i;function Su(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:zt(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Ql(n)||d1.test(n.nodeName)||n.contentEditable=="false")return!1;e=et(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?zt(n):0}else return!1}}function zt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function f1(n,e,t){for(let r=e==0,i=e==zt(n);r||i;){if(n==t)return!0;let s=et(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==zt(n)}}function Ql(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Co=function(n){return n.focusNode&&er(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Pn(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function p1(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function h1(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const Gt=typeof navigator<"u"?navigator:null,_u=typeof document<"u"?document:null,Ln=Gt&&Gt.userAgent||"",fl=/Edge\/(\d+)/.exec(Ln),hh=/MSIE \d/.exec(Ln),pl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ln),lt=!!(hh||pl||fl),Cn=hh?document.documentMode:pl?+pl[1]:fl?+fl[1]:0,Lt=!lt&&/gecko\/(\d+)/i.test(Ln);Lt&&+(/Firefox\/(\d+)/.exec(Ln)||[0,0])[1];const hl=!lt&&/Chrome\/(\d+)/.exec(Ln),je=!!hl,g1=hl?+hl[1]:0,tt=!lt&&!!Gt&&/Apple Computer/.test(Gt.vendor),Pr=tt&&(/Mobile\/\w+/.test(Ln)||!!Gt&&Gt.maxTouchPoints>2),wt=Pr||(Gt?/Mac/.test(Gt.platform):!1),m1=Gt?/Win/.test(Gt.platform):!1,Tt=/Android \d/.test(Ln),zi=!!_u&&"webkitFontSmoothing"in _u.documentElement.style,b1=zi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y1(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function en(n,e){return typeof n=="number"?n:n[e]}function v1(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Mu(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Si(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?y1(s):v1(a),u=0,d=0;if(e.topc.bottom-en(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+en(i,"top")-c.top:e.bottom-c.bottom+en(i,"bottom")),e.leftc.right-en(r,"right")&&(u=e.right-c.right+en(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let h=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-h,top:e.top-g,right:e.right-h,bottom:e.bottom-g}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function w1(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:gh(n.dom)}}function gh(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Si(r));return e}function k1({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;mh(t,r==0?0:r-e)}function mh(n,e){for(let t=0;t=a){o=Math.max(h.bottom,o),a=Math.min(h.top,a);let g=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?E1(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:bh(t,i)}function E1(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function ec(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function C1(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function _1(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!o||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!o&&(o=!0,l.left>r.left||l.top>r.top?i=a.posBefore:(l.right-1?i:n.docView.posFromDOM(e,t,-1)}function yh(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;zi&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=_1(n,r,i,e))}a==null&&(a=S1(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Au(n){return n.top=0&&i==r.nodeValue.length?(l--,u=1):t<0?l--:c++,ti(un(rn(r,l,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==zt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return pa(l.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==zt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?rn(l,zt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ti(un(c,1),!1)}if(s==null&&i=0)}function ti(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function pa(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function wh(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function T1(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return wh(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=vh(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=rn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const N1=/[\u0590-\u08ac]/;function O1(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return!N1.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:wh(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:g}=n.domSelectionRange(),m=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),m})}let Tu=null,Nu=null,Ou=!1;function L1(n,e,t){return Tu==e&&Nu==t?Ou:(Tu=e,Nu=t,Ou=t=="up"||t=="down"?T1(n,e,t):O1(n,e,t))}const Et=0,Lu=1,zn=2,jt=3;class Vi{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Et,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tet(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof xh){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof kh&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?et(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=et(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;up&&ot){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?zn:Lu,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=jt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?zn:jt}r=o}this.dirty=zn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?zn:Lu;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Et&&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 side(){return this.widget.type.side}}class R1 extends Vi{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class tr extends Vi{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=Vt.renderSpec(document,t.type.spec.toDOM(t,r))),new tr(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=jt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Et){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=bl(s,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Vt.renderSpec(document,t.type.spec.toDOM(t)));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Sh(u,r,t),c?l=new D1(e,t,r,i,u,d||null,f,c,s,o+1):t.isText?new So(e,t,r,i,u,f,s):new Sn(e,t,r,i,u,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>R.empty)}return e}matchesNode(e,t,r){return this.dirty==Et&&e.eq(this.node)&&ml(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new B1(this,o&&o.node,e);$1(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?be.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==zn)&&(o&&this.protectLocalComposition(e,o),Eh(this.contentDOM,this.children,e),Pr&&F1(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Y)||rt+this.node.content.size)return null;let s=e.domSelectionRange(),o=z1(s.focusNode,s.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,l=V1(this.node.content,a,r-t,i-t);return l<0?null:{node:o,pos:l,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new R1(this,s,t,i);e.input.compositionNodes.push(o),this.children=bl(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Et}updateOuterDeco(e){if(ml(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ch(this.dom,this.nodeDOM,gl(this.outerDeco,this.node,t),gl(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Ru(n,e,t,r,i){Sh(r,e,n);let s=new Sn(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class So extends Sn{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==jt||this.dirty!=Et&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Et||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Et,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new So(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=jt)}get domAtom(){return!1}}class xh extends Vi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Et&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class D1 extends Sn{constructor(e,t,r,i,s,o,a,l,c,u){super(e,t,r,i,s,o,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==jt)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Eh(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=tr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof tr)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function P1(n,e){return n.type.side-e.type.side}function $1(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)a.push(i[o++]);let h=s+f.nodeSize;if(f.isText){let m=h;o!m.inline):a.slice();r(f,g,e.forChild(s,f),p),s=h}}function F1(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function z1(n,e){for(;;){if(n.nodeType==3)return n;if(n.nodeType==1&&e>0){if(n.childNodes.length>e&&n.childNodes[e].nodeType==3)return n.childNodes[e];n=n.childNodes[e-1],e=zt(n)}else if(n.nodeType==1&&e=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function bl(n,e,t,r,i){let s=[];for(let o=0,a=0;o=t||u<=e?s.push(l):(ct&&s.push(l.slice(t-c,l.size,r)))}return s}function tc(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Co(t)){for(l=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&X.isSelectable(u)&&i.parent&&!(u.isInline&&f1(t.focusNode,t.focusOffset,i.dom))){let d=i.posBefore;c=new X(o==d?a:r.resolve(d))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!_h(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function U1(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,et(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&<&&Cn<=11&&(r.disabled=!0,r.disabled=!1)}function Mh(n,e){if(e instanceof X){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Pu(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Pu(n)}function Pu(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function nc(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||Y.between(e,t,r)}function $u(n){return n.editable&&!n.hasFocus()?!1:Ah(n)}function Ah(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function K1(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return er(e.node,e.offset,t.anchorNode,t.anchorOffset)}function yl(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function dn(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Fu(n,e,t){let r=n.state.selection;if(r instanceof Y)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return dn(n,new Y(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=yl(n.state,e);return i&&i instanceof X?dn(n,i):!1}else if(!(wt&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?X.isSelectable(s)?dn(n,new X(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):zi?dn(n,new Y(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof X&&r.node.isInline)return dn(n,new Y(e>0?r.$to:r.$from));{let i=yl(n.state,e);return i?dn(n,i):!1}}}function Ps(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function hi(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function pr(n,e){return e<0?W1(n):Z1(n)}function W1(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Lt&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(hi(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Th(t))break;{let a=t.previousSibling;for(;a&&hi(a,-1);)i=t.parentNode,s=et(a),a=a.previousSibling;if(a)t=a,r=Ps(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?vl(n,t,r):i&&vl(n,i,s)}function Z1(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ps(t),s,o;for(;;)if(r{n.state==i&&on(n)},50)}function zu(n,e){let t=n.state.doc.resolve(e);if(!(je||m1)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Vu(n,e,t){let r=n.state.selection;if(r instanceof Y&&!r.empty||t.indexOf("s")>-1||wt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=yl(n.state,e);if(o&&o instanceof X)return dn(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof xt?te.near(o,e):te.findFrom(o,e);return a?dn(n,a):!1}return!1}function qu(n,e){if(!(n.state.selection instanceof Y))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Uu(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function J1(n){if(!tt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Uu(n,r,"true"),setTimeout(()=>Uu(n,r,"false"),20)}return!1}function Y1(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function X1(n,e){let t=e.keyCode,r=Y1(e);if(t==8||wt&&t==72&&r=="c")return qu(n,-1)||pr(n,-1);if(t==46&&!e.shiftKey||wt&&t==68&&r=="c")return qu(n,1)||pr(n,1);if(t==13||t==27)return!0;if(t==37||wt&&t==66&&r=="c"){let i=t==37?zu(n,n.state.selection.from)=="ltr"?-1:1:-1;return Fu(n,i,r)||pr(n,i)}else if(t==39||wt&&t==70&&r=="c"){let i=t==39?zu(n,n.state.selection.from)=="ltr"?1:-1:1;return Fu(n,i,r)||pr(n,i)}else{if(t==38||wt&&t==80&&r=="c")return Vu(n,-1,r)||pr(n,-1);if(t==40||wt&&t==78&&r=="c")return J1(n)||Vu(n,1,r)||pr(n,1);if(r==(wt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Nh(n,e){n.someProp("transformCopied",p=>{e=p(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||Vt.fromSchema(n.state.schema),a=Bh(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ih[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,` -`);return{dom:l,text:f}}function Nh(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new F(R.from(n.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):F.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)a=d;else{let f=i.marks(),{schema:p}=n.state,h=Vt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(h.serializeNode(p.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Q0(t),zi&&e1(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||An.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Y0.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=t1(Uu(a,+u[1],+u[2]),u[4]);else if(a=F.maxOpen(X0(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d{a=d(a,n)}),a}const Y0=/^(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 X0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Lh(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Rh(o[o.length-1],s.length));let u=Oh(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return R.from(o)}return n}function Oh(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,R.from(n));return n}function Lh(n,e,t,r,i){if(i1&&(s=0),i=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(R.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Uu(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ih().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Dh[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=R.from(l.create(r[a+1],i)),s++,o++}return new F(i,s,o)}const nt={},rt={},n1={touchstart:!0,touchmove:!0};class r1{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function i1(n){for(let e in nt){let t=nt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{o1(n,r)&&!Ql(n,r)&&(n.editable||!(r.type in rt))&&t(n,r)},n1[e]?{passive:!0}:void 0)}tt&&n.dom.addEventListener("input",()=>null),bl(n)}function wn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function s1(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function bl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ql(n,r))})}function Ql(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function o1(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function a1(n,e){!Ql(n,e)&&nt[e.type]&&(n.editable||!(e.type in rt))&&nt[e.type](n,e)}rt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Hh(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Tt&&je&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Pr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Pn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||J0(n,t)?t.preventDefault():wn(n,"key")};rt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};rt.keypress=(n,e)=>{let t=e;if(Hh(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||wt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Y)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function So(n){return{left:n.clientX,top:n.clientY}}function l1(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ec(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Dr(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function c1(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&X.isSelectable(r)?(Dr(n,new X(t),"pointer"),!0):!1}function u1(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof X&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(X.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Dr(n,X.create(n.state.doc,i),"pointer"),!0):!1}function d1(n,e,t,r,i){return ec(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?u1(n,t):c1(n,t))}function f1(n,e,t,r){return ec(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function p1(n,e,t,r){return ec(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||h1(n,t,r)}function h1(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Dr(n,Y.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Dr(n,Y.create(r,a+1,a+1+o.content.size),"pointer");else if(X.isSelectable(o))Dr(n,X.create(r,a),"pointer");else continue;return!0}}function tc(n){return Ps(n)}const Bh=wt?"metaKey":"ctrlKey";nt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=tc(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&l1(t,n.input.lastClick)&&!t[Bh]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(So(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new g1(n,o,t,!!r)):(s=="doubleClick"?f1:p1)(n,o.pos,o.inside,t)?t.preventDefault():wn(n,"pointer"))};class g1{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Bh],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof X&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Lt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),wn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>on(this.view)),this.view.input.mouseDown=null}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(So(e))),this.updateAllowDefault(e),this.allowDefault||!t?wn(this.view,"pointer"):d1(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||tt&&this.mightDrag&&!this.mightDrag.node.isAtom||je&&!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)?(Dr(this.view,te.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):wn(this.view,"pointer")}move(e){this.updateAllowDefault(e),wn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}nt.touchstart=n=>{n.input.lastTouch=Date.now(),tc(n),wn(n,"pointer")};nt.touchmove=n=>{n.input.lastTouch=Date.now(),wn(n,"pointer")};nt.contextmenu=n=>tc(n);function Hh(n,e){return n.composing?!0:tt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const m1=Tt?5e3:-1;rt.compositionstart=rt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ps(n,!0),n.markCursor=null;else if(Ps(n),Lt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Ph(n,m1)};rt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Ph(n,20))};function Ph(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ps(n),e))}function $h(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=b1());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function b1(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ps(n,e=!1){if(!(Tt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),$h(n),e||n.docView&&n.docView.dirty){let t=Yl(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function y1(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Si=lt&&Cn<15||Pr&&g0<604;nt.copy=rt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Si?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Th(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):y1(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function v1(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function w1(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?_i(n,r.value,null,i,e):_i(n,r.textContent,r.innerHTML,i,e)},50)}function _i(n,e,t,r,i){let s=Nh(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||F.empty)))return!0;if(!s)return!1;let o=v1(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fh(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}rt.paste=(n,e)=>{let t=e;if(n.composing&&!Tt)return;let r=Si?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&_i(n,Fh(r),r.getData("text/html"),i,t)?t.preventDefault():w1(n,t)};class zh{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Vh=wt?"altKey":"ctrlKey";nt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(So(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof X?i.to-1:i.to))){if(r&&r.mightDrag)o=X.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=X.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c}=Th(n,a);t.dataTransfer.clearData(),t.dataTransfer.setData(Si?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Si||t.dataTransfer.setData("text/plain",c),n.dragging=new zh(a,!t[Vh],o)};nt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};rt.dragover=rt.dragenter=(n,e)=>e.preventDefault();rt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(So(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",h=>{o=h(o,n)}):o=Nh(n,Fh(t.dataTransfer),Si?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!t[Vh]);if(n.someProp("handleDrop",h=>h(n,t,o||F.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?sh(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&X.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new X(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,v,y)=>h=y),c.setSelection(Xl(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};nt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&on(n)},20))};nt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};nt.beforeinput=(n,e)=>{if(je&&Tt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Pn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in rt)nt[n]=rt[n];function Mi(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class $s{constructor(e,t){this.toDOM=e,this.spec=t||Zn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ie(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof $s&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Mi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _n{constructor(e,t){this.attrs=e,this.spec=t||Zn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ie(s,o,this)}valid(e,t){return t.from=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Ze||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Zn)}mapInner(e,t,r,i,s){let o;for(let a=0;a{let c=l+r,u;if(u=Uh(t,a,c)){for(i||(i=this.children.slice());sa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;as&&l.type instanceof _n){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;ci.map(e,t,Zn));return gn.from(r)}forChild(e,t){if(t.isLeaf)return we.empty;let r=[];for(let i=0;it instanceof we)?e:e.reduce((t,r)=>t.concat(r instanceof we?r:r.members),[]))}}}function k1(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,u=s;c{let m=g-h-(p-f);for(let v=0;vy+u-d)continue;let k=a[v]+u-d;p>=k?a[v+1]=f<=k?-2:-1:h>=i&&m&&(a[v]+=m,a[v+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let f=t.map(n[c+1]+s,-1),p=f-i,{index:h,offset:g}=r.content.findIndex(d),m=r.maybeChild(h);if(m&&g==d&&g+m.nodeSize==p){let v=a[c+2].mapInner(t,m,u+1,n[c]+s+1,o);v!=Ze?(a[c]=d,a[c+1]=p,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=E1(a,n,e,t,i,s,o),u=Fs(c,r,0,o);e=u.local;for(let d=0;dt&&o.to{let c=Uh(n,a,l+t);if(c){s=!0;let u=Fs(c,a,t+l+1,r);u!=Ze&&i.push(l,l+a.nodeSize,u)}});let o=qh(s?Kh(n):n,-t).sort(jn);for(let a=0;a0;)e++;n.splice(e,0,t)}function da(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ze&&e.push(r)}),n.cursorWrapper&&e.push(we.create(n.state.doc,[n.cursorWrapper.deco])),gn.from(e)}const x1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},C1=lt&&Cn<=11;class S1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _1{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new S1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),C1&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,x1)),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;tthis.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(Pu(this.view)){if(this.suppressingSelectionUpdates)return on(this.view);if(lt&&Cn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&er(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,r;for(let s=e.focusNode;s;s=Ci(s))t.add(s);for(let s=e.anchorNode;s;s=Ci(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Pu(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u1){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],f=u[1];d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),M1(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||on(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;m--){let v=r.childNodes[m-1],y=v.pmViewDesc;if(v.nodeName=="BR"&&!y){s=m;break}if(!y||y.size)break}let d=n.state.doc,f=n.someProp("domParser")||An.fromSchema(n.state.schema),p=d.resolve(o),h=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:N1,context:p});if(c&&c[0].pos!=null){let m=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=m),h={anchor:m+o,head:v+o}}return{doc:g,sel:h,from:o,to:a}}function N1(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(tt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||tt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const O1=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function L1(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,L=Yl(n,M);if(L&&!n.state.selection.eq(L)){if(je&&Tt&&n.input.lastKeyCode===13&&Date.now()-100q(n,Pn(13,"Enter"))))return;let z=n.state.tr.setSelection(L);M=="pointer"?z.setMeta("pointer",!0):M=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),n.dispatch(z)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=T1(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,p;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Tt)&&i.some(M=>M.nodeType==1&&!O1.test(M.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",M=>M(n,Pn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof Y&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=ju(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let L=n.state.tr.setSelection(M);s&&L.setMeta("composition",s),n.dispatch(L)}}return}if(je&&n.cursorWrapper&&c.sel&&c.sel.anchor==n.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let M=h.endB-h.start;c.sel={anchor:c.sel.anchor+M,head:c.sel.anchor+M}}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),lt&&Cn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),m=c.doc.resolveNoCache(h.endB-c.from),v=u.resolve(h.start),y=g.sameParent(m)&&g.parent.inlineContent&&v.end()>=h.endA,k;if((Pr&&n.input.lastIOSEnter>Date.now()-225&&(!y||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!y&&g.posM(n,Pn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&D1(u,h.start,h.endA,g,m)&&n.someProp("handleKeyDown",M=>M(n,Pn(8,"Backspace")))){Tt&&je&&n.domObserver.suppressSelectionUpdates();return}je&&Tt&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),Tt&&!y&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,m=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Pn(13,"Enter"))})},20));let b=h.start,x=h.endA,w,S,A;if(y){if(g.pos==m.pos)lt&&Cn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>on(n),20)),w=n.state.tr.delete(b,x),S=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(A=R1(g.parent.content.cut(g.parentOffset,m.parentOffset),v.parent.content.cut(v.parentOffset,h.endA-v.start()))))w=n.state.tr,A.type=="add"?w.addMark(b,x,A.mark):w.removeMark(b,x,A.mark);else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset);if(n.someProp("handleTextInput",L=>L(n,b,x,M)))return;w=n.state.tr.insertText(M,b,x)}}if(w||(w=n.state.tr.replace(b,x,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let M=ju(n,w.doc,c.sel);M&&!(je&&Tt&&n.composing&&M.empty&&(h.start!=h.endB||n.input.lastAndroidDeletee.content.size?null:Xl(n,e.resolve(t.anchor),e.resolve(t.head))}function R1(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||fa(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function I1(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o=o?s-r:0;s-=l,s&&s=a?s-r:0;s-=l,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class B1{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 r1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(td),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=Qu(this),Xu(this),this.nodeViews=ed(this),this.docView=Lu(this.state.doc,Yu(this),da(this),this.dom,this),this.domObserver=new _1(this,(r,i,s,o)=>L1(this,r,i,s,o)),this.domObserver.start(),i1(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&&bl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(td),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&($h(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=ed(this);P1(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&bl(this),this.editable=Qu(this),Xu(this);let l=da(this),c=Yu(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&y0(this);if(o){this.domObserver.stop();let p=d&&(lt||je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&H1(i.selection,e.selection);if(d){let h=je?this.trackWrites=this.domSelectionRange().focusNode:null;(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Lu(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&q0(this))?on(this,p):(_h(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&v0(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof X){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&_u(this,t.getBoundingClientRect(),e)}else _u(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 t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new zh(e.slice,e.move,i<0?void 0:X.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return S0(this,e)}coordsAtPos(e,t=1){return yh(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,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return N0(this,t||this.state,e)}pasteHTML(e,t){return _i(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return _i(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(s1(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],da(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return a1(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return tt&&this.root.nodeType===11&&d0(this.dom.ownerDocument)==this.dom?A1(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Yu(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ie.node(0,n.state.doc.content.size,e)]}function Xu(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ie.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Qu(n){return!n.someProp("editable",e=>e(n.state)===!1)}function H1(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function ed(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function P1(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function td(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Tn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$1=typeof navigator<"u"&&/Mac/.test(navigator.platform),F1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ue=0;Ue<10;Ue++)Tn[48+Ue]=Tn[96+Ue]=String(Ue);for(var Ue=1;Ue<=24;Ue++)Tn[Ue+111]="F"+Ue;for(var Ue=65;Ue<=90;Ue++)Tn[Ue]=String.fromCharCode(Ue+32),zs[Ue]=String.fromCharCode(Ue);for(var pa in Tn)zs.hasOwnProperty(pa)||(zs[pa]=Tn[pa]);function z1(n){var e=$1&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||F1&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?zs:Tn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const V1=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function q1(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a127)&&(s=Tn[r.keyCode])&&s!=i){let a=e[ha(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const W1=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function G1(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Z1=(n,e,t)=>{let r=G1(n,t);if(!r)return!1;let i=Wh(r);if(!i){let o=r.blockRange(),a=o&&Gr(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&jh(n,i,e))return!0;if(r.parent.content.size==0&&($r(s,"end")||X.isSelectable(s))){let o=Wl(n.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Wh(r)}let o=s&&s.nodeBefore;return!o||!X.isSelectable(o)?!1:(e&&e(n.tr.setSelection(X.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Wh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function J1(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=J1(n,t);if(!r)return!1;let i=Gh(r);if(!i)return!1;let s=i.nodeAfter;if(jh(n,i,e))return!0;if(r.parent.content.size==0&&($r(s,"start")||X.isSelectable(s))){let o=Wl(n.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof X,i;if(r){if(t.node.isTextblock||!On(n.doc,t.from))return!1;i=t.from}else if(i=ko(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(X.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},ey=(n,e)=>{let t=n.selection,r;if(t instanceof X){if(t.node.isTextblock||!On(n.doc,t.to))return!1;r=t.to}else if(r=ko(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},ty=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Gr(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},ny=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` -`).scrollIntoView()),!0)};function Zh(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Zh(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(te.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},iy=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Et||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Zh(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Lr(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Gr(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},oy=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(X.create(n.doc,i))),!0)};function ay(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||On(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function jh(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(ay(n,e,t))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let d=e.pos+i.nodeSize,f=R.empty;for(let g=s.length-1;g>=0;g--)f=R.from(s[g].create(null,f));f=R.from(r.copy(f));let p=n.tr.step(new He(e.pos-1,d,e.pos,d,new F(f,1,0),s.length,!0)),h=d+2*s.length;On(p.doc,h)&&p.join(h),t(p.scrollIntoView())}return!0}let l=te.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Gr(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(a&&$r(i,"start",!0)&&$r(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(d.canReplace(d.childCount,d.childCount,p.content)){if(t){let g=R.empty;for(let v=f.length-1;v>=0;v--)g=R.from(f[v].copy(g));let m=n.tr.step(new He(e.pos-f.length,e.pos+i.nodeSize,e.pos+h,e.pos+i.nodeSize-h,new F(g,f.length,0),0,!0));t(m.scrollIntoView())}return!0}}return!1}function Jh(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(Y.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const ly=Jh(-1),cy=Jh(1);function uy(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Kl(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function nd(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.doc.resolve(o.start-2);l=new Rs(u,u,o.depth),o.endIndex=0;u--)s=R.from(t[u].type.create(t[u].attrs,s));n.step(new He(e.start-(r?2:0),e.end,e.start,e.end,new F(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?hy(e,t,n,s):gy(e,t,s):!0:!1}}function hy(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sg;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?R.empty:R.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new He(d-(a?1:0),f+(l?1:0),d+1,f-1,new F((a?R.empty:R.from(i.copy(R.empty))).append(l?R.empty:R.from(i.copy(R.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function my(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=R.from(c?n.create():null),d=new F(R.from(n.create(null,R.from(a.type.create(null,u)))),c?3:1,0),f=s.start,p=s.end;t(e.tr.step(new He(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function _o(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class Mo{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...g)=>{const m=this.buildProps(c,t),v=p(...g)(m);return a.push(v),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:_o({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}let by=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function W(n,e,t){return n.config[e]===void 0&&n.parent?W(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?W(n.parent,e,t):null}):n.config[e]}function Ao(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Yh(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ao(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=W(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=W(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function $e(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function fe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function yl(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>fe(t,r),{})}function Xh(n){return typeof n=="function"}function re(n,e=void 0,...t){return Xh(n)?e?n.bind(e)(...t):n(...t):n}function yy(n={}){return Object.keys(n).length===0&&n.constructor===Object}function vy(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function rd(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):vy(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function id(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&yy(t)?!1:t!=null))}function wy(n,e){var t;const r=Yh(n),{nodeExtensions:i,markExtensions:s}=Ao(n),o=(t=i.find(c=>W(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((v,y)=>{const k=W(y,"extendNodeSchema",d);return{...v,...k?k(c):{}}},{}),p=id({...f,content:re(W(c,"content",d)),marks:re(W(c,"marks",d)),group:re(W(c,"group",d)),inline:re(W(c,"inline",d)),atom:re(W(c,"atom",d)),selectable:re(W(c,"selectable",d)),draggable:re(W(c,"draggable",d)),code:re(W(c,"code",d)),defining:re(W(c,"defining",d)),isolating:re(W(c,"isolating",d)),attrs:Object.fromEntries(u.map(v=>{var y;return[v.name,{default:(y=v==null?void 0:v.attribute)===null||y===void 0?void 0:y.default}]}))}),h=re(W(c,"parseHTML",d));h&&(p.parseDOM=h.map(v=>rd(v,u)));const g=W(c,"renderHTML",d);g&&(p.toDOM=v=>g({node:v,HTMLAttributes:yl(v,u)}));const m=W(c,"renderText",d);return m&&(p.toText=m),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((m,v)=>{const y=W(v,"extendMarkSchema",d);return{...m,...y?y(c):{}}},{}),p=id({...f,inclusive:re(W(c,"inclusive",d)),excludes:re(W(c,"excludes",d)),group:re(W(c,"group",d)),spanning:re(W(c,"spanning",d)),code:re(W(c,"code",d)),attrs:Object.fromEntries(u.map(m=>{var v;return[m.name,{default:(v=m==null?void 0:m.attribute)===null||v===void 0?void 0:v.default}]}))}),h=re(W(c,"parseHTML",d));h&&(p.parseDOM=h.map(m=>rd(m,u)));const g=W(c,"renderHTML",d);return g&&(p.toDOM=m=>g({mark:m,HTMLAttributes:yl(m,u)})),[c.name,p]}));return new Jp({topNode:o,nodes:a,marks:l})}function ga(n,e){return e.nodes[n]||e.marks[n]||null}function sd(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const ky=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-s))}),t};function sc(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class qi{constructor(e){this.find=e.find,this.handler=e.handler}}const Ey=(n,e)=>{if(sc(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function ma(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=ky(c)+s;return o.forEach(f=>{if(u)return;const p=Ey(d,f.find);if(!p)return;const h=l.state.tr,g=_o({state:l.state,transaction:h}),m={from:r-(p[0].length-s.length),to:i},{commands:v,chain:y,can:k}=new Mo({editor:t,state:g});f.handler({state:g,range:m,match:p,commands:v,chain:y,can:k})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:s}),l.dispatch(h),u=!0)}),u}function xy(n){const{editor:e,rules:t}=n,r=new Ce({state:{init(){return null},apply(i,s){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:s)}},props:{handleTextInput(i,s,o,a){return ma({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&ma({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ma({editor:e,from:o.pos,to:o.pos,text:` -`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Cy(n){return typeof n=="number"}class Sy{constructor(e){this.find=e.find,this.handler=e.handler}}const _y=(n,e)=>{if(sc(e))return[...n.matchAll(e)];const t=e(n);return t?t.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function My(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Mo({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const g=Math.max(r,h),m=Math.min(i,h+p.content.size),v=p.textBetween(g-h,m-h,void 0,"");_y(v,s.find).forEach(k=>{if(k.index===void 0)return;const b=g+k.index+1,x=b+k[0].length,w={from:t.tr.mapping.map(b),to:t.tr.mapping.map(x)},S=s.handler({state:t,range:w,match:k,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(S)})}),d.every(p=>p!==null)}function Ay(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=new ClipboardEvent("paste"),a=new DragEvent("drop");return t.map(c=>new Ce({view(u){const d=f=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(f.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",d),{destroy(){window.removeEventListener("dragstart",d)}}},props:{handleDOMEvents:{drop:(u,d)=>(s=r===u.dom.parentElement,a=d,!1),paste:(u,d)=>{var f;const p=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(u,d,f)=>{const p=u[0],h=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s;if(!h&&!g)return;const m=d.doc.content.findDiffStart(f.doc.content),v=d.doc.content.findDiffEnd(f.doc.content);if(!Cy(m)||!v||m===v.b)return;const y=f.tr,k=_o({state:f,transaction:y});if(!(!My({editor:e,state:k,from:Math.max(m-1,0),to:v.b-1,rule:c,pasteEvent:o,dropEvent:a})||!y.steps.length))return a=new DragEvent("drop"),o=new ClipboardEvent("paste"),y}}))}function Ty(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Mr{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Mr.resolve(e),this.schema=wy(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const s={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:ga(r.name,this.schema)};r.type==="mark"&&(!((i=re(W(r,"keepOnSplit",s)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const o=W(r,"onBeforeCreate",s);o&&this.editor.on("beforeCreate",o);const a=W(r,"onCreate",s);a&&this.editor.on("create",a);const l=W(r,"onUpdate",s);l&&this.editor.on("update",l);const c=W(r,"onSelectionUpdate",s);c&&this.editor.on("selectionUpdate",c);const u=W(r,"onTransaction",s);u&&this.editor.on("transaction",u);const d=W(r,"onFocus",s);d&&this.editor.on("focus",d);const f=W(r,"onBlur",s);f&&this.editor.on("blur",f);const p=W(r,"onDestroy",s);p&&this.editor.on("destroy",p)})}static resolve(e){const t=Mr.sort(Mr.flatten(e)),r=Ty(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=W(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=W(r,"priority")||100,o=W(i,"priority")||100;return s>o?-1:s{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ga(t.name,this.schema)},i=W(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Mr.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:ga(o.name,this.schema)},l=[],c=W(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>Le.handleExit({editor:e,mark:o})),c){const g=Object.fromEntries(Object.entries(c()).map(([m,v])=>[m,()=>v({editor:e})]));u={...u,...g}}const d=K1(u);l.push(d);const f=W(o,"addInputRules",a);sd(o,e.options.enableInputRules)&&f&&r.push(...f());const p=W(o,"addPasteRules",a);sd(o,e.options.enablePasteRules)&&p&&i.push(...p());const h=W(o,"addProseMirrorPlugins",a);if(h){const g=h();l.push(...g)}return l}).flat();return[xy({editor:e,rules:r}),...Ay({editor:e,rules:i}),...s]}get attributes(){return Yh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ao(this.extensions);return Object.fromEntries(t.filter(r=>!!W(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:$e(r.name,this.schema)},o=W(r,"addNodeView",s);if(!o)return[];const a=(l,c,u,d)=>{const f=yl(l,i);return o()({editor:e,node:l,getPos:u,decorations:d,HTMLAttributes:f,extension:r})};return[r.name,a]}))}}function Ny(n){return Object.prototype.toString.call(n).slice(8,-1)}function ba(n){return Ny(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function To(n,e){const t={...n};return ba(n)&&ba(e)&&Object.keys(e).forEach(r=>{ba(e[r])?r in n?t[r]=To(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class ke{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=re(W(this,"addOptions",{name:this.name}))),this.storage=re(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ke(e)}configure(e={}){const t=this.extend();return t.options=To(this.options,e),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new ke(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=re(W(t,"addOptions",{name:t.name})),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}}function oc(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=` +`);return{dom:l,text:f}}function Oh(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new F(R.from(n.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0):F.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)a=d;else{let f=i.marks(),{schema:p}=n.state,h=Vt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(h.serializeNode(p.text(g,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=t0(t),zi&&n0(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||An.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Q1.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=r0(Ku(a,+u[1],+u[2]),u[4]);else if(a=F.maxOpen(e0(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d{a=d(a,n)}),a}const Q1=/^(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 e0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Rh(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Dh(o[o.length-1],s.length));let u=Lh(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return R.from(o)}return n}function Lh(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,R.from(n));return n}function Rh(n,e,t,r,i){if(i1&&(s=0),i=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(R.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function Ku(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bh().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Ih[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=R.from(l.create(r[a+1],i)),s++,o++}return new F(i,s,o)}const nt={},rt={},i0={touchstart:!0,touchmove:!0};class s0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function o0(n){for(let e in nt){let t=nt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{l0(n,r)&&!rc(n,r)&&(n.editable||!(r.type in rt))&&t(n,r)},i0[e]?{passive:!0}:void 0)}tt&&n.dom.addEventListener("input",()=>null),kl(n)}function wn(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function a0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function kl(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>rc(n,r))})}function rc(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function l0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function c0(n,e){!rc(n,e)&&nt[e.type]&&(n.editable||!(e.type in rt))&&nt[e.type](n,e)}rt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ph(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Tt&&je&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Pr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Pn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||X1(n,t)?t.preventDefault():wn(n,"key")};rt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};rt.keypress=(n,e)=>{let t=e;if(Ph(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||wt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Y)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function _o(n){return{left:n.clientX,top:n.clientY}}function u0(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ic(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Dr(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function d0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&X.isSelectable(r)?(Dr(n,new X(t),"pointer"),!0):!1}function f0(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof X&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(X.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Dr(n,X.create(n.state.doc,i),"pointer"),!0):!1}function p0(n,e,t,r,i){return ic(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?f0(n,t):d0(n,t))}function h0(n,e,t,r){return ic(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function g0(n,e,t,r){return ic(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||m0(n,t,r)}function m0(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Dr(n,Y.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Dr(n,Y.create(r,a+1,a+1+o.content.size),"pointer");else if(X.isSelectable(o))Dr(n,X.create(r,a),"pointer");else continue;return!0}}function sc(n){return $s(n)}const Hh=wt?"metaKey":"ctrlKey";nt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=sc(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&u0(t,n.input.lastClick)&&!t[Hh]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(_o(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new b0(n,o,t,!!r)):(s=="doubleClick"?h0:g0)(n,o.pos,o.inside,t)?t.preventDefault():wn(n,"pointer"))};class b0{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Hh],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof X&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Lt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),wn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>on(this.view)),this.view.input.mouseDown=null}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(_o(e))),this.updateAllowDefault(e),this.allowDefault||!t?wn(this.view,"pointer"):p0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||tt&&this.mightDrag&&!this.mightDrag.node.isAtom||je&&!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)?(Dr(this.view,te.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):wn(this.view,"pointer")}move(e){this.updateAllowDefault(e),wn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}nt.touchstart=n=>{n.input.lastTouch=Date.now(),sc(n),wn(n,"pointer")};nt.touchmove=n=>{n.input.lastTouch=Date.now(),wn(n,"pointer")};nt.contextmenu=n=>sc(n);function Ph(n,e){return n.composing?!0:tt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const y0=Tt?5e3:-1;rt.compositionstart=rt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),$s(n,!0),n.markCursor=null;else if($s(n),Lt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}$h(n,y0)};rt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,$h(n,20))};function $h(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>$s(n),e))}function Fh(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=v0());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function v0(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function $s(n,e=!1){if(!(Tt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Fh(n),e||n.docView&&n.docView.dirty){let t=tc(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function w0(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const _i=lt&&Cn<15||Pr&&b1<604;nt.copy=rt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=_i?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Nh(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):w0(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function k0(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function x0(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Mi(n,r.value,null,i,e):Mi(n,r.textContent,r.innerHTML,i,e)},50)}function Mi(n,e,t,r,i){let s=Oh(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||F.empty)))return!0;if(!s)return!1;let o=k0(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function zh(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}rt.paste=(n,e)=>{let t=e;if(n.composing&&!Tt)return;let r=_i?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Mi(n,zh(r),r.getData("text/html"),i,t)?t.preventDefault():x0(n,t)};class Vh{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const qh=wt?"altKey":"ctrlKey";nt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(_o(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof X?i.to-1:i.to))){if(r&&r.mightDrag)o=X.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=X.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c}=Nh(n,a);t.dataTransfer.clearData(),t.dataTransfer.setData(_i?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",_i||t.dataTransfer.setData("text/plain",c),n.dragging=new Vh(a,!t[qh],o)};nt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};rt.dragover=rt.dragenter=(n,e)=>e.preventDefault();rt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(_o(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",h=>{o=h(o,n)}):o=Oh(n,zh(t.dataTransfer),_i?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!t[qh]);if(n.someProp("handleDrop",h=>h(n,t,o||F.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?oh(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&X.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new X(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,v,y)=>h=y),c.setSelection(nc(n,p,c.doc.resolve(h)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};nt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&on(n)},20))};nt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};nt.beforeinput=(n,e)=>{if(je&&Tt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Pn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in rt)nt[n]=rt[n];function Ai(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Fs{constructor(e,t){this.toDOM=e,this.spec=t||Gn,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ie(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Fs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ai(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _n{constructor(e,t){this.attrs=e,this.spec=t||Gn}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ie(s,o,this)}valid(e,t){return t.from=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==Ge||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Gn)}mapInner(e,t,r,i,s){let o;for(let a=0;a{let c=l+r,u;if(u=Kh(t,a,c)){for(i||(i=this.children.slice());sa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;as&&l.type instanceof _n){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;ci.map(e,t,Gn));return gn.from(r)}forChild(e,t){if(t.isLeaf)return we.empty;let r=[];for(let i=0;it instanceof we)?e:e.reduce((t,r)=>t.concat(r instanceof we?r:r.members),[]))}}}function E0(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,u=s;c{let m=g-h-(p-f);for(let v=0;vy+u-d)continue;let k=a[v]+u-d;p>=k?a[v+1]=f<=k?-2:-1:h>=i&&m&&(a[v]+=m,a[v+1]+=m)}d+=m}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let f=t.map(n[c+1]+s,-1),p=f-i,{index:h,offset:g}=r.content.findIndex(d),m=r.maybeChild(h);if(m&&g==d&&g+m.nodeSize==p){let v=a[c+2].mapInner(t,m,u+1,n[c]+s+1,o);v!=Ge?(a[c]=d,a[c+1]=p,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=C0(a,n,e,t,i,s,o),u=zs(c,r,0,o);e=u.local;for(let d=0;dt&&o.to{let c=Kh(n,a,l+t);if(c){s=!0;let u=zs(c,a,t+l+1,r);u!=Ge&&i.push(l,l+a.nodeSize,u)}});let o=Uh(s?Wh(n):n,-t).sort(jn);for(let a=0;a0;)e++;n.splice(e,0,t)}function ga(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ge&&e.push(r)}),n.cursorWrapper&&e.push(we.create(n.state.doc,[n.cursorWrapper.deco])),gn.from(e)}const S0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},_0=lt&&Cn<=11;class M0{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class A0{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new M0,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),_0&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,S0)),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;tthis.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($u(this.view)){if(this.suppressingSelectionUpdates)return on(this.view);if(lt&&Cn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&er(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,r;for(let s=e.focusNode;s;s=Si(s))t.add(s);for(let s=e.anchorNode;s;s=Si(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&$u(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u1){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],f=u[1];d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),T0(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||on(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;ui;m--){let v=r.childNodes[m-1],y=v.pmViewDesc;if(v.nodeName=="BR"&&!y){s=m;break}if(!y||y.size)break}let d=n.state.doc,f=n.someProp("domParser")||An.fromSchema(n.state.schema),p=d.resolve(o),h=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:L0,context:p});if(c&&c[0].pos!=null){let m=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=m),h={anchor:m+o,head:v+o}}return{doc:g,sel:h,from:o,to:a}}function L0(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(tt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||tt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const R0=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function D0(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,L=tc(n,M);if(L&&!n.state.selection.eq(L)){if(je&&Tt&&n.input.lastKeyCode===13&&Date.now()-100q(n,Pn(13,"Enter"))))return;let z=n.state.tr.setSelection(L);M=="pointer"?z.setMeta("pointer",!0):M=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),n.dispatch(z)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=O0(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,p;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Tt)&&i.some(M=>M.nodeType==1&&!R0.test(M.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",M=>M(n,Pn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof Y&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let M=Ju(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let L=n.state.tr.setSelection(M);s&&L.setMeta("composition",s),n.dispatch(L)}}return}if(je&&n.cursorWrapper&&c.sel&&c.sel.anchor==n.cursorWrapper.deco.from&&c.sel.head==c.sel.anchor){let M=h.endB-h.start;c.sel={anchor:c.sel.anchor+M,head:c.sel.anchor+M}}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),lt&&Cn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let g=c.doc.resolveNoCache(h.start-c.from),m=c.doc.resolveNoCache(h.endB-c.from),v=u.resolve(h.start),y=g.sameParent(m)&&g.parent.inlineContent&&v.end()>=h.endA,k;if((Pr&&n.input.lastIOSEnter>Date.now()-225&&(!y||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!y&&g.posM(n,Pn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&B0(u,h.start,h.endA,g,m)&&n.someProp("handleKeyDown",M=>M(n,Pn(8,"Backspace")))){Tt&&je&&n.domObserver.suppressSelectionUpdates();return}je&&Tt&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),Tt&&!y&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,m=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,Pn(13,"Enter"))})},20));let b=h.start,E=h.endA,w,S,A;if(y){if(g.pos==m.pos)lt&&Cn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>on(n),20)),w=n.state.tr.delete(b,E),S=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(A=I0(g.parent.content.cut(g.parentOffset,m.parentOffset),v.parent.content.cut(v.parentOffset,h.endA-v.start()))))w=n.state.tr,A.type=="add"?w.addMark(b,E,A.mark):w.removeMark(b,E,A.mark);else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset);if(n.someProp("handleTextInput",L=>L(n,b,E,M)))return;w=n.state.tr.insertText(M,b,E)}}if(w||(w=n.state.tr.replace(b,E,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let M=Ju(n,w.doc,c.sel);M&&!(je&&Tt&&n.composing&&M.empty&&(h.start!=h.endB||n.input.lastAndroidDeletee.content.size?null:nc(n,e.resolve(t.anchor),e.resolve(t.head))}function I0(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||ma(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function H0(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o=o?s-r:0;s-=l,s&&s=a?s-r:0;s-=l,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class P0{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 s0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(nd),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=ed(this),Qu(this),this.nodeViews=td(this),this.docView=Ru(this.state.doc,Xu(this),ga(this),this.dom,this),this.domObserver=new A0(this,(r,i,s,o)=>D0(this,r,i,s,o)),this.domObserver.start(),o0(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&&kl(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Fh(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=td(this);F0(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&kl(this),this.editable=ed(this),Qu(this);let l=ga(this),c=Xu(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&w1(this);if(o){this.domObserver.stop();let p=d&&(lt||je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&$0(i.selection,e.selection);if(d){let h=je?this.trackWrites=this.domSelectionRange().focusNode:null;(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Ru(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&K1(this))?on(this,p):(Mh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&k1(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof X){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Mu(this,t.getBoundingClientRect(),e)}else Mu(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 t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Vh(e.slice,e.move,i<0?void 0:X.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return M1(this,e)}coordsAtPos(e,t=1){return vh(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,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return L1(this,t||this.state,e)}pasteHTML(e,t){return Mi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Mi(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(a0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ga(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return c0(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return tt&&this.root.nodeType===11&&p1(this.dom.ownerDocument)==this.dom?N0(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Xu(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ie.node(0,n.state.doc.content.size,e)]}function Qu(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ie.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ed(n){return!n.someProp("editable",e=>e(n.state)===!1)}function $0(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function td(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function F0(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function nd(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Tn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Vs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},z0=typeof navigator<"u"&&/Mac/.test(navigator.platform),V0=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ke=0;Ke<10;Ke++)Tn[48+Ke]=Tn[96+Ke]=String(Ke);for(var Ke=1;Ke<=24;Ke++)Tn[Ke+111]="F"+Ke;for(var Ke=65;Ke<=90;Ke++)Tn[Ke]=String.fromCharCode(Ke+32),Vs[Ke]=String.fromCharCode(Ke);for(var ba in Tn)Vs.hasOwnProperty(ba)||(Vs[ba]=Tn[ba]);function q0(n){var e=z0&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||V0&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Vs:Tn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const U0=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function K0(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a127)&&(s=Tn[r.keyCode])&&s!=i){let a=e[ya(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const G0=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function j0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const J0=(n,e,t)=>{let r=j0(n,t);if(!r)return!1;let i=Zh(r);if(!i){let o=r.blockRange(),a=o&&Gr(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&Jh(n,i,e))return!0;if(r.parent.content.size==0&&($r(s,"end")||X.isSelectable(s))){let o=Jl(n.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Zh(r)}let o=s&&s.nodeBefore;return!o||!X.isSelectable(o)?!1:(e&&e(n.tr.setSelection(X.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Zh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function X0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=X0(n,t);if(!r)return!1;let i=Gh(r);if(!i)return!1;let s=i.nodeAfter;if(Jh(n,i,e))return!0;if(r.parent.content.size==0&&($r(s,"start")||X.isSelectable(s))){let o=Jl(n.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof X,i;if(r){if(t.node.isTextblock||!On(n.doc,t.from))return!1;i=t.from}else if(i=xo(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(X.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},ny=(n,e)=>{let t=n.selection,r;if(t instanceof X){if(t.node.isTextblock||!On(n.doc,t.to))return!1;r=t.to}else if(r=xo(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},ry=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Gr(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},iy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};function jh(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=jh(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(te.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},oy=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof xt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jh(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Lr(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Gr(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},ly=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(X.create(n.doc,i))),!0)};function cy(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||On(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Jh(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(cy(n,e,t))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let d=e.pos+i.nodeSize,f=R.empty;for(let g=s.length-1;g>=0;g--)f=R.from(s[g].create(null,f));f=R.from(r.copy(f));let p=n.tr.step(new He(e.pos-1,d,e.pos,d,new F(f,1,0),s.length,!0)),h=d+2*s.length;On(p.doc,h)&&p.join(h),t(p.scrollIntoView())}return!0}let l=te.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&Gr(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(a&&$r(i,"start",!0)&&$r(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let p=i,h=1;for(;!p.isTextblock;p=p.firstChild)h++;if(d.canReplace(d.childCount,d.childCount,p.content)){if(t){let g=R.empty;for(let v=f.length-1;v>=0;v--)g=R.from(f[v].copy(g));let m=n.tr.step(new He(e.pos-f.length,e.pos+i.nodeSize,e.pos+h,e.pos+i.nodeSize-h,new F(g,f.length,0),0,!0));t(m.scrollIntoView())}return!0}}return!1}function Yh(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(Y.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const uy=Yh(-1),dy=Yh(1);function fy(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&jl(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function rd(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.doc.resolve(o.start-2);l=new Ds(u,u,o.depth),o.endIndex=0;u--)s=R.from(t[u].type.create(t[u].attrs,s));n.step(new He(e.start-(r?2:0),e.end,e.start,e.end,new F(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?my(e,t,n,s):by(e,t,s):!0:!1}}function my(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sg;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?R.empty:R.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new He(d-(a?1:0),f+(l?1:0),d+1,f-1,new F((a?R.empty:R.from(i.copy(R.empty))).append(l?R.empty:R.from(i.copy(R.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function yy(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=R.from(c?n.create():null),d=new F(R.from(n.create(null,R.from(a.type.create(null,u)))),c?3:1,0),f=s.start,p=s.end;t(e.tr.step(new He(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}function Mo(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class Ao{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,p])=>[f,(...g)=>{const m=this.buildProps(c,t),v=p(...g)(m);return a.push(v),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Mo({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}let vy=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function W(n,e,t){return n.config[e]===void 0&&n.parent?W(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?W(n.parent,e,t):null}):n.config[e]}function To(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Xh(n){const e=[],{nodeExtensions:t,markExtensions:r}=To(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=W(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...s,...p}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=W(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function $e(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function fe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(u=>!l.includes(u));r[i]=[...l,...c].join(" ")}else i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function xl(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>fe(t,r),{})}function Qh(n){return typeof n=="function"}function ie(n,e=void 0,...t){return Qh(n)?e?n.bind(e)(...t):n(...t):n}function wy(n={}){return Object.keys(n).length===0&&n.constructor===Object}function ky(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function id(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):ky(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function sd(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&wy(t)?!1:t!=null))}function xy(n,e){var t;const r=Xh(n),{nodeExtensions:i,markExtensions:s}=To(n),o=(t=i.find(c=>W(c,"topNode")))===null||t===void 0?void 0:t.name,a=Object.fromEntries(i.map(c=>{const u=r.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((v,y)=>{const k=W(y,"extendNodeSchema",d);return{...v,...k?k(c):{}}},{}),p=sd({...f,content:ie(W(c,"content",d)),marks:ie(W(c,"marks",d)),group:ie(W(c,"group",d)),inline:ie(W(c,"inline",d)),atom:ie(W(c,"atom",d)),selectable:ie(W(c,"selectable",d)),draggable:ie(W(c,"draggable",d)),code:ie(W(c,"code",d)),defining:ie(W(c,"defining",d)),isolating:ie(W(c,"isolating",d)),attrs:Object.fromEntries(u.map(v=>{var y;return[v.name,{default:(y=v==null?void 0:v.attribute)===null||y===void 0?void 0:y.default}]}))}),h=ie(W(c,"parseHTML",d));h&&(p.parseDOM=h.map(v=>id(v,u)));const g=W(c,"renderHTML",d);g&&(p.toDOM=v=>g({node:v,HTMLAttributes:xl(v,u)}));const m=W(c,"renderText",d);return m&&(p.toText=m),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((m,v)=>{const y=W(v,"extendMarkSchema",d);return{...m,...y?y(c):{}}},{}),p=sd({...f,inclusive:ie(W(c,"inclusive",d)),excludes:ie(W(c,"excludes",d)),group:ie(W(c,"group",d)),spanning:ie(W(c,"spanning",d)),code:ie(W(c,"code",d)),attrs:Object.fromEntries(u.map(m=>{var v;return[m.name,{default:(v=m==null?void 0:m.attribute)===null||v===void 0?void 0:v.default}]}))}),h=ie(W(c,"parseHTML",d));h&&(p.parseDOM=h.map(m=>id(m,u)));const g=W(c,"renderHTML",d);return g&&(p.toDOM=m=>g({mark:m,HTMLAttributes:xl(m,u)})),[c.name,p]}));return new Yp({topNode:o,nodes:a,marks:l})}function va(n,e){return e.nodes[n]||e.marks[n]||null}function od(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const Ey=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-s))}),t};function cc(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class qi{constructor(e){this.find=e.find,this.handler=e.handler}}const Cy=(n,e)=>{if(cc(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function wa(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Ey(c)+s;return o.forEach(f=>{if(u)return;const p=Cy(d,f.find);if(!p)return;const h=l.state.tr,g=Mo({state:l.state,transaction:h}),m={from:r-(p[0].length-s.length),to:i},{commands:v,chain:y,can:k}=new Ao({editor:t,state:g});f.handler({state:g,range:m,match:p,commands:v,chain:y,can:k})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:r,to:i,text:s}),l.dispatch(h),u=!0)}),u}function Sy(n){const{editor:e,rules:t}=n,r=new Ce({state:{init(){return null},apply(i,s){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:s)}},props:{handleTextInput(i,s,o,a){return wa({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&wa({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?wa({editor:e,from:o.pos,to:o.pos,text:` +`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function _y(n){return typeof n=="number"}class My{constructor(e){this.find=e.find,this.handler=e.handler}}const Ay=(n,e)=>{if(cc(e))return[...n.matchAll(e)];const t=e(n);return t?t.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function Ty(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:u}=new Ao({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const g=Math.max(r,h),m=Math.min(i,h+p.content.size),v=p.textBetween(g-h,m-h,void 0,"");Ay(v,s.find).forEach(k=>{if(k.index===void 0)return;const b=g+k.index+1,E=b+k[0].length,w={from:t.tr.mapping.map(b),to:t.tr.mapping.map(E)},S=s.handler({state:t,range:w,match:k,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(S)})}),d.every(p=>p!==null)}function Ny(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=new ClipboardEvent("paste"),a=new DragEvent("drop");return t.map(c=>new Ce({view(u){const d=f=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(f.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",d),{destroy(){window.removeEventListener("dragstart",d)}}},props:{handleDOMEvents:{drop:(u,d)=>(s=r===u.dom.parentElement,a=d,!1),paste:(u,d)=>{var f;const p=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(u,d,f)=>{const p=u[0],h=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s;if(!h&&!g)return;const m=d.doc.content.findDiffStart(f.doc.content),v=d.doc.content.findDiffEnd(f.doc.content);if(!_y(m)||!v||m===v.b)return;const y=f.tr,k=Mo({state:f,transaction:y});if(!(!Ty({editor:e,state:k,from:Math.max(m-1,0),to:v.b-1,rule:c,pasteEvent:o,dropEvent:a})||!y.steps.length))return a=new DragEvent("drop"),o=new ClipboardEvent("paste"),y}}))}function Oy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Mr{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Mr.resolve(e),this.schema=xy(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const s={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:va(r.name,this.schema)};r.type==="mark"&&(!((i=ie(W(r,"keepOnSplit",s)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const o=W(r,"onBeforeCreate",s);o&&this.editor.on("beforeCreate",o);const a=W(r,"onCreate",s);a&&this.editor.on("create",a);const l=W(r,"onUpdate",s);l&&this.editor.on("update",l);const c=W(r,"onSelectionUpdate",s);c&&this.editor.on("selectionUpdate",c);const u=W(r,"onTransaction",s);u&&this.editor.on("transaction",u);const d=W(r,"onFocus",s);d&&this.editor.on("focus",d);const f=W(r,"onBlur",s);f&&this.editor.on("blur",f);const p=W(r,"onDestroy",s);p&&this.editor.on("destroy",p)})}static resolve(e){const t=Mr.sort(Mr.flatten(e)),r=Oy(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=W(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=W(r,"priority")||100,o=W(i,"priority")||100;return s>o?-1:s{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:va(t.name,this.schema)},i=W(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Mr.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:va(o.name,this.schema)},l=[],c=W(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>Le.handleExit({editor:e,mark:o})),c){const g=Object.fromEntries(Object.entries(c()).map(([m,v])=>[m,()=>v({editor:e})]));u={...u,...g}}const d=Z0(u);l.push(d);const f=W(o,"addInputRules",a);od(o,e.options.enableInputRules)&&f&&r.push(...f());const p=W(o,"addPasteRules",a);od(o,e.options.enablePasteRules)&&p&&i.push(...p());const h=W(o,"addProseMirrorPlugins",a);if(h){const g=h();l.push(...g)}return l}).flat();return[Sy({editor:e,rules:r}),...Ny({editor:e,rules:i}),...s]}get attributes(){return Xh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=To(this.extensions);return Object.fromEntries(t.filter(r=>!!W(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:$e(r.name,this.schema)},o=W(r,"addNodeView",s);if(!o)return[];const a=(l,c,u,d)=>{const f=xl(l,i);return o()({editor:e,node:l,getPos:u,decorations:d,HTMLAttributes:f,extension:r})};return[r.name,a]}))}}function Ly(n){return Object.prototype.toString.call(n).slice(8,-1)}function ka(n){return Ly(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function No(n,e){const t={...n};return ka(n)&&ka(e)&&Object.keys(e).forEach(r=>{ka(e[r])?r in n?t[r]=No(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class ke{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ie(W(this,"addOptions",{name:this.name}))),this.storage=ie(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ke(e)}configure(e={}){const t=this.extend();return t.options=No(this.options,e),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new ke(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ie(W(t,"addOptions",{name:t.name})),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}}function uc(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=` -`,textSerializers:o={}}=t||{};let a="",l=!0;return n.nodesBetween(r,i,(c,u,d,f)=>{var p;const h=o==null?void 0:o[c.type.name];h?(c.isBlock&&!l&&(a+=s,l=!0),d&&(a+=h({node:c,pos:u,parent:d,index:f,range:e}))):c.isText?(a+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,i-u),l=!1):c.isBlock&&!l&&(a+=s,l=!0)}),a}function Qh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Oy=ke.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ce({key:new _e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Qh(t);return oc(r,{from:o,to:a},{textSerializers:l})}}})]}}),Ly=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Ry=(n=!1)=>({commands:e})=>e.setContent("",n),Dy=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Gr(p);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(h||h===0)&&e.lift(p,h)})}),!0},Iy=n=>e=>n(e),By=()=>({state:n,dispatch:e})=>iy(n,e),Hy=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Y(r.doc.resolve(o-1))),!0},Py=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1},$y=n=>({tr:e,state:t,dispatch:r})=>{const i=$e(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Fy=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},zy=()=>({state:n,dispatch:e})=>W1(n,e),Vy=()=>({commands:n})=>n.keyboardShortcut("Enter"),qy=()=>({state:n,dispatch:e})=>ry(n,e);function Fr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:sc(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function vl(n,e,t={}){return n.find(r=>r.type===e&&Fr(r.attrs,t))}function Uy(n,e,t={}){return!!vl(n,e,t)}function ac(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=vl([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(vl([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;a({tr:t,state:r,dispatch:i})=>{const s=ln(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=ac(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=Y.create(o,d.from,d.to);t.setSelection(f)}}return!0},Wy=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{cc()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!lc(t.state.selection))return o(),!0;const a=eg(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Zy=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),jy=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e);function od(n){const e=`${n}`;return new window.DOMParser().parseFromString(e,"text/html").body}function Vs(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?R.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Vs("",e,t)}if(typeof n=="string"){const r=An.fromSchema(e);return t.slice?r.parseSlice(od(n),t.parseOptions).content:r.parse(od(n),t.parseOptions)}return Vs("",e,t)}function Jy(n,e,t){const r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(te.near(n.doc.resolve(o),t))}const Yy=n=>n.toString().startsWith("<"),Xy=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const o=Vs(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},c=!0,u=!0;if((Yy(o)?o:[o]).forEach(f=>{f.check(),c=c?f.isText&&f.marks.length===0:!1,u=u?f.isBlock:!1}),a===l&&u){const{parent:f}=r.doc.resolve(a);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(a-=1,l+=1)}c?Array.isArray(e)?r.insertText(e.map(f=>f.text||"").join(""),a,l):typeof e=="object"&&e&&e.text?r.insertText(e.text,a,l):r.insertText(e,a,l):r.replaceWith(a,l,o),t.updateSelection&&Jy(r,r.steps.length-1,-1)}return!0},Qy=()=>({state:n,dispatch:e})=>Q1(n,e),ev=()=>({state:n,dispatch:e})=>ey(n,e),tv=()=>({state:n,dispatch:e})=>Z1(n,e),nv=()=>({state:n,dispatch:e})=>Y1(n,e),rv=()=>({tr:n,state:e,dispatch:t})=>{try{const r=ko(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},iv=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ko(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}};function uc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function sv(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a({editor:e,view:t,tr:r,dispatch:i})=>{const s=sv(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function nr(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?$e(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(i,f+d.nodeSize);a.push({node:d,from:p,to:h})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Fr(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const av=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return nr(t,i,e)?ty(t,r):!1},lv=()=>({state:n,dispatch:e})=>sy(n,e),cv=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return py(r)(e,t)},uv=()=>({state:n,dispatch:e})=>ny(n,e);function No(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ad(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const dv=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=No(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=ln(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,ad(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(u,u+c.nodeSize,o.create(ad(d.attrs,e)))})})}),!0):!1},fv=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),pv=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),hv=()=>({state:n,dispatch:e})=>j1(n,e),gv=()=>({state:n,dispatch:e})=>X1(n,e),mv=()=>({state:n,dispatch:e})=>oy(n,e),bv=()=>({state:n,dispatch:e})=>cy(n,e),yv=()=>({state:n,dispatch:e})=>ly(n,e);function tg(n,e,t={}){return Vs(n,e,{slice:!1,parseOptions:t})}const vv=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=tg(n,i.schema,t);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function Ui(n,e){const t=ln(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function wv(n,e){const t=new Gl(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function kv(n){for(let e=0;e{e(r)&&t.push({node:r,pos:i})}),t}function Ev(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function ng(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Oo(n){return e=>ng(e.$from,n)}function dc(n,e){const t=Vt.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function xv(n,e){const t={from:0,to:n.content.size};return oc(n,t,e)}function Cv(n,e){const t=$e(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function rg(n,e){const t=No(typeof e=="string"?e:e.name,n.schema);return t==="node"?Cv(n,e):t==="mark"?Ui(n,e):{}}function Sv(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function _v(n){const e=Sv(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Mv(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),_v(r)}function fc(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n-1),o=ac(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function xs(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function kl(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?ln(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Fr(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;n.doc.nodesBetween(p,h,(g,m)=>{if(!g.isText&&!g.marks.length)return;const v=Math.max(p,m),y=Math.min(h,m+g.nodeSize),k=y-v;o+=k,a.push(...g.marks.map(b=>({mark:b,from:v,to:y})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Fr(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function Av(n,e,t={}){if(!e)return nr(n,null,t)||kl(n,null,t);const r=No(e,n.schema);return r==="node"?nr(n,e,t):r==="mark"?kl(n,e,t):!1}function ld(n,e){const{nodeExtensions:t}=Ao(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=re(W(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Tv(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function Nv(n){return n instanceof X}function pc(n,e,t){const i=n.state.doc.content.size,s=sn(e,0,i),o=sn(t,0,i),a=n.coordsAtPos(s),l=n.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),p=f-d,h=u-c,v={top:c,bottom:u,left:d,right:f,width:p,height:h,x:d,y:c};return{...v,toJSON:()=>v}}function Ov(n,e,t){var r;const{selection:i}=e;let s=null;if(lc(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(t),h=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));c=p&&h}return!c}),c})}const Lv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=ln(n,r.schema);if(i)if(o){const c=Ui(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(v=>v.type===l)?f.marks.forEach(v=>{l===v.type&&t.addMark(h,g,l.create({...v.attrs,...e}))}):t.addMark(h,g,l.create(e))})});return Ov(r,t,l)},Rv=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Dv=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=$e(n,t.schema);return s.isTextblock?i().command(({commands:o})=>nd(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>nd(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Iv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=sn(n,0,r.content.size),s=X.create(r,i);e.setSelection(s)}return!0},Bv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=Y.atStart(r).from,a=Y.atEnd(r).to,l=sn(i,o,a),c=sn(s,o,a),u=Y.create(r,l,c);e.setSelection(u)}return!0},Hv=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return my(r)(e,t)};function cd(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const Pv=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=xs(c,a.node().type.name,a.node().attrs);if(s instanceof X&&s.node.isBlock)return!a.parentOffset||!Lr(o,a.pos)?!1:(r&&(n&&cd(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const d=l.parentOffset===l.parent.content.size;s instanceof Y&&e.deleteSelection();const f=a.depth===0?void 0:kv(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=Lr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&Lr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),h&&(e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&cd(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},$v=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var s;const o=$e(n,t.schema),{$from:a,$to:l}=t.selection,c=t.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const d=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let m=R.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let S=a.depth-v;S>=a.depth-3;S-=1)m=R.from(a.node(S).copy(m));const y=a.indexAfter(-1){if(w>-1)return!1;S.isTextblock&&S.content.size===0&&(w=A+1)}),w>-1&&e.setSelection(Y.near(e.doc.resolve(w))),e.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=xs(d,u.type.name,u.attrs),h=xs(d,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const g=f?[{type:o,attrs:p},{type:f,attrs:h}]:[{type:o,attrs:p}];if(!Lr(e.doc,a.pos,2))return!1;if(r){const{selection:m,storedMarks:v}=t,{splittableMarks:y}=i.extensionManager,k=v||m.$to.parentOffset&&m.$from.marks();if(e.split(a.pos,2,g).scrollIntoView(),!k||!r)return!0;const b=k.filter(x=>y.includes(x.type.name));e.ensureMarks(b)}return!0},ya=(n,e)=>{const t=Oo(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&On(n.doc,t.pos)&&n.join(t.pos),!0},va=(n,e)=>{const t=Oo(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&On(n.doc,r)&&n.join(r),!0},Fv=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,p=$e(n,o.schema),h=$e(e,o.schema),{selection:g,storedMarks:m}=o,{$from:v,$to:y}=g,k=v.blockRange(y),b=m||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const x=Oo(w=>ld(w.type.name,d))(g);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(h);if(ld(x.node.type.name,d)&&p.validContent(x.node.content)&&a)return l().command(()=>(s.setNodeMarkup(x.pos,p),!0)).command(()=>ya(s,p)).command(()=>va(s,p)).run()}return!t||!b||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>ya(s,p)).command(()=>va(s,p)).run():l().command(()=>{const w=u().wrapInList(p,r),S=b.filter(A=>f.includes(A.type.name));return s.ensureMarks(S),w?!0:c.clearNodes()}).wrapInList(p,r).command(()=>ya(s,p)).command(()=>va(s,p)).run()},zv=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ln(n,r.schema);return kl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Vv=(n,e,t={})=>({state:r,commands:i})=>{const s=$e(n,r.schema),o=$e(e,r.schema);return nr(r,s,t)?i.setNode(o):i.setNode(s,t)},qv=(n,e={})=>({state:t,commands:r})=>{const i=$e(n,t.schema);return nr(t,i,e)?r.lift(i):r.wrapIn(i,e)},Uv=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Kv=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},Wv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=ln(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:f,to:p}=a;const h=(s=c.marks().find(m=>m.type===l))===null||s===void 0?void 0:s.attrs,g=ac(c,l,h);g&&(f=g.from,p=g.to),t.removeMark(f,p,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},Gv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=No(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=ln(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{s&&s===d.type&&t.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(p=>{if(o===p.type){const h=Math.max(f,c),g=Math.min(f+d.nodeSize,u);t.addMark(h,g,o.create({...p.attrs,...e}))}})})}),!0):!1},Zv=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return uy(i,e)(t,r)},jv=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return dy(i,e)(t,r)};var Jv=Object.freeze({__proto__:null,blur:Ly,clearContent:Ry,clearNodes:Dy,command:Iy,createParagraphNear:By,cut:Hy,deleteCurrentNode:Py,deleteNode:$y,deleteRange:Fy,deleteSelection:zy,enter:Vy,exitCode:qy,extendMarkRange:Ky,first:Wy,focus:Gy,forEach:Zy,insertContent:jy,insertContentAt:Xy,joinUp:Qy,joinDown:ev,joinBackward:tv,joinForward:nv,joinItemBackward:rv,joinItemForward:iv,keyboardShortcut:ov,lift:av,liftEmptyBlock:lv,liftListItem:cv,newlineInCode:uv,resetAttributes:dv,scrollIntoView:fv,selectAll:pv,selectNodeBackward:hv,selectNodeForward:gv,selectParentNode:mv,selectTextblockEnd:bv,selectTextblockStart:yv,setContent:vv,setMark:Lv,setMeta:Rv,setNode:Dv,setNodeSelection:Iv,setTextSelection:Bv,sinkListItem:Hv,splitBlock:Pv,splitListItem:$v,toggleList:Fv,toggleMark:zv,toggleNode:Vv,toggleWrap:qv,undoInputRule:Uv,unsetAllMarks:Kv,unsetMark:Wv,updateAttributes:Gv,wrapIn:Zv,wrapInList:jv});const Yv=ke.create({name:"commands",addCommands(){return{...Jv}}}),Xv=ke.create({name:"editable",addProseMirrorPlugins(){return[new Ce({key:new _e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Qv=ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ce({key:new _e("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ew=ke.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock?a.doc.resolve(f-1):d,g=h.parent.type.spec.isolating,m=d.pos-d.parentOffset,v=g&&h.parent.childCount===1?m===d.pos:te.atStart(c).from===f;return!u||!v||!p.type.isTextblock||p.textContent.length?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return cc()||uc()?s:i},addProseMirrorPlugins(){return[new Ce({key:new _e("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(h=>h.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=te.atStart(e.doc).from,l=te.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const d=t.tr,f=_o({state:t,transaction:d}),{commands:p}=new Mo({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}}),tw=ke.create({name:"tabindex",addProseMirrorPlugins(){return[new Ce({key:new _e("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var ig=Object.freeze({__proto__:null,ClipboardTextSerializer:Oy,Commands:Yv,Editable:Xv,FocusEvents:Qv,Keymap:ew,Tabindex:tw});const nw=`.ProseMirror { +`,textSerializers:o={}}=t||{};let a="",l=!0;return n.nodesBetween(r,i,(c,u,d,f)=>{var p;const h=o==null?void 0:o[c.type.name];h?(c.isBlock&&!l&&(a+=s,l=!0),d&&(a+=h({node:c,pos:u,parent:d,index:f,range:e}))):c.isText?(a+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,u)-u,i-u),l=!1):c.isBlock&&!l&&(a+=s,l=!0)}),a}function eg(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Ry=ke.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ce({key:new _e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=eg(t);return uc(r,{from:o,to:a},{textSerializers:l})}}})]}}),Dy=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Iy=(n=!1)=>({commands:e})=>e.setContent("",n),By=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Gr(p);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(h||h===0)&&e.lift(p,h)})}),!0},Hy=n=>e=>n(e),Py=()=>({state:n,dispatch:e})=>oy(n,e),$y=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Y(r.doc.resolve(o-1))),!0},Fy=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1},zy=n=>({tr:e,state:t,dispatch:r})=>{const i=$e(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Vy=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},qy=()=>({state:n,dispatch:e})=>G0(n,e),Uy=()=>({commands:n})=>n.keyboardShortcut("Enter"),Ky=()=>({state:n,dispatch:e})=>sy(n,e);function Fr(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:cc(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function El(n,e,t={}){return n.find(r=>r.type===e&&Fr(r.attrs,t))}function Wy(n,e,t={}){return!!El(n,e,t)}function dc(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=El([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(El([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;a({tr:t,state:r,dispatch:i})=>{const s=ln(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=dc(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=Y.create(o,d.from,d.to);t.setSelection(f)}}return!0},Gy=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{pc()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!fc(t.state.selection))return o(),!0;const a=tg(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Jy=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Yy=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e);function ad(n){const e=`${n}`;return new window.DOMParser().parseFromString(e,"text/html").body}function qs(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?R.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),qs("",e,t)}if(typeof n=="string"){const r=An.fromSchema(e);return t.slice?r.parseSlice(ad(n),t.parseOptions).content:r.parse(ad(n),t.parseOptions)}return qs("",e,t)}function Xy(n,e,t){const r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(te.near(n.doc.resolve(o),t))}const Qy=n=>n.toString().startsWith("<"),ev=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const o=qs(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},c=!0,u=!0;if((Qy(o)?o:[o]).forEach(f=>{f.check(),c=c?f.isText&&f.marks.length===0:!1,u=u?f.isBlock:!1}),a===l&&u){const{parent:f}=r.doc.resolve(a);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(a-=1,l+=1)}c?Array.isArray(e)?r.insertText(e.map(f=>f.text||"").join(""),a,l):typeof e=="object"&&e&&e.text?r.insertText(e.text,a,l):r.insertText(e,a,l):r.replaceWith(a,l,o),t.updateSelection&&Xy(r,r.steps.length-1,-1)}return!0},tv=()=>({state:n,dispatch:e})=>ty(n,e),nv=()=>({state:n,dispatch:e})=>ny(n,e),rv=()=>({state:n,dispatch:e})=>J0(n,e),iv=()=>({state:n,dispatch:e})=>Q0(n,e),sv=()=>({tr:n,state:e,dispatch:t})=>{try{const r=xo(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ov=()=>({state:n,dispatch:e,tr:t})=>{try{const r=xo(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}};function hc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function av(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a({editor:e,view:t,tr:r,dispatch:i})=>{const s=av(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function nr(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?$e(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(i,f+d.nodeSize);a.push({node:d,from:p,to:h})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Fr(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const cv=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return nr(t,i,e)?ry(t,r):!1},uv=()=>({state:n,dispatch:e})=>ay(n,e),dv=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return gy(r)(e,t)},fv=()=>({state:n,dispatch:e})=>iy(n,e);function Oo(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ld(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const pv=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=Oo(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=ln(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,ld(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(u,u+c.nodeSize,o.create(ld(d.attrs,e)))})})}),!0):!1},hv=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),gv=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),mv=()=>({state:n,dispatch:e})=>Y0(n,e),bv=()=>({state:n,dispatch:e})=>ey(n,e),yv=()=>({state:n,dispatch:e})=>ly(n,e),vv=()=>({state:n,dispatch:e})=>dy(n,e),wv=()=>({state:n,dispatch:e})=>uy(n,e);function ng(n,e,t={}){return qs(n,e,{slice:!1,parseOptions:t})}const kv=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=ng(n,i.schema,t);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function Ui(n,e){const t=ln(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function xv(n,e){const t=new Yl(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Ev(n){for(let e=0;e{e(r)&&t.push({node:r,pos:i})}),t}function Cv(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function rg(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Lo(n){return e=>rg(e.$from,n)}function gc(n,e){const t=Vt.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Sv(n,e){const t={from:0,to:n.content.size};return uc(n,t,e)}function _v(n,e){const t=$e(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function ig(n,e){const t=Oo(typeof e=="string"?e:e.name,n.schema);return t==="node"?_v(n,e):t==="mark"?Ui(n,e):{}}function Mv(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Av(n){const e=Mv(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Tv(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Av(r)}function mc(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n-1),o=dc(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function Cs(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Sl(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?ln(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Fr(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;n.doc.nodesBetween(p,h,(g,m)=>{if(!g.isText&&!g.marks.length)return;const v=Math.max(p,m),y=Math.min(h,m+g.nodeSize),k=y-v;o+=k,a.push(...g.marks.map(b=>({mark:b,from:v,to:y})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Fr(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function Nv(n,e,t={}){if(!e)return nr(n,null,t)||Sl(n,null,t);const r=Oo(e,n.schema);return r==="node"?nr(n,e,t):r==="mark"?Sl(n,e,t):!1}function cd(n,e){const{nodeExtensions:t}=To(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ie(W(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Ov(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function sg(n){return n instanceof X}function Ro(n,e,t){const i=n.state.doc.content.size,s=sn(e,0,i),o=sn(t,0,i),a=n.coordsAtPos(s),l=n.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),p=f-d,h=u-c,v={top:c,bottom:u,left:d,right:f,width:p,height:h,x:d,y:c};return{...v,toJSON:()=>v}}function Lv(n,e,t){var r;const{selection:i}=e;let s=null;if(fc(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(t),h=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));c=p&&h}return!c}),c})}const Rv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=ln(n,r.schema);if(i)if(o){const c=Ui(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(v=>v.type===l)?f.marks.forEach(v=>{l===v.type&&t.addMark(h,g,l.create({...v.attrs,...e}))}):t.addMark(h,g,l.create(e))})});return Lv(r,t,l)},Dv=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Iv=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=$e(n,t.schema);return s.isTextblock?i().command(({commands:o})=>rd(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>rd(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Bv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=sn(n,0,r.content.size),s=X.create(r,i);e.setSelection(s)}return!0},Hv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=Y.atStart(r).from,a=Y.atEnd(r).to,l=sn(i,o,a),c=sn(s,o,a),u=Y.create(r,l,c);e.setSelection(u)}return!0},Pv=n=>({state:e,dispatch:t})=>{const r=$e(n,e.schema);return yy(r)(e,t)};function ud(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const $v=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=Cs(c,a.node().type.name,a.node().attrs);if(s instanceof X&&s.node.isBlock)return!a.parentOffset||!Lr(o,a.pos)?!1:(r&&(n&&ud(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const d=l.parentOffset===l.parent.content.size;s instanceof Y&&e.deleteSelection();const f=a.depth===0?void 0:Ev(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,h=Lr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&Lr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:u}]:void 0),h&&(e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&ud(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Fv=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var s;const o=$e(n,t.schema),{$from:a,$to:l}=t.selection,c=t.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const d=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let m=R.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let S=a.depth-v;S>=a.depth-3;S-=1)m=R.from(a.node(S).copy(m));const y=a.indexAfter(-1){if(w>-1)return!1;S.isTextblock&&S.content.size===0&&(w=A+1)}),w>-1&&e.setSelection(Y.near(e.doc.resolve(w))),e.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Cs(d,u.type.name,u.attrs),h=Cs(d,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const g=f?[{type:o,attrs:p},{type:f,attrs:h}]:[{type:o,attrs:p}];if(!Lr(e.doc,a.pos,2))return!1;if(r){const{selection:m,storedMarks:v}=t,{splittableMarks:y}=i.extensionManager,k=v||m.$to.parentOffset&&m.$from.marks();if(e.split(a.pos,2,g).scrollIntoView(),!k||!r)return!0;const b=k.filter(E=>y.includes(E.type.name));e.ensureMarks(b)}return!0},xa=(n,e)=>{const t=Lo(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&On(n.doc,t.pos)&&n.join(t.pos),!0},Ea=(n,e)=>{const t=Lo(o=>o.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&On(n.doc,r)&&n.join(r),!0},zv=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,p=$e(n,o.schema),h=$e(e,o.schema),{selection:g,storedMarks:m}=o,{$from:v,$to:y}=g,k=v.blockRange(y),b=m||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const E=Lo(w=>cd(w.type.name,d))(g);if(k.depth>=1&&E&&k.depth-E.depth<=1){if(E.node.type===p)return c.liftListItem(h);if(cd(E.node.type.name,d)&&p.validContent(E.node.content)&&a)return l().command(()=>(s.setNodeMarkup(E.pos,p),!0)).command(()=>xa(s,p)).command(()=>Ea(s,p)).run()}return!t||!b||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>xa(s,p)).command(()=>Ea(s,p)).run():l().command(()=>{const w=u().wrapInList(p,r),S=b.filter(A=>f.includes(A.type.name));return s.ensureMarks(S),w?!0:c.clearNodes()}).wrapInList(p,r).command(()=>xa(s,p)).command(()=>Ea(s,p)).run()},Vv=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=ln(n,r.schema);return Sl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},qv=(n,e,t={})=>({state:r,commands:i})=>{const s=$e(n,r.schema),o=$e(e,r.schema);return nr(r,s,t)?i.setNode(o):i.setNode(s,t)},Uv=(n,e={})=>({state:t,commands:r})=>{const i=$e(n,t.schema);return nr(t,i,e)?r.lift(i):r.wrapIn(i,e)},Kv=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Wv=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},Zv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=ln(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:f,to:p}=a;const h=(s=c.marks().find(m=>m.type===l))===null||s===void 0?void 0:s.attrs,g=dc(c,l,h);g&&(f=g.from,p=g.to),t.removeMark(f,p,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},Gv=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=Oo(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=$e(n,r.schema)),a==="mark"&&(o=ln(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{s&&s===d.type&&t.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(p=>{if(o===p.type){const h=Math.max(f,c),g=Math.min(f+d.nodeSize,u);t.addMark(h,g,o.create({...p.attrs,...e}))}})})}),!0):!1},jv=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return fy(i,e)(t,r)},Jv=(n,e={})=>({state:t,dispatch:r})=>{const i=$e(n,t.schema);return py(i,e)(t,r)};var Yv=Object.freeze({__proto__:null,blur:Dy,clearContent:Iy,clearNodes:By,command:Hy,createParagraphNear:Py,cut:$y,deleteCurrentNode:Fy,deleteNode:zy,deleteRange:Vy,deleteSelection:qy,enter:Uy,exitCode:Ky,extendMarkRange:Zy,first:Gy,focus:jy,forEach:Jy,insertContent:Yy,insertContentAt:ev,joinUp:tv,joinDown:nv,joinBackward:rv,joinForward:iv,joinItemBackward:sv,joinItemForward:ov,keyboardShortcut:lv,lift:cv,liftEmptyBlock:uv,liftListItem:dv,newlineInCode:fv,resetAttributes:pv,scrollIntoView:hv,selectAll:gv,selectNodeBackward:mv,selectNodeForward:bv,selectParentNode:yv,selectTextblockEnd:vv,selectTextblockStart:wv,setContent:kv,setMark:Rv,setMeta:Dv,setNode:Iv,setNodeSelection:Bv,setTextSelection:Hv,sinkListItem:Pv,splitBlock:$v,splitListItem:Fv,toggleList:zv,toggleMark:Vv,toggleNode:qv,toggleWrap:Uv,undoInputRule:Kv,unsetAllMarks:Wv,unsetMark:Zv,updateAttributes:Gv,wrapIn:jv,wrapInList:Jv});const Xv=ke.create({name:"commands",addCommands(){return{...Yv}}}),Qv=ke.create({name:"editable",addProseMirrorPlugins(){return[new Ce({key:new _e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ew=ke.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ce({key:new _e("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),tw=ke.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock?a.doc.resolve(f-1):d,g=h.parent.type.spec.isolating,m=d.pos-d.parentOffset,v=g&&h.parent.childCount===1?m===d.pos:te.atStart(c).from===f;return!u||!v||!p.type.isTextblock||p.textContent.length?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return pc()||hc()?s:i},addProseMirrorPlugins(){return[new Ce({key:new _e("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(h=>h.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=te.atStart(e.doc).from,l=te.atEnd(e.doc).to;if(i||!(s===a&&o===l)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const d=t.tr,f=Mo({state:t,transaction:d}),{commands:p}=new Ao({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}}),nw=ke.create({name:"tabindex",addProseMirrorPlugins(){return[new Ce({key:new _e("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var og=Object.freeze({__proto__:null,ClipboardTextSerializer:Ry,Commands:Xv,Editable:Qv,FocusEvents:ew,Keymap:tw,Tabindex:nw});const rw=`.ProseMirror { position: relative; } @@ -83,17 +83,17 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;function rw(n,e,t){const r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}class iw extends by{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=rw(nw,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=Xh(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){const t=[...this.options.enableCoreExtensions?Object.values(ig):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Mr(t,this)}createCommandManager(){this.commandManager=new Mo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=tg(this.options.content,this.schema,this.options.parseOptions),t=eg(e,this.options.autofocus);this.view=new B1(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:_r.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return rg(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Av(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dc(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` +}`;function iw(n,e,t){const r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}class sw extends vy{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=iw(rw,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=Qh(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){const t=[...this.options.enableCoreExtensions?Object.values(og):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Mr(t,this)}createCommandManager(){this.commandManager=new Ao({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=ng(this.options.content,this.schema,this.options.parseOptions),t=tg(e,this.options.autofocus);this.view=new P0(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:_r.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return ig(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Nv(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return gc(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` -`,textSerializers:r={}}=e||{};return xv(this.state.doc,{blockSeparator:t,textSerializers:{...Qh(this.schema),...r}})}get isEmpty(){return Tv(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}}function rr(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=re(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(fc(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;ut.from&&s.delete(t.from+l,c);const f=t.from+l+o.length;s.addMark(t.from+l,f,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function hc(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=re(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,a,l)}else r[0]&&s.insert(o-1,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a));s.scrollIntoView()}})}function El(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=re(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function ir(n){return new qi({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=re(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&Kl(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const g=h.filter(m=>p.includes(m.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&On(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)}})}class Le{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=re(W(this,"addOptions",{name:this.name}))),this.storage=re(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Le(e)}configure(e={}){const t=this.extend();return t.options=To(this.options,e),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Le(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=re(W(t,"addOptions",{name:t.name})),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let ae=class xl{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=re(W(this,"addOptions",{name:this.name}))),this.storage=re(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xl(e)}configure(e={}){const t=this.extend();return t.options=To(this.options,e),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new xl(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=re(W(t,"addOptions",{name:t.name})),t.storage=re(W(t,"addStorage",{name:t.name,options:t.options})),t}};function Nn(n){return new Sy({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=re(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(fc(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>d).length)return null;ft.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function sw(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}class ge extends HTMLElement{constructor(){super(),this.template=""}registerClickListener(){this.addEventListener("click",()=>{var t;const e=(t=this.editor)==null?void 0:t.chain();this.onClick(e),e==null||e.run()})}connectedCallback(){this.innerHTML=this.template}onClick(e){}onCreate(e,t){this.editor=e.editor,this.options=t}onTransaction(e){const t=this.querySelector("div");t&&(this.onActive(e.editor)?t.classList.add("active"):t.classList.remove("active"))}onActive(e){return!1}}class ow extends ge{constructor(){super();const e=` +`,textSerializers:r={}}=e||{};return Sv(this.state.doc,{blockSeparator:t,textSerializers:{...eg(this.schema),...r}})}get isEmpty(){return Ov(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}}function rr(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ie(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),u=c+o.length;if(mc(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;ut.from&&s.delete(t.from+l,c);const f=t.from+l+o.length;s.addMark(t.from+l,f,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function bc(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=ie(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,a,l)}else r[0]&&s.insert(o-1,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a));s.scrollIntoView()}})}function _l(n){return new qi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=ie(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function ir(n){return new qi({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=ie(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&jl(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const g=h.filter(m=>p.includes(m.type.name));o.ensureMarks(g)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&On(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)}})}class Le{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ie(W(this,"addOptions",{name:this.name}))),this.storage=ie(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Le(e)}configure(e={}){const t=this.extend();return t.options=No(this.options,e),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Le(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ie(W(t,"addOptions",{name:t.name})),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let ae=class Ml{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ie(W(this,"addOptions",{name:this.name}))),this.storage=ie(W(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ml(e)}configure(e={}){const t=this.extend();return t.options=No(this.options,e),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Ml(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ie(W(t,"addOptions",{name:t.name})),t.storage=ie(W(t,"addStorage",{name:t.name,options:t.options})),t}};function Nn(n){return new My({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=ie(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const u=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(mc(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>d).length)return null;ft.from&&o.delete(t.from+u,d),c=t.from+u+a.length,o.addMark(t.from+u,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function ow(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}class ge extends HTMLElement{constructor(){super(),this.template=""}registerClickListener(){this.addEventListener("click",()=>{var t;const e=(t=this.editor)==null?void 0:t.chain();this.onClick(e),e==null||e.run()})}connectedCallback(){this.innerHTML=this.template}onClick(e){}onCreate(e,t){this.editor=e.editor,this.options=t}onTransaction(e){const t=this.querySelector("div");t&&(this.onActive(e.editor)?t.classList.add("active"):t.classList.remove("active"))}onActive(e){return!1}}class aw extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.undo()}}class aw extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.undo()}}class lw extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.redo()}}var ct="top",St="bottom",_t="right",ut="left",gc="auto",Ki=[ct,St,_t,ut],zr="start",Ai="end",lw="clippingParents",sg="viewport",ti="popper",cw="reference",ud=Ki.reduce(function(n,e){return n.concat([e+"-"+zr,e+"-"+Ai])},[]),og=[].concat(Ki,[gc]).reduce(function(n,e){return n.concat([e,e+"-"+zr,e+"-"+Ai])},[]),uw="beforeRead",dw="read",fw="afterRead",pw="beforeMain",hw="main",gw="afterMain",mw="beforeWrite",bw="write",yw="afterWrite",vw=[uw,dw,fw,pw,hw,gw,mw,bw,yw];function Jt(n){return n?(n.nodeName||"").toLowerCase():null}function gt(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function sr(n){var e=gt(n).Element;return n instanceof e||n instanceof Element}function Ct(n){var e=gt(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function mc(n){if(typeof ShadowRoot>"u")return!1;var e=gt(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function ww(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Ct(s)||!Jt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function kw(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ct(i)||!Jt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const ag={name:"applyStyles",enabled:!0,phase:"write",fn:ww,effect:kw,requires:["computeStyles"]};function Gt(n){return n.split("-")[0]}var Jn=Math.max,qs=Math.min,Vr=Math.round;function Cl(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function lg(){return!/^((?!chrome|android).)*safari/i.test(Cl())}function qr(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&Ct(n)&&(i=n.offsetWidth>0&&Vr(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&Vr(r.height)/n.offsetHeight||1);var o=sr(n)?gt(n):window,a=o.visualViewport,l=!lg()&&t,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,f=r.height/s;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function bc(n){var e=qr(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function cg(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&mc(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function an(n){return gt(n).getComputedStyle(n)}function Ew(n){return["table","td","th"].indexOf(Jt(n))>=0}function Rn(n){return((sr(n)?n.ownerDocument:n.document)||window.document).documentElement}function Lo(n){return Jt(n)==="html"?n:n.assignedSlot||n.parentNode||(mc(n)?n.host:null)||Rn(n)}function dd(n){return!Ct(n)||an(n).position==="fixed"?null:n.offsetParent}function xw(n){var e=/firefox/i.test(Cl()),t=/Trident/i.test(Cl());if(t&&Ct(n)){var r=an(n);if(r.position==="fixed")return null}var i=Lo(n);for(mc(i)&&(i=i.host);Ct(i)&&["html","body"].indexOf(Jt(i))<0;){var s=an(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Wi(n){for(var e=gt(n),t=dd(n);t&&Ew(t)&&an(t).position==="static";)t=dd(t);return t&&(Jt(t)==="html"||Jt(t)==="body"&&an(t).position==="static")?e:t||xw(n)||e}function yc(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function hi(n,e,t){return Jn(n,qs(e,t))}function Cw(n,e,t){var r=hi(n,e,t);return r>t?t:r}function ug(){return{top:0,right:0,bottom:0,left:0}}function dg(n){return Object.assign({},ug(),n)}function fg(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var Sw=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,dg(typeof e!="number"?e:fg(e,Ki))};function _w(n){var e,t=n.state,r=n.name,i=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Gt(t.placement),l=yc(a),c=[ut,_t].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var d=Sw(i.padding,t),f=bc(s),p=l==="y"?ct:ut,h=l==="y"?St:_t,g=t.rects.reference[u]+t.rects.reference[l]-o[l]-t.rects.popper[u],m=o[l]-t.rects.reference[l],v=Wi(s),y=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,k=g/2-m/2,b=d[p],x=y-f[u]-d[h],w=y/2-f[u]/2+k,S=hi(b,w,x),A=l;t.modifiersData[r]=(e={},e[A]=S,e.centerOffset=S-w,e)}}function Mw(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||cg(e.elements.popper,i)&&(e.elements.arrow=i))}const Aw={name:"arrow",enabled:!0,phase:"main",fn:_w,effect:Mw,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ur(n){return n.split("-")[1]}var Tw={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Nw(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:Vr(t*i)/i||0,y:Vr(r*i)/i||0}}function fd(n){var e,t=n.popper,r=n.popperRect,i=n.placement,s=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,d=n.isFixed,f=o.x,p=f===void 0?0:f,h=o.y,g=h===void 0?0:h,m=typeof u=="function"?u({x:p,y:g}):{x:p,y:g};p=m.x,g=m.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),k=ut,b=ct,x=window;if(c){var w=Wi(t),S="clientHeight",A="clientWidth";if(w===gt(t)&&(w=Rn(t),an(w).position!=="static"&&a==="absolute"&&(S="scrollHeight",A="scrollWidth")),w=w,i===ct||(i===ut||i===_t)&&s===Ai){b=St;var M=d&&w===x&&x.visualViewport?x.visualViewport.height:w[S];g-=M-r.height,g*=l?1:-1}if(i===ut||(i===ct||i===St)&&s===Ai){k=_t;var L=d&&w===x&&x.visualViewport?x.visualViewport.width:w[A];p-=L-r.width,p*=l?1:-1}}var z=Object.assign({position:a},c&&Tw),q=u===!0?Nw({x:p,y:g},gt(t)):{x:p,y:g};if(p=q.x,g=q.y,l){var U;return Object.assign({},z,(U={},U[b]=y?"0":"",U[k]=v?"0":"",U.transform=(x.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",U))}return Object.assign({},z,(e={},e[b]=y?g+"px":"",e[k]=v?p+"px":"",e.transform="",e))}function Ow(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:Gt(e.placement),variation:Ur(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,fd(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,fd(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Lw={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Ow,data:{}};var es={passive:!0};function Rw(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=gt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",t.update,es)}),a&&l.addEventListener("resize",t.update,es),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",t.update,es)}),a&&l.removeEventListener("resize",t.update,es)}}const Dw={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Rw,data:{}};var Iw={left:"right",right:"left",bottom:"top",top:"bottom"};function Cs(n){return n.replace(/left|right|bottom|top/g,function(e){return Iw[e]})}var Bw={start:"end",end:"start"};function pd(n){return n.replace(/start|end/g,function(e){return Bw[e]})}function vc(n){var e=gt(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function wc(n){return qr(Rn(n)).left+vc(n).scrollLeft}function Hw(n,e){var t=gt(n),r=Rn(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=lg();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+wc(n),y:l}}function Pw(n){var e,t=Rn(n),r=vc(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=Jn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=Jn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+wc(n),l=-r.scrollTop;return an(i||t).direction==="rtl"&&(a+=Jn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function kc(n){var e=an(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function pg(n){return["html","body","#document"].indexOf(Jt(n))>=0?n.ownerDocument.body:Ct(n)&&kc(n)?n:pg(Lo(n))}function gi(n,e){var t;e===void 0&&(e=[]);var r=pg(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=gt(r),o=i?[s].concat(s.visualViewport||[],kc(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(gi(Lo(o)))}function Sl(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function $w(n,e){var t=qr(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function hd(n,e,t){return e===sg?Sl(Hw(n,t)):sr(e)?$w(e,t):Sl(Pw(Rn(n)))}function Fw(n){var e=gi(Lo(n)),t=["absolute","fixed"].indexOf(an(n).position)>=0,r=t&&Ct(n)?Wi(n):n;return sr(r)?e.filter(function(i){return sr(i)&&cg(i,r)&&Jt(i)!=="body"}):[]}function zw(n,e,t,r){var i=e==="clippingParents"?Fw(n):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,c){var u=hd(n,c,r);return l.top=Jn(u.top,l.top),l.right=qs(u.right,l.right),l.bottom=qs(u.bottom,l.bottom),l.left=Jn(u.left,l.left),l},hd(n,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function hg(n){var e=n.reference,t=n.element,r=n.placement,i=r?Gt(r):null,s=r?Ur(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case ct:l={x:o,y:e.y-t.height};break;case St:l={x:o,y:e.y+e.height};break;case _t:l={x:e.x+e.width,y:a};break;case ut:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?yc(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case zr:l[c]=l[c]-(e[u]/2-t[u]/2);break;case Ai:l[c]=l[c]+(e[u]/2-t[u]/2);break}}return l}function Ti(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,s=t.strategy,o=s===void 0?n.strategy:s,a=t.boundary,l=a===void 0?lw:a,c=t.rootBoundary,u=c===void 0?sg:c,d=t.elementContext,f=d===void 0?ti:d,p=t.altBoundary,h=p===void 0?!1:p,g=t.padding,m=g===void 0?0:g,v=dg(typeof m!="number"?m:fg(m,Ki)),y=f===ti?cw:ti,k=n.rects.popper,b=n.elements[h?y:f],x=zw(sr(b)?b:b.contextElement||Rn(n.elements.popper),l,u,o),w=qr(n.elements.reference),S=hg({reference:w,element:k,strategy:"absolute",placement:i}),A=Sl(Object.assign({},k,S)),M=f===ti?A:w,L={top:x.top-M.top+v.top,bottom:M.bottom-x.bottom+v.bottom,left:x.left-M.left+v.left,right:M.right-x.right+v.right},z=n.modifiersData.offset;if(f===ti&&z){var q=z[i];Object.keys(L).forEach(function(U){var T=[_t,St].indexOf(U)>=0?1:-1,H=[ct,St].indexOf(U)>=0?"y":"x";L[U]+=q[H]*T})}return L}function Vw(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?og:l,u=Ur(r),d=u?a?ud:ud.filter(function(h){return Ur(h)===u}):Ki,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var p=f.reduce(function(h,g){return h[g]=Ti(n,{placement:g,boundary:i,rootBoundary:s,padding:o})[Gt(g)],h},{});return Object.keys(p).sort(function(h,g){return p[h]-p[g]})}function qw(n){if(Gt(n)===gc)return[];var e=Cs(n);return[pd(n),e,pd(e)]}function Uw(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,p=t.flipVariations,h=p===void 0?!0:p,g=t.allowedAutoPlacements,m=e.options.placement,v=Gt(m),y=v===m,k=l||(y||!h?[Cs(m)]:qw(m)),b=[m].concat(k).reduce(function(ve,ce){return ve.concat(Gt(ce)===gc?Vw(e,{placement:ce,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:g}):ce)},[]),x=e.rects.reference,w=e.rects.popper,S=new Map,A=!0,M=b[0],L=0;L=0,H=T?"width":"height",C=Ti(e,{placement:z,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),E=T?U?_t:ut:U?St:ct;x[H]>w[H]&&(E=Cs(E));var _=Cs(E),D=[];if(s&&D.push(C[q]<=0),a&&D.push(C[E]<=0,C[_]<=0),D.every(function(ve){return ve})){M=z,A=!1;break}S.set(z,D)}if(A)for(var P=h?3:1,G=function(ce){var Se=b.find(function(it){var Fe=S.get(it);if(Fe)return Fe.slice(0,ce).every(function(dt){return dt})});if(Se)return M=Se,"break"},Q=P;Q>0;Q--){var pe=G(Q);if(pe==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const Kw={name:"flip",enabled:!0,phase:"main",fn:Uw,requiresIfExists:["offset"],data:{_skip:!1}};function gd(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function md(n){return[ct,_t,St,ut].some(function(e){return n[e]>=0})}function Ww(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ti(e,{elementContext:"reference"}),a=Ti(e,{altBoundary:!0}),l=gd(o,r),c=gd(a,i,s),u=md(l),d=md(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const Gw={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Ww};function Zw(n,e,t){var r=Gt(n),i=[ut,ct].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[ut,_t].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function jw(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=og.reduce(function(u,d){return u[d]=Zw(d,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const Jw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:jw};function Yw(n){var e=n.state,t=n.name;e.modifiersData[t]=hg({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Xw={name:"popperOffsets",enabled:!0,phase:"read",fn:Yw,data:{}};function Qw(n){return n==="x"?"y":"x"}function ek(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,p=f===void 0?!0:f,h=t.tetherOffset,g=h===void 0?0:h,m=Ti(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=Gt(e.placement),y=Ur(e.placement),k=!y,b=yc(v),x=Qw(b),w=e.modifiersData.popperOffsets,S=e.rects.reference,A=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,L=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(w){if(s){var U,T=b==="y"?ct:ut,H=b==="y"?St:_t,C=b==="y"?"height":"width",E=w[b],_=E+m[T],D=E-m[H],P=p?-A[C]/2:0,G=y===zr?S[C]:A[C],Q=y===zr?-A[C]:-S[C],pe=e.elements.arrow,ve=p&&pe?bc(pe):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ug(),Se=ce[T],it=ce[H],Fe=hi(0,S[C],ve[C]),dt=k?S[C]/2-P-Fe-Se-L.mainAxis:G-Fe-Se-L.mainAxis,st=k?-S[C]/2+P+Fe+it+L.mainAxis:Q+Fe+it+L.mainAxis,bt=e.elements.arrow&&Wi(e.elements.arrow),ft=bt?b==="y"?bt.clientTop||0:bt.clientLeft||0:0,ue=(U=z==null?void 0:z[b])!=null?U:0,Me=E+dt-ue-ft,Xe=E+st-ue,Ne=hi(p?qs(_,Me):_,E,p?Jn(D,Xe):D);w[b]=Ne,q[b]=Ne-E}if(a){var ee,At=b==="x"?ct:ut,V=b==="x"?St:_t,le=w[x],me=x==="y"?"height":"width",oe=le+m[At],Ge=le-m[V],ze=[ct,ut].indexOf(v)!==-1,$=(ee=z==null?void 0:z[x])!=null?ee:0,K=ze?oe:le-S[me]-A[me]-$+L.altAxis,O=ze?le+S[me]+A[me]-$-L.altAxis:Ge,I=p&&ze?Cw(K,le,O):hi(p?K:oe,le,p?O:Ge);w[x]=I,q[x]=I-le}e.modifiersData[r]=q}}const tk={name:"preventOverflow",enabled:!0,phase:"main",fn:ek,requiresIfExists:["offset"]};function nk(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function rk(n){return n===gt(n)||!Ct(n)?vc(n):nk(n)}function ik(n){var e=n.getBoundingClientRect(),t=Vr(e.width)/n.offsetWidth||1,r=Vr(e.height)/n.offsetHeight||1;return t!==1||r!==1}function sk(n,e,t){t===void 0&&(t=!1);var r=Ct(e),i=Ct(e)&&ik(e),s=Rn(e),o=qr(n,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Jt(e)!=="body"||kc(s))&&(a=rk(e)),Ct(e)?(l=qr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=wc(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function ok(n){var e=new Map,t=new Set,r=[];n.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return n.forEach(function(s){t.has(s.name)||i(s)}),r}function ak(n){var e=ok(n);return vw.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function lk(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function ck(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var bd={placement:"bottom",modifiers:[],strategy:"absolute"};function yd(){for(var n=arguments.length,e=new Array(n),t=0;t-1}function vg(n,e){return typeof n=="function"?n.apply(void 0,e):n}function vd(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function gk(n){return n.split(/\s+/).filter(Boolean)}function Er(n){return[].concat(n)}function wd(n,e){n.indexOf(e)===-1&&n.push(e)}function mk(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function bk(n){return n.split("-")[0]}function Us(n){return[].slice.call(n)}function kd(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function mi(){return document.createElement("div")}function Ro(n){return["Element","Fragment"].some(function(e){return Ec(n,e)})}function yk(n){return Ec(n,"NodeList")}function vk(n){return Ec(n,"MouseEvent")}function wk(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function kk(n){return Ro(n)?[n]:yk(n)?Us(n):Array.isArray(n)?n:Us(document.querySelectorAll(n))}function ka(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Ed(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Ek(n){var e,t=Er(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function xk(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=bk(o.placement),u=o.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,h=c==="left"?u.right.x:0,g=s.top-r+d>l,m=r-s.bottom-f>l,v=s.left-t+p>l,y=t-s.right-h>l;return g||m||v||y})}function Ea(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function xd(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Ft={isTouch:!1},Cd=0;function Ck(){Ft.isTouch||(Ft.isTouch=!0,window.performance&&document.addEventListener("mousemove",wg))}function wg(){var n=performance.now();n-Cd<20&&(Ft.isTouch=!1,document.removeEventListener("mousemove",wg)),Cd=n}function Sk(){var n=document.activeElement;if(wk(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function _k(){document.addEventListener("touchstart",Ck,Hn),window.addEventListener("blur",Sk)}var Mk=typeof window<"u"&&typeof document<"u",Ak=Mk?!!window.msCrypto:!1,Tk={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Nk={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ot=Object.assign({appendTo:yg,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Tk,Nk),Ok=Object.keys(Ot),Lk=function(e){var t=Object.keys(e);t.forEach(function(r){Ot[r]=e[r]})};function kg(n){var e=n.plugins||[],t=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=n[s]!==void 0?n[s]:(a=Ot[s])!=null?a:o}return r},{});return Object.assign({},n,t)}function Rk(n,e){var t=e?Object.keys(kg(Object.assign({},Ot,{plugins:e}))):Ok,r=t.reduce(function(i,s){var o=(n.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Sd(n,e){var t=Object.assign({},e,{content:vg(e.content,[n])},e.ignoreAttributes?{}:Rk(n,e.plugins));return t.aria=Object.assign({},Ot.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var Dk=function(){return"innerHTML"};function _l(n,e){n[Dk()]=e}function _d(n){var e=mi();return n===!0?e.className=mg:(e.className=bg,Ro(n)?e.appendChild(n):_l(e,n)),e}function Md(n,e){Ro(e.content)?(_l(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?_l(n,e.content):n.textContent=e.content)}function Ml(n){var e=n.firstElementChild,t=Us(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(gg)}),arrow:t.find(function(r){return r.classList.contains(mg)||r.classList.contains(bg)}),backdrop:t.find(function(r){return r.classList.contains(hk)})}}function Eg(n){var e=mi(),t=mi();t.className=pk,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=mi();r.className=gg,r.setAttribute("data-state","hidden"),Md(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var a=Ml(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Md(c,n.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(_d(o.arrow))):l.appendChild(_d(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}Eg.$$tippy=!0;var Ik=1,ts=[],xa=[];function Bk(n,e){var t=Sd(n,Object.assign({},Ot,kg(kd(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,d,f,p=[],h=vd(Me,t.interactiveDebounce),g,m=Ik++,v=null,y=mk(t.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:m,reference:n,popper:mi(),popperInstance:v,props:t,state:k,plugins:y,clearDelayTimeouts:K,setProps:O,setContent:I,show:j,hide:ie,hideWithInteractivity:Re,enable:ze,disable:$,unmount:pt,destroy:Jo};if(!t.render)return b;var x=t.render(b),w=x.popper,S=x.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,n._tippy=b,w._tippy=b;var A=y.map(function(N){return N.fn(b)}),M=n.hasAttribute("aria-expanded");return bt(),P(),E(),_("onCreate",[b]),t.showOnCreate&&oe(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&T().addEventListener("mousemove",h)}),b;function L(){var N=b.props.touch;return Array.isArray(N)?N:[N,0]}function z(){return L()[0]==="hold"}function q(){var N;return!!((N=b.props.render)!=null&&N.$$tippy)}function U(){return g||n}function T(){var N=U().parentNode;return N?Ek(N):document}function H(){return Ml(w)}function C(N){return b.state.isMounted&&!b.state.isVisible||Ft.isTouch||u&&u.type==="focus"?0:wa(b.props.delay,N?0:1,Ot.delay)}function E(N){N===void 0&&(N=!1),w.style.pointerEvents=b.props.interactive&&!N?"":"none",w.style.zIndex=""+b.props.zIndex}function _(N,Z,ne){if(ne===void 0&&(ne=!0),A.forEach(function(he){he[N]&&he[N].apply(he,Z)}),ne){var Ee;(Ee=b.props)[N].apply(Ee,Z)}}function D(){var N=b.props.aria;if(N.content){var Z="aria-"+N.content,ne=w.id,Ee=Er(b.props.triggerTarget||n);Ee.forEach(function(he){var Qe=he.getAttribute(Z);if(b.state.isVisible)he.setAttribute(Z,Qe?Qe+" "+ne:ne);else{var yt=Qe&&Qe.replace(ne,"").trim();yt?he.setAttribute(Z,yt):he.removeAttribute(Z)}})}}function P(){if(!(M||!b.props.aria.expanded)){var N=Er(b.props.triggerTarget||n);N.forEach(function(Z){b.props.interactive?Z.setAttribute("aria-expanded",b.state.isVisible&&Z===U()?"true":"false"):Z.removeAttribute("aria-expanded")})}}function G(){T().removeEventListener("mousemove",h),ts=ts.filter(function(N){return N!==h})}function Q(N){if(!(Ft.isTouch&&(l||N.type==="mousedown"))){var Z=N.composedPath&&N.composedPath()[0]||N.target;if(!(b.props.interactive&&xd(w,Z))){if(Er(b.props.triggerTarget||n).some(function(ne){return xd(ne,Z)})){if(Ft.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[b,N]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||Se())}}}function pe(){l=!0}function ve(){l=!1}function ce(){var N=T();N.addEventListener("mousedown",Q,!0),N.addEventListener("touchend",Q,Hn),N.addEventListener("touchstart",ve,Hn),N.addEventListener("touchmove",pe,Hn)}function Se(){var N=T();N.removeEventListener("mousedown",Q,!0),N.removeEventListener("touchend",Q,Hn),N.removeEventListener("touchstart",ve,Hn),N.removeEventListener("touchmove",pe,Hn)}function it(N,Z){dt(N,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&Z()})}function Fe(N,Z){dt(N,Z)}function dt(N,Z){var ne=H().box;function Ee(he){he.target===ne&&(Ea(ne,"remove",Ee),Z())}if(N===0)return Z();Ea(ne,"remove",d),Ea(ne,"add",Ee),d=Ee}function st(N,Z,ne){ne===void 0&&(ne=!1);var Ee=Er(b.props.triggerTarget||n);Ee.forEach(function(he){he.addEventListener(N,Z,ne),p.push({node:he,eventType:N,handler:Z,options:ne})})}function bt(){z()&&(st("touchstart",ue,{passive:!0}),st("touchend",Xe,{passive:!0})),gk(b.props.trigger).forEach(function(N){if(N!=="manual")switch(st(N,ue),N){case"mouseenter":st("mouseleave",Xe);break;case"focus":st(Ak?"focusout":"blur",Ne);break;case"focusin":st("focusout",Ne);break}})}function ft(){p.forEach(function(N){var Z=N.node,ne=N.eventType,Ee=N.handler,he=N.options;Z.removeEventListener(ne,Ee,he)}),p=[]}function ue(N){var Z,ne=!1;if(!(!b.state.isEnabled||ee(N)||a)){var Ee=((Z=u)==null?void 0:Z.type)==="focus";u=N,g=N.currentTarget,P(),!b.state.isVisible&&vk(N)&&ts.forEach(function(he){return he(N)}),N.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?ne=!0:oe(N),N.type==="click"&&(o=!ne),ne&&!Ee&&Ge(N)}}function Me(N){var Z=N.target,ne=U().contains(Z)||w.contains(Z);if(!(N.type==="mousemove"&&ne)){var Ee=me().concat(w).map(function(he){var Qe,yt=he._tippy,ur=(Qe=yt.popperInstance)==null?void 0:Qe.state;return ur?{popperRect:he.getBoundingClientRect(),popperState:ur,props:t}:null}).filter(Boolean);xk(Ee,N)&&(G(),Ge(N))}}function Xe(N){var Z=ee(N)||b.props.trigger.indexOf("click")>=0&&o;if(!Z){if(b.props.interactive){b.hideWithInteractivity(N);return}Ge(N)}}function Ne(N){b.props.trigger.indexOf("focusin")<0&&N.target!==U()||b.props.interactive&&N.relatedTarget&&w.contains(N.relatedTarget)||Ge(N)}function ee(N){return Ft.isTouch?z()!==N.type.indexOf("touch")>=0:!1}function At(){V();var N=b.props,Z=N.popperOptions,ne=N.placement,Ee=N.offset,he=N.getReferenceClientRect,Qe=N.moveTransition,yt=q()?Ml(w).arrow:null,ur=he?{getBoundingClientRect:he,contextElement:he.contextElement||U()}:n,ou={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ji){var dr=ji.state;if(q()){var bb=H(),Xo=bb.box;["placement","reference-hidden","escaped"].forEach(function(Ji){Ji==="placement"?Xo.setAttribute("data-placement",dr.placement):dr.attributes.popper["data-popper-"+Ji]?Xo.setAttribute("data-"+Ji,""):Xo.removeAttribute("data-"+Ji)}),dr.attributes.popper={}}}},Dn=[{name:"offset",options:{offset:Ee}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Qe}},ou];q()&&yt&&Dn.push({name:"arrow",options:{element:yt,padding:3}}),Dn.push.apply(Dn,(Z==null?void 0:Z.modifiers)||[]),b.popperInstance=fk(ur,w,Object.assign({},Z,{placement:ne,onFirstUpdate:f,modifiers:Dn}))}function V(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function le(){var N=b.props.appendTo,Z,ne=U();b.props.interactive&&N===yg||N==="parent"?Z=ne.parentNode:Z=vg(N,[ne]),Z.contains(w)||Z.appendChild(w),b.state.isMounted=!0,At()}function me(){return Us(w.querySelectorAll("[data-tippy-root]"))}function oe(N){b.clearDelayTimeouts(),N&&_("onTrigger",[b,N]),ce();var Z=C(!0),ne=L(),Ee=ne[0],he=ne[1];Ft.isTouch&&Ee==="hold"&&he&&(Z=he),Z?r=setTimeout(function(){b.show()},Z):b.show()}function Ge(N){if(b.clearDelayTimeouts(),_("onUntrigger",[b,N]),!b.state.isVisible){Se();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var Z=C(!1);Z?i=setTimeout(function(){b.state.isVisible&&b.hide()},Z):s=requestAnimationFrame(function(){b.hide()})}}function ze(){b.state.isEnabled=!0}function $(){b.hide(),b.state.isEnabled=!1}function K(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function O(N){if(!b.state.isDestroyed){_("onBeforeUpdate",[b,N]),ft();var Z=b.props,ne=Sd(n,Object.assign({},Z,kd(N),{ignoreAttributes:!0}));b.props=ne,bt(),Z.interactiveDebounce!==ne.interactiveDebounce&&(G(),h=vd(Me,ne.interactiveDebounce)),Z.triggerTarget&&!ne.triggerTarget?Er(Z.triggerTarget).forEach(function(Ee){Ee.removeAttribute("aria-expanded")}):ne.triggerTarget&&n.removeAttribute("aria-expanded"),P(),E(),S&&S(Z,ne),b.popperInstance&&(At(),me().forEach(function(Ee){requestAnimationFrame(Ee._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[b,N])}}function I(N){b.setProps({content:N})}function j(){var N=b.state.isVisible,Z=b.state.isDestroyed,ne=!b.state.isEnabled,Ee=Ft.isTouch&&!b.props.touch,he=wa(b.props.duration,0,Ot.duration);if(!(N||Z||ne||Ee)&&!U().hasAttribute("disabled")&&(_("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,q()&&(w.style.visibility="visible"),E(),ce(),b.state.isMounted||(w.style.transition="none"),q()){var Qe=H(),yt=Qe.box,ur=Qe.content;ka([yt,ur],0)}f=function(){var Dn;if(!(!b.state.isVisible||c)){if(c=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,q()&&b.props.animation){var Yo=H(),ji=Yo.box,dr=Yo.content;ka([ji,dr],he),Ed([ji,dr],"visible")}D(),P(),wd(xa,b),(Dn=b.popperInstance)==null||Dn.forceUpdate(),_("onMount",[b]),b.props.animation&&q()&&Fe(he,function(){b.state.isShown=!0,_("onShown",[b])})}},le()}}function ie(){var N=!b.state.isVisible,Z=b.state.isDestroyed,ne=!b.state.isEnabled,Ee=wa(b.props.duration,1,Ot.duration);if(!(N||Z||ne)&&(_("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,o=!1,q()&&(w.style.visibility="hidden"),G(),Se(),E(!0),q()){var he=H(),Qe=he.box,yt=he.content;b.props.animation&&(ka([Qe,yt],Ee),Ed([Qe,yt],"hidden"))}D(),P(),b.props.animation?q()&&it(Ee,b.unmount):b.unmount()}}function Re(N){T().addEventListener("mousemove",h),wd(ts,h),h(N)}function pt(){b.state.isVisible&&b.hide(),b.state.isMounted&&(V(),me().forEach(function(N){N._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),xa=xa.filter(function(N){return N!==b}),b.state.isMounted=!1,_("onHidden",[b]))}function Jo(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),ft(),delete n._tippy,b.state.isDestroyed=!0,_("onDestroy",[b]))}}function Ke(n,e){e===void 0&&(e={});var t=Ot.plugins.concat(e.plugins||[]);_k();var r=Object.assign({},e,{plugins:t}),i=kk(n),s=i.reduce(function(o,a){var l=a&&Bk(a,r);return l&&o.push(l),o},[]);return Ro(n)?s[0]:s}Ke.defaultProps=Ot;Ke.setDefaultProps=Lk;Ke.currentInput=Ft;Object.assign({},ag,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});Ke.setDefaultProps({render:Eg});class Zr extends ge{constructor(){super(...arguments),this.menuData=[],this.menuTextWidth="40px",this.defaultMenuIndex=0,this.refreshMenuText=!0,this.width="48px",this.dropDivWith="100px",this.dropDivHeight="260px",this.showItemsTip=!1}renderTemplate(){this.template=` + `;this.template=e,this.registerClickListener()}onClick(e){e.redo()}}var ct="top",St="bottom",_t="right",ut="left",yc="auto",Ki=[ct,St,_t,ut],zr="start",Ti="end",cw="clippingParents",ag="viewport",ni="popper",uw="reference",dd=Ki.reduce(function(n,e){return n.concat([e+"-"+zr,e+"-"+Ti])},[]),lg=[].concat(Ki,[yc]).reduce(function(n,e){return n.concat([e,e+"-"+zr,e+"-"+Ti])},[]),dw="beforeRead",fw="read",pw="afterRead",hw="beforeMain",gw="main",mw="afterMain",bw="beforeWrite",yw="write",vw="afterWrite",ww=[dw,fw,pw,hw,gw,mw,bw,yw,vw];function Jt(n){return n?(n.nodeName||"").toLowerCase():null}function gt(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function sr(n){var e=gt(n).Element;return n instanceof e||n instanceof Element}function Ct(n){var e=gt(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function vc(n){if(typeof ShadowRoot>"u")return!1;var e=gt(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function kw(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Ct(s)||!Jt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function xw(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ct(i)||!Jt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const cg={name:"applyStyles",enabled:!0,phase:"write",fn:kw,effect:xw,requires:["computeStyles"]};function Zt(n){return n.split("-")[0]}var Jn=Math.max,Us=Math.min,Vr=Math.round;function Al(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ug(){return!/^((?!chrome|android).)*safari/i.test(Al())}function qr(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,s=1;e&&Ct(n)&&(i=n.offsetWidth>0&&Vr(r.width)/n.offsetWidth||1,s=n.offsetHeight>0&&Vr(r.height)/n.offsetHeight||1);var o=sr(n)?gt(n):window,a=o.visualViewport,l=!ug()&&t,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,f=r.height/s;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function wc(n){var e=qr(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function dg(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&vc(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function an(n){return gt(n).getComputedStyle(n)}function Ew(n){return["table","td","th"].indexOf(Jt(n))>=0}function Rn(n){return((sr(n)?n.ownerDocument:n.document)||window.document).documentElement}function Do(n){return Jt(n)==="html"?n:n.assignedSlot||n.parentNode||(vc(n)?n.host:null)||Rn(n)}function fd(n){return!Ct(n)||an(n).position==="fixed"?null:n.offsetParent}function Cw(n){var e=/firefox/i.test(Al()),t=/Trident/i.test(Al());if(t&&Ct(n)){var r=an(n);if(r.position==="fixed")return null}var i=Do(n);for(vc(i)&&(i=i.host);Ct(i)&&["html","body"].indexOf(Jt(i))<0;){var s=an(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Wi(n){for(var e=gt(n),t=fd(n);t&&Ew(t)&&an(t).position==="static";)t=fd(t);return t&&(Jt(t)==="html"||Jt(t)==="body"&&an(t).position==="static")?e:t||Cw(n)||e}function kc(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function gi(n,e,t){return Jn(n,Us(e,t))}function Sw(n,e,t){var r=gi(n,e,t);return r>t?t:r}function fg(){return{top:0,right:0,bottom:0,left:0}}function pg(n){return Object.assign({},fg(),n)}function hg(n,e){return e.reduce(function(t,r){return t[r]=n,t},{})}var _w=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,pg(typeof e!="number"?e:hg(e,Ki))};function Mw(n){var e,t=n.state,r=n.name,i=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Zt(t.placement),l=kc(a),c=[ut,_t].indexOf(a)>=0,u=c?"height":"width";if(!(!s||!o)){var d=_w(i.padding,t),f=wc(s),p=l==="y"?ct:ut,h=l==="y"?St:_t,g=t.rects.reference[u]+t.rects.reference[l]-o[l]-t.rects.popper[u],m=o[l]-t.rects.reference[l],v=Wi(s),y=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,k=g/2-m/2,b=d[p],E=y-f[u]-d[h],w=y/2-f[u]/2+k,S=gi(b,w,E),A=l;t.modifiersData[r]=(e={},e[A]=S,e.centerOffset=S-w,e)}}function Aw(n){var e=n.state,t=n.options,r=t.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||dg(e.elements.popper,i)&&(e.elements.arrow=i))}const Tw={name:"arrow",enabled:!0,phase:"main",fn:Mw,effect:Aw,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ur(n){return n.split("-")[1]}var Nw={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Ow(n,e){var t=n.x,r=n.y,i=e.devicePixelRatio||1;return{x:Vr(t*i)/i||0,y:Vr(r*i)/i||0}}function pd(n){var e,t=n.popper,r=n.popperRect,i=n.placement,s=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,d=n.isFixed,f=o.x,p=f===void 0?0:f,h=o.y,g=h===void 0?0:h,m=typeof u=="function"?u({x:p,y:g}):{x:p,y:g};p=m.x,g=m.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),k=ut,b=ct,E=window;if(c){var w=Wi(t),S="clientHeight",A="clientWidth";if(w===gt(t)&&(w=Rn(t),an(w).position!=="static"&&a==="absolute"&&(S="scrollHeight",A="scrollWidth")),w=w,i===ct||(i===ut||i===_t)&&s===Ti){b=St;var M=d&&w===E&&E.visualViewport?E.visualViewport.height:w[S];g-=M-r.height,g*=l?1:-1}if(i===ut||(i===ct||i===St)&&s===Ti){k=_t;var L=d&&w===E&&E.visualViewport?E.visualViewport.width:w[A];p-=L-r.width,p*=l?1:-1}}var z=Object.assign({position:a},c&&Nw),q=u===!0?Ow({x:p,y:g},gt(t)):{x:p,y:g};if(p=q.x,g=q.y,l){var U;return Object.assign({},z,(U={},U[b]=y?"0":"",U[k]=v?"0":"",U.transform=(E.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",U))}return Object.assign({},z,(e={},e[b]=y?g+"px":"",e[k]=v?p+"px":"",e.transform="",e))}function Lw(n){var e=n.state,t=n.options,r=t.gpuAcceleration,i=r===void 0?!0:r,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:Zt(e.placement),variation:Ur(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,pd(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,pd(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Rw={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Lw,data:{}};var es={passive:!0};function Dw(n){var e=n.state,t=n.instance,r=n.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=gt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(u){u.addEventListener("scroll",t.update,es)}),a&&l.addEventListener("resize",t.update,es),function(){s&&c.forEach(function(u){u.removeEventListener("scroll",t.update,es)}),a&&l.removeEventListener("resize",t.update,es)}}const Iw={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Dw,data:{}};var Bw={left:"right",right:"left",bottom:"top",top:"bottom"};function Ss(n){return n.replace(/left|right|bottom|top/g,function(e){return Bw[e]})}var Hw={start:"end",end:"start"};function hd(n){return n.replace(/start|end/g,function(e){return Hw[e]})}function xc(n){var e=gt(n),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function Ec(n){return qr(Rn(n)).left+xc(n).scrollLeft}function Pw(n,e){var t=gt(n),r=Rn(n),i=t.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var c=ug();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Ec(n),y:l}}function $w(n){var e,t=Rn(n),r=xc(n),i=(e=n.ownerDocument)==null?void 0:e.body,s=Jn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=Jn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Ec(n),l=-r.scrollTop;return an(i||t).direction==="rtl"&&(a+=Jn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Cc(n){var e=an(n),t=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+r)}function gg(n){return["html","body","#document"].indexOf(Jt(n))>=0?n.ownerDocument.body:Ct(n)&&Cc(n)?n:gg(Do(n))}function mi(n,e){var t;e===void 0&&(e=[]);var r=gg(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=gt(r),o=i?[s].concat(s.visualViewport||[],Cc(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(mi(Do(o)))}function Tl(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function Fw(n,e){var t=qr(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function gd(n,e,t){return e===ag?Tl(Pw(n,t)):sr(e)?Fw(e,t):Tl($w(Rn(n)))}function zw(n){var e=mi(Do(n)),t=["absolute","fixed"].indexOf(an(n).position)>=0,r=t&&Ct(n)?Wi(n):n;return sr(r)?e.filter(function(i){return sr(i)&&dg(i,r)&&Jt(i)!=="body"}):[]}function Vw(n,e,t,r){var i=e==="clippingParents"?zw(n):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,c){var u=gd(n,c,r);return l.top=Jn(u.top,l.top),l.right=Us(u.right,l.right),l.bottom=Us(u.bottom,l.bottom),l.left=Jn(u.left,l.left),l},gd(n,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mg(n){var e=n.reference,t=n.element,r=n.placement,i=r?Zt(r):null,s=r?Ur(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case ct:l={x:o,y:e.y-t.height};break;case St:l={x:o,y:e.y+e.height};break;case _t:l={x:e.x+e.width,y:a};break;case ut:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?kc(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(s){case zr:l[c]=l[c]-(e[u]/2-t[u]/2);break;case Ti:l[c]=l[c]+(e[u]/2-t[u]/2);break}}return l}function Ni(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=r===void 0?n.placement:r,s=t.strategy,o=s===void 0?n.strategy:s,a=t.boundary,l=a===void 0?cw:a,c=t.rootBoundary,u=c===void 0?ag:c,d=t.elementContext,f=d===void 0?ni:d,p=t.altBoundary,h=p===void 0?!1:p,g=t.padding,m=g===void 0?0:g,v=pg(typeof m!="number"?m:hg(m,Ki)),y=f===ni?uw:ni,k=n.rects.popper,b=n.elements[h?y:f],E=Vw(sr(b)?b:b.contextElement||Rn(n.elements.popper),l,u,o),w=qr(n.elements.reference),S=mg({reference:w,element:k,strategy:"absolute",placement:i}),A=Tl(Object.assign({},k,S)),M=f===ni?A:w,L={top:E.top-M.top+v.top,bottom:M.bottom-E.bottom+v.bottom,left:E.left-M.left+v.left,right:M.right-E.right+v.right},z=n.modifiersData.offset;if(f===ni&&z){var q=z[i];Object.keys(L).forEach(function(U){var T=[_t,St].indexOf(U)>=0?1:-1,H=[ct,St].indexOf(U)>=0?"y":"x";L[U]+=q[H]*T})}return L}function qw(n,e){e===void 0&&(e={});var t=e,r=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?lg:l,u=Ur(r),d=u?a?dd:dd.filter(function(h){return Ur(h)===u}):Ki,f=d.filter(function(h){return c.indexOf(h)>=0});f.length===0&&(f=d);var p=f.reduce(function(h,g){return h[g]=Ni(n,{placement:g,boundary:i,rootBoundary:s,padding:o})[Zt(g)],h},{});return Object.keys(p).sort(function(h,g){return p[h]-p[g]})}function Uw(n){if(Zt(n)===yc)return[];var e=Ss(n);return[hd(n),e,hd(e)]}function Kw(n){var e=n.state,t=n.options,r=n.name;if(!e.modifiersData[r]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,c=t.padding,u=t.boundary,d=t.rootBoundary,f=t.altBoundary,p=t.flipVariations,h=p===void 0?!0:p,g=t.allowedAutoPlacements,m=e.options.placement,v=Zt(m),y=v===m,k=l||(y||!h?[Ss(m)]:Uw(m)),b=[m].concat(k).reduce(function(ve,ce){return ve.concat(Zt(ce)===yc?qw(e,{placement:ce,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:g}):ce)},[]),E=e.rects.reference,w=e.rects.popper,S=new Map,A=!0,M=b[0],L=0;L=0,H=T?"width":"height",C=Ni(e,{placement:z,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),x=T?U?_t:ut:U?St:ct;E[H]>w[H]&&(x=Ss(x));var _=Ss(x),D=[];if(s&&D.push(C[q]<=0),a&&D.push(C[x]<=0,C[_]<=0),D.every(function(ve){return ve})){M=z,A=!1;break}S.set(z,D)}if(A)for(var P=h?3:1,Z=function(ce){var Se=b.find(function(it){var ze=S.get(it);if(ze)return ze.slice(0,ce).every(function(dt){return dt})});if(Se)return M=Se,"break"},Q=P;Q>0;Q--){var pe=Z(Q);if(pe==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const Ww={name:"flip",enabled:!0,phase:"main",fn:Kw,requiresIfExists:["offset"],data:{_skip:!1}};function md(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function bd(n){return[ct,_t,St,ut].some(function(e){return n[e]>=0})}function Zw(n){var e=n.state,t=n.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ni(e,{elementContext:"reference"}),a=Ni(e,{altBoundary:!0}),l=md(o,r),c=md(a,i,s),u=bd(l),d=bd(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const Gw={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zw};function jw(n,e,t){var r=Zt(n),i=[ut,ct].indexOf(r)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[ut,_t].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Jw(n){var e=n.state,t=n.options,r=n.name,i=t.offset,s=i===void 0?[0,0]:i,o=lg.reduce(function(u,d){return u[d]=jw(d,e.rects,s),u},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}const Yw={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Jw};function Xw(n){var e=n.state,t=n.name;e.modifiersData[t]=mg({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Qw={name:"popperOffsets",enabled:!0,phase:"read",fn:Xw,data:{}};function ek(n){return n==="x"?"y":"x"}function tk(n){var e=n.state,t=n.options,r=n.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,d=t.padding,f=t.tether,p=f===void 0?!0:f,h=t.tetherOffset,g=h===void 0?0:h,m=Ni(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=Zt(e.placement),y=Ur(e.placement),k=!y,b=kc(v),E=ek(b),w=e.modifiersData.popperOffsets,S=e.rects.reference,A=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,L=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),z=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(w){if(s){var U,T=b==="y"?ct:ut,H=b==="y"?St:_t,C=b==="y"?"height":"width",x=w[b],_=x+m[T],D=x-m[H],P=p?-A[C]/2:0,Z=y===zr?S[C]:A[C],Q=y===zr?-A[C]:-S[C],pe=e.elements.arrow,ve=p&&pe?wc(pe):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:fg(),Se=ce[T],it=ce[H],ze=gi(0,S[C],ve[C]),dt=k?S[C]/2-P-ze-Se-L.mainAxis:Z-ze-Se-L.mainAxis,st=k?-S[C]/2+P+ze+it+L.mainAxis:Q+ze+it+L.mainAxis,bt=e.elements.arrow&&Wi(e.elements.arrow),ft=bt?b==="y"?bt.clientTop||0:bt.clientLeft||0:0,ue=(U=z==null?void 0:z[b])!=null?U:0,Me=x+dt-ue-ft,Xe=x+st-ue,Ne=gi(p?Us(_,Me):_,x,p?Jn(D,Xe):D);w[b]=Ne,q[b]=Ne-x}if(a){var ee,At=b==="x"?ct:ut,V=b==="x"?St:_t,le=w[E],me=E==="y"?"height":"width",oe=le+m[At],Ze=le-m[V],Ve=[ct,ut].indexOf(v)!==-1,$=(ee=z==null?void 0:z[E])!=null?ee:0,K=Ve?oe:le-S[me]-A[me]-$+L.altAxis,O=Ve?le+S[me]+A[me]-$-L.altAxis:Ze,I=p&&Ve?Sw(K,le,O):gi(p?K:oe,le,p?O:Ze);w[E]=I,q[E]=I-le}e.modifiersData[r]=q}}const nk={name:"preventOverflow",enabled:!0,phase:"main",fn:tk,requiresIfExists:["offset"]};function rk(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function ik(n){return n===gt(n)||!Ct(n)?xc(n):rk(n)}function sk(n){var e=n.getBoundingClientRect(),t=Vr(e.width)/n.offsetWidth||1,r=Vr(e.height)/n.offsetHeight||1;return t!==1||r!==1}function ok(n,e,t){t===void 0&&(t=!1);var r=Ct(e),i=Ct(e)&&sk(e),s=Rn(e),o=qr(n,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Jt(e)!=="body"||Cc(s))&&(a=ik(e)),Ct(e)?(l=qr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Ec(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function ak(n){var e=new Map,t=new Set,r=[];n.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return n.forEach(function(s){t.has(s.name)||i(s)}),r}function lk(n){var e=ak(n);return ww.reduce(function(t,r){return t.concat(e.filter(function(i){return i.phase===r}))},[])}function ck(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function uk(n){var e=n.reduce(function(t,r){var i=t[r.name];return t[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var yd={placement:"bottom",modifiers:[],strategy:"absolute"};function vd(){for(var n=arguments.length,e=new Array(n),t=0;t-1}function kg(n,e){return typeof n=="function"?n.apply(void 0,e):n}function wd(n,e){if(e===0)return n;var t;return function(r){clearTimeout(t),t=setTimeout(function(){n(r)},e)}}function mk(n){return n.split(/\s+/).filter(Boolean)}function xr(n){return[].concat(n)}function kd(n,e){n.indexOf(e)===-1&&n.push(e)}function bk(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function yk(n){return n.split("-")[0]}function Ks(n){return[].slice.call(n)}function xd(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function bi(){return document.createElement("div")}function Io(n){return["Element","Fragment"].some(function(e){return Sc(n,e)})}function vk(n){return Sc(n,"NodeList")}function wk(n){return Sc(n,"MouseEvent")}function kk(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function xk(n){return Io(n)?[n]:vk(n)?Ks(n):Array.isArray(n)?n:Ks(document.querySelectorAll(n))}function Sa(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Ed(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Ek(n){var e,t=xr(n),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Ck(n,e){var t=e.clientX,r=e.clientY;return n.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,c=yk(o.placement),u=o.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,f=c==="top"?u.bottom.y:0,p=c==="right"?u.left.x:0,h=c==="left"?u.right.x:0,g=s.top-r+d>l,m=r-s.bottom-f>l,v=s.left-t+p>l,y=t-s.right-h>l;return g||m||v||y})}function _a(n,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){n[r](i,t)})}function Cd(n,e){for(var t=e;t;){var r;if(n.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Ft={isTouch:!1},Sd=0;function Sk(){Ft.isTouch||(Ft.isTouch=!0,window.performance&&document.addEventListener("mousemove",xg))}function xg(){var n=performance.now();n-Sd<20&&(Ft.isTouch=!1,document.removeEventListener("mousemove",xg)),Sd=n}function _k(){var n=document.activeElement;if(kk(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function Mk(){document.addEventListener("touchstart",Sk,Hn),window.addEventListener("blur",_k)}var Ak=typeof window<"u"&&typeof document<"u",Tk=Ak?!!window.msCrypto:!1,Nk={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Ok={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ot=Object.assign({appendTo:wg,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Nk,Ok),Lk=Object.keys(Ot),Rk=function(e){var t=Object.keys(e);t.forEach(function(r){Ot[r]=e[r]})};function Eg(n){var e=n.plugins||[],t=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=n[s]!==void 0?n[s]:(a=Ot[s])!=null?a:o}return r},{});return Object.assign({},n,t)}function Dk(n,e){var t=e?Object.keys(Eg(Object.assign({},Ot,{plugins:e}))):Lk,r=t.reduce(function(i,s){var o=(n.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function _d(n,e){var t=Object.assign({},e,{content:kg(e.content,[n])},e.ignoreAttributes?{}:Dk(n,e.plugins));return t.aria=Object.assign({},Ot.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var Ik=function(){return"innerHTML"};function Nl(n,e){n[Ik()]=e}function Md(n){var e=bi();return n===!0?e.className=yg:(e.className=vg,Io(n)?e.appendChild(n):Nl(e,n)),e}function Ad(n,e){Io(e.content)?(Nl(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Nl(n,e.content):n.textContent=e.content)}function Ol(n){var e=n.firstElementChild,t=Ks(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(bg)}),arrow:t.find(function(r){return r.classList.contains(yg)||r.classList.contains(vg)}),backdrop:t.find(function(r){return r.classList.contains(gk)})}}function Cg(n){var e=bi(),t=bi();t.className=hk,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=bi();r.className=bg,r.setAttribute("data-state","hidden"),Ad(r,n.props),e.appendChild(t),t.appendChild(r),i(n.props,n.props);function i(s,o){var a=Ol(e),l=a.box,c=a.content,u=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Ad(c,n.props),o.arrow?u?s.arrow!==o.arrow&&(l.removeChild(u),l.appendChild(Md(o.arrow))):l.appendChild(Md(o.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:i}}Cg.$$tippy=!0;var Bk=1,ts=[],Ma=[];function Hk(n,e){var t=_d(n,Object.assign({},Ot,Eg(xd(e)))),r,i,s,o=!1,a=!1,l=!1,c=!1,u,d,f,p=[],h=wd(Me,t.interactiveDebounce),g,m=Bk++,v=null,y=bk(t.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:m,reference:n,popper:bi(),popperInstance:v,props:t,state:k,plugins:y,clearDelayTimeouts:K,setProps:O,setContent:I,show:j,hide:se,hideWithInteractivity:Re,enable:Ve,disable:$,unmount:pt,destroy:ea};if(!t.render)return b;var E=t.render(b),w=E.popper,S=E.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,n._tippy=b,w._tippy=b;var A=y.map(function(N){return N.fn(b)}),M=n.hasAttribute("aria-expanded");return bt(),P(),x(),_("onCreate",[b]),t.showOnCreate&&oe(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&T().addEventListener("mousemove",h)}),b;function L(){var N=b.props.touch;return Array.isArray(N)?N:[N,0]}function z(){return L()[0]==="hold"}function q(){var N;return!!((N=b.props.render)!=null&&N.$$tippy)}function U(){return g||n}function T(){var N=U().parentNode;return N?Ek(N):document}function H(){return Ol(w)}function C(N){return b.state.isMounted&&!b.state.isVisible||Ft.isTouch||u&&u.type==="focus"?0:Ca(b.props.delay,N?0:1,Ot.delay)}function x(N){N===void 0&&(N=!1),w.style.pointerEvents=b.props.interactive&&!N?"":"none",w.style.zIndex=""+b.props.zIndex}function _(N,G,ne){if(ne===void 0&&(ne=!0),A.forEach(function(he){he[N]&&he[N].apply(he,G)}),ne){var xe;(xe=b.props)[N].apply(xe,G)}}function D(){var N=b.props.aria;if(N.content){var G="aria-"+N.content,ne=w.id,xe=xr(b.props.triggerTarget||n);xe.forEach(function(he){var Qe=he.getAttribute(G);if(b.state.isVisible)he.setAttribute(G,Qe?Qe+" "+ne:ne);else{var yt=Qe&&Qe.replace(ne,"").trim();yt?he.setAttribute(G,yt):he.removeAttribute(G)}})}}function P(){if(!(M||!b.props.aria.expanded)){var N=xr(b.props.triggerTarget||n);N.forEach(function(G){b.props.interactive?G.setAttribute("aria-expanded",b.state.isVisible&&G===U()?"true":"false"):G.removeAttribute("aria-expanded")})}}function Z(){T().removeEventListener("mousemove",h),ts=ts.filter(function(N){return N!==h})}function Q(N){if(!(Ft.isTouch&&(l||N.type==="mousedown"))){var G=N.composedPath&&N.composedPath()[0]||N.target;if(!(b.props.interactive&&Cd(w,G))){if(xr(b.props.triggerTarget||n).some(function(ne){return Cd(ne,G)})){if(Ft.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[b,N]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||Se())}}}function pe(){l=!0}function ve(){l=!1}function ce(){var N=T();N.addEventListener("mousedown",Q,!0),N.addEventListener("touchend",Q,Hn),N.addEventListener("touchstart",ve,Hn),N.addEventListener("touchmove",pe,Hn)}function Se(){var N=T();N.removeEventListener("mousedown",Q,!0),N.removeEventListener("touchend",Q,Hn),N.removeEventListener("touchstart",ve,Hn),N.removeEventListener("touchmove",pe,Hn)}function it(N,G){dt(N,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&G()})}function ze(N,G){dt(N,G)}function dt(N,G){var ne=H().box;function xe(he){he.target===ne&&(_a(ne,"remove",xe),G())}if(N===0)return G();_a(ne,"remove",d),_a(ne,"add",xe),d=xe}function st(N,G,ne){ne===void 0&&(ne=!1);var xe=xr(b.props.triggerTarget||n);xe.forEach(function(he){he.addEventListener(N,G,ne),p.push({node:he,eventType:N,handler:G,options:ne})})}function bt(){z()&&(st("touchstart",ue,{passive:!0}),st("touchend",Xe,{passive:!0})),mk(b.props.trigger).forEach(function(N){if(N!=="manual")switch(st(N,ue),N){case"mouseenter":st("mouseleave",Xe);break;case"focus":st(Tk?"focusout":"blur",Ne);break;case"focusin":st("focusout",Ne);break}})}function ft(){p.forEach(function(N){var G=N.node,ne=N.eventType,xe=N.handler,he=N.options;G.removeEventListener(ne,xe,he)}),p=[]}function ue(N){var G,ne=!1;if(!(!b.state.isEnabled||ee(N)||a)){var xe=((G=u)==null?void 0:G.type)==="focus";u=N,g=N.currentTarget,P(),!b.state.isVisible&&wk(N)&&ts.forEach(function(he){return he(N)}),N.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?ne=!0:oe(N),N.type==="click"&&(o=!ne),ne&&!xe&&Ze(N)}}function Me(N){var G=N.target,ne=U().contains(G)||w.contains(G);if(!(N.type==="mousemove"&&ne)){var xe=me().concat(w).map(function(he){var Qe,yt=he._tippy,ur=(Qe=yt.popperInstance)==null?void 0:Qe.state;return ur?{popperRect:he.getBoundingClientRect(),popperState:ur,props:t}:null}).filter(Boolean);Ck(xe,N)&&(Z(),Ze(N))}}function Xe(N){var G=ee(N)||b.props.trigger.indexOf("click")>=0&&o;if(!G){if(b.props.interactive){b.hideWithInteractivity(N);return}Ze(N)}}function Ne(N){b.props.trigger.indexOf("focusin")<0&&N.target!==U()||b.props.interactive&&N.relatedTarget&&w.contains(N.relatedTarget)||Ze(N)}function ee(N){return Ft.isTouch?z()!==N.type.indexOf("touch")>=0:!1}function At(){V();var N=b.props,G=N.popperOptions,ne=N.placement,xe=N.offset,he=N.getReferenceClientRect,Qe=N.moveTransition,yt=q()?Ol(w).arrow:null,ur=he?{getBoundingClientRect:he,contextElement:he.contextElement||U()}:n,au={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ji){var dr=ji.state;if(q()){var vb=H(),na=vb.box;["placement","reference-hidden","escaped"].forEach(function(Ji){Ji==="placement"?na.setAttribute("data-placement",dr.placement):dr.attributes.popper["data-popper-"+Ji]?na.setAttribute("data-"+Ji,""):na.removeAttribute("data-"+Ji)}),dr.attributes.popper={}}}},Dn=[{name:"offset",options:{offset:xe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Qe}},au];q()&&yt&&Dn.push({name:"arrow",options:{element:yt,padding:3}}),Dn.push.apply(Dn,(G==null?void 0:G.modifiers)||[]),b.popperInstance=pk(ur,w,Object.assign({},G,{placement:ne,onFirstUpdate:f,modifiers:Dn}))}function V(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function le(){var N=b.props.appendTo,G,ne=U();b.props.interactive&&N===wg||N==="parent"?G=ne.parentNode:G=kg(N,[ne]),G.contains(w)||G.appendChild(w),b.state.isMounted=!0,At()}function me(){return Ks(w.querySelectorAll("[data-tippy-root]"))}function oe(N){b.clearDelayTimeouts(),N&&_("onTrigger",[b,N]),ce();var G=C(!0),ne=L(),xe=ne[0],he=ne[1];Ft.isTouch&&xe==="hold"&&he&&(G=he),G?r=setTimeout(function(){b.show()},G):b.show()}function Ze(N){if(b.clearDelayTimeouts(),_("onUntrigger",[b,N]),!b.state.isVisible){Se();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&o)){var G=C(!1);G?i=setTimeout(function(){b.state.isVisible&&b.hide()},G):s=requestAnimationFrame(function(){b.hide()})}}function Ve(){b.state.isEnabled=!0}function $(){b.hide(),b.state.isEnabled=!1}function K(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function O(N){if(!b.state.isDestroyed){_("onBeforeUpdate",[b,N]),ft();var G=b.props,ne=_d(n,Object.assign({},G,xd(N),{ignoreAttributes:!0}));b.props=ne,bt(),G.interactiveDebounce!==ne.interactiveDebounce&&(Z(),h=wd(Me,ne.interactiveDebounce)),G.triggerTarget&&!ne.triggerTarget?xr(G.triggerTarget).forEach(function(xe){xe.removeAttribute("aria-expanded")}):ne.triggerTarget&&n.removeAttribute("aria-expanded"),P(),x(),S&&S(G,ne),b.popperInstance&&(At(),me().forEach(function(xe){requestAnimationFrame(xe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[b,N])}}function I(N){b.setProps({content:N})}function j(){var N=b.state.isVisible,G=b.state.isDestroyed,ne=!b.state.isEnabled,xe=Ft.isTouch&&!b.props.touch,he=Ca(b.props.duration,0,Ot.duration);if(!(N||G||ne||xe)&&!U().hasAttribute("disabled")&&(_("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,q()&&(w.style.visibility="visible"),x(),ce(),b.state.isMounted||(w.style.transition="none"),q()){var Qe=H(),yt=Qe.box,ur=Qe.content;Sa([yt,ur],0)}f=function(){var Dn;if(!(!b.state.isVisible||c)){if(c=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,q()&&b.props.animation){var ta=H(),ji=ta.box,dr=ta.content;Sa([ji,dr],he),Ed([ji,dr],"visible")}D(),P(),kd(Ma,b),(Dn=b.popperInstance)==null||Dn.forceUpdate(),_("onMount",[b]),b.props.animation&&q()&&ze(he,function(){b.state.isShown=!0,_("onShown",[b])})}},le()}}function se(){var N=!b.state.isVisible,G=b.state.isDestroyed,ne=!b.state.isEnabled,xe=Ca(b.props.duration,1,Ot.duration);if(!(N||G||ne)&&(_("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,o=!1,q()&&(w.style.visibility="hidden"),Z(),Se(),x(!0),q()){var he=H(),Qe=he.box,yt=he.content;b.props.animation&&(Sa([Qe,yt],xe),Ed([Qe,yt],"hidden"))}D(),P(),b.props.animation?q()&&it(xe,b.unmount):b.unmount()}}function Re(N){T().addEventListener("mousemove",h),kd(ts,h),h(N)}function pt(){b.state.isVisible&&b.hide(),b.state.isMounted&&(V(),me().forEach(function(N){N._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),Ma=Ma.filter(function(N){return N!==b}),b.state.isMounted=!1,_("onHidden",[b]))}function ea(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),ft(),delete n._tippy,b.state.isDestroyed=!0,_("onDestroy",[b]))}}function Fe(n,e){e===void 0&&(e={});var t=Ot.plugins.concat(e.plugins||[]);Mk();var r=Object.assign({},e,{plugins:t}),i=xk(n),s=i.reduce(function(o,a){var l=a&&Hk(a,r);return l&&o.push(l),o},[]);return Io(n)?s[0]:s}Fe.defaultProps=Ot;Fe.setDefaultProps=Rk;Fe.currentInput=Ft;Object.assign({},cg,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});Fe.setDefaultProps({render:Cg});class jr extends ge{constructor(){super(...arguments),this.menuData=[],this.menuTextWidth="40px",this.defaultMenuIndex=0,this.refreshMenuText=!0,this.width="48px",this.dropDivWith="100px",this.dropDivHeight="260px",this.showItemsTip=!1}renderTemplate(){this.template=`
@@ -104,34 +104,34 @@ img.ProseMirror-separator {
- `}connectedCallback(){this.renderTemplate(),super.connectedCallback(),this.textEl=this.querySelector("#text"),this.tippyInstance=Ke(this.querySelector("#tippy"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");e.style.height=this.dropDivHeight,e.style.width=this.dropDivWith,e.classList.add("aie-dropdown-container");for(let t=0;t
${this.onDropdownItemRender(t)}
- `,r.addEventListener("click",()=>{this.onDropdownItemClick(t),this.tippyInstance.hide()}),this.showItemsTip){const i=this.menuData[t];Ke(r,{appendTo:()=>this.closest(".aie-container"),content:i.tip||i.title,theme:"aietip",arrow:!0,placement:"right"})}e.appendChild(r)}return this.tippyEl=e,e}onTransaction(e){var i,s;const t=(i=this.tippyEl)==null?void 0:i.querySelector(".red-dot");t&&t.classList.remove("red-dot");let r=this.defaultMenuIndex;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Hk,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(t)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e]=this.observers[e].filter(r=>r!==t)}}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i{o(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(o=>{o.apply(o,[e,...r])})}}function ni(){let n,e;const t=new Promise((r,i)=>{n=r,e=i});return t.resolve=n,t.reject=e,t}function Ad(n){return n==null?"":""+n}function Pk(n,e,t){n.forEach(r=>{e[r]&&(t[r]=e[r])})}function xc(n,e,t){function r(o){return o&&o.indexOf("###")>-1?o.replace(/###/g,"."):o}function i(){return!n||typeof n=="string"}const s=typeof e!="string"?[].concat(e):e.split(".");for(;s.length>1;){if(i())return{};const o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function Td(n,e,t){const{obj:r,k:i}=xc(n,e,Object);r[i]=t}function $k(n,e,t,r){const{obj:i,k:s}=xc(n,e,Object);i[s]=i[s]||[],r&&(i[s]=i[s].concat(t)),r||i[s].push(t)}function Ws(n,e){const{obj:t,k:r}=xc(n,e);if(t)return t[r]}function Fk(n,e,t){const r=Ws(n,t);return r!==void 0?r:Ws(e,t)}function xg(n,e,t){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):xg(n[r],e[r],t):n[r]=e[r]);return n}function hr(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var zk={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Vk(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,e=>zk[e]):n}const qk=[" ",",","?","!",";"];function Uk(n,e,t){e=e||"",t=t||"";const r=qk.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(n);if(!s){const o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function Gs(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return n[e];const r=e.split(t);let i=n;for(let s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const c=r.slice(s+o).join(t);return c?Gs(l,c,t):void 0}i=i[r[s]]}return i}function Zs(n){return n&&n.indexOf("_")>0?n.replace("_","-"):n}class Nd extends Do{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[e,t];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(a=e.split("."));const l=Ws(this.data,a);return l||!o||typeof r!="string"?l:Gs(this.data&&this.data[e]&&this.data[e][t],r,s)}addResource(e,t,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),i=t,t=a[1]),this.addNamespaces(t),Td(this.data,a,i),s.silent||this.emit("added",e,t,r,i)}addResources(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(typeof r[s]=="string"||Object.prototype.toString.apply(r[s])==="[object Array]")&&this.addResource(e,t,s,r[s],{silent:!0});i.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),i=r,r=t,t=a[1]),this.addNamespaces(t);let l=Ws(this.data,a)||{};i?xg(l,r,s):l={...l,...r},Td(this.data,a,l),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var Cg={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,r,i){return n.forEach(s=>{this.processors[s]&&(e=this.processors[s].process(e,t,r,i))}),e}};const Od={};class js extends Do{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Pk(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ut.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,t);return r&&r.res!==void 0}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Uk(e,r,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:s};const c=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(i)}return typeof s=="string"&&(s=[s]),{key:e,namespaces:s}}translate(e,t,r){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],t),l=a[a.length-1],c=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const b=t.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${b}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const d=this.resolve(e,t);let f=d&&d.res;const p=d&&d.usedKey||o,h=d&&d.exactUsedKey||o,g=Object.prototype.toString.apply(f),m=["[object Number]","[object Function]","[object RegExp]"],v=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&m.indexOf(g)<0&&!(typeof v=="string"&&g==="[object Array]")){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...t,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d.usedParams=this.getUsedParamsDetails(t),d):b}if(s){const b=g==="[object Array]",x=b?[]:{},w=b?h:p;for(const S in f)if(Object.prototype.hasOwnProperty.call(f,S)){const A=`${w}${s}${S}`;x[S]=this.translate(A,{...t,joinArrays:!1,ns:a}),x[S]===A&&(x[S]=f[S])}f=x}}else if(y&&typeof v=="string"&&g==="[object Array]")f=f.join(v),f&&(f=this.extendTranslation(f,e,t,r));else{let b=!1,x=!1;const w=t.count!==void 0&&typeof t.count!="string",S=js.hasDefaultValue(t),A=w?this.pluralResolver.getSuffix(c,t.count,t):"",M=t.ordinal&&w?this.pluralResolver.getSuffix(c,t.count,{ordinal:!1}):"",L=t[`defaultValue${A}`]||t[`defaultValue${M}`]||t.defaultValue;!this.isValidLookup(f)&&S&&(b=!0,f=L),this.isValidLookup(f)||(x=!0,f=o);const q=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:f,U=S&&L!==f&&this.options.updateMissing;if(x||b||U){if(this.logger.log(U?"updateKey":"missingKey",c,l,o,U?L:f),s){const E=this.resolve(o,{...t,keySeparator:!1});E&&E.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let T=[];const H=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&H&&H[0])for(let E=0;E{const P=S&&D!==f?D:q;this.options.missingKeyHandler?this.options.missingKeyHandler(E,l,_,P,U,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(E,l,_,P,U,t),this.emit("missingKey",E,l,_,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?T.forEach(E=>{this.pluralResolver.getSuffixes(E,t).forEach(_=>{C([E],o+_,t[`defaultValue${_}`]||L)})}):C(T,o,L))}f=this.extendTranslation(f,e,t,d,r),x&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(x||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(t),d):f}extendTranslation(e,t,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language,r),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const c=this.extractFromKey(l,t),u=c.key;i=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=t.count!==void 0&&typeof t.count!="string",p=f&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),h=t.context!==void 0&&(typeof t.context=="string"||typeof t.context=="number")&&t.context!=="",g=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(m=>{this.isValidLookup(r)||(a=m,!Od[`${g[0]}-${m}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(Od[`${g[0]}-${m}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(v=>{if(this.isValidLookup(r))return;o=v;const y=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,u,v,m,t);else{let b;f&&(b=this.pluralResolver.getSuffix(v,t.count,t));const x=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(u+b),t.ordinal&&b.indexOf(w)===0&&y.push(u+b.replace(w,this.options.pluralSeparator)),p&&y.push(u+x)),h){const S=`${u}${this.options.contextSeparator}${t.context}`;y.push(S),f&&(y.push(S+b),t.ordinal&&b.indexOf(w)===0&&y.push(S+b.replace(w,this.options.pluralSeparator)),p&&y.push(S+x))}}let k;for(;k=y.pop();)this.isValidLookup(r)||(s=k,r=this.getResource(v,m,k,t))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,i):this.resourceStore.getResource(e,t,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&typeof e.replace!="string";let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of t)delete i[s]}return i}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&e[r]!==void 0)return!0;return!1}}function Ca(n){return n.charAt(0).toUpperCase()+n.slice(1)}class Ld{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ut.create("languageUtils")}getScriptPartFromCode(e){if(e=Zs(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Zs(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ca(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ca(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ca(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(r=>{if(t)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&s.indexOf(i)===0)return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):typeof e=="string"&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let Kk=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Wk={1:function(n){return+(n>1)},2:function(n){return+(n!=1)},3:function(n){return 0},4:function(n){return n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2},5:function(n){return n==0?0:n==1?1:n==2?2:n%100>=3&&n%100<=10?3:n%100>=11?4:5},6:function(n){return n==1?0:n>=2&&n<=4?1:2},7:function(n){return n==1?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2},8:function(n){return n==1?0:n==2?1:n!=8&&n!=11?2:3},9:function(n){return+(n>=2)},10:function(n){return n==1?0:n==2?1:n<7?2:n<11?3:4},11:function(n){return n==1||n==11?0:n==2||n==12?1:n>2&&n<20?2:3},12:function(n){return+(n%10!=1||n%100==11)},13:function(n){return+(n!==0)},14:function(n){return n==1?0:n==2?1:n==3?2:3},15:function(n){return n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?1:2},16:function(n){return n%10==1&&n%100!=11?0:n!==0?1:2},17:function(n){return n==1||n%10==1&&n%100!=11?0:1},18:function(n){return n==0?0:n==1?1:2},19:function(n){return n==1?0:n==0||n%100>1&&n%100<11?1:n%100>10&&n%100<20?2:3},20:function(n){return n==1?0:n==0||n%100>0&&n%100<20?1:2},21:function(n){return n%100==1?1:n%100==2?2:n%100==3||n%100==4?3:0},22:function(n){return n==1?0:n==2?1:(n<0||n>10)&&n%10==0?2:3}};const Gk=["v1","v2","v3"],Zk=["v4"],Rd={zero:0,one:1,two:2,few:3,many:4,other:5};function jk(){const n={};return Kk.forEach(e=>{e.lngs.forEach(t=>{n[t]={numbers:e.nr,plurals:Wk[e.fc]}})}),n}class Jk{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Ut.create("pluralResolver"),(!this.options.compatibilityJSON||Zk.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=jk()}addRule(e,t){this.rules[e]=t}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Zs(e),{type:t.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${t}${i}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,t);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>Rd[i]-Rd[s]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,t)):[]}getSuffix(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:this.getSuffixRetroCompatible(i,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Gk.includes(this.options.compatibilityJSON)}}function Dd(n,e,t){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Fk(n,e,t);return!s&&i&&typeof t=="string"&&(s=Gs(n,t,r),s===void 0&&(s=Gs(e,t,r))),s}class Yk{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ut.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const t=e.interpolation;this.escape=t.escape!==void 0?t.escape:Vk,this.escapeValue=t.escapeValue!==void 0?t.escapeValue:!0,this.useRawValueToEscape=t.useRawValueToEscape!==void 0?t.useRawValueToEscape:!1,this.prefix=t.prefix?hr(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?hr(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?hr(t.nestingPrefix):t.nestingPrefixEscaped||hr("$t("),this.nestingSuffix=t.nestingSuffix?hr(t.nestingSuffix):t.nestingSuffixEscaped||hr(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=t.alwaysFormat!==void 0?t.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(e,"g");const t=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(t,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(e,t,r,i){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(h){return h.replace(/\$/g,"$$$$")}const u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=Dd(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...t,interpolationkey:h}):y}const g=h.split(this.formatSeparator),m=g.shift().trim(),v=g.join(this.formatSeparator).trim();return this.format(Dd(t,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...i,...t,interpolationkey:m})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>c(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?c(this.escape(h)):c(h)}].forEach(h=>{for(a=0;s=h.regex.exec(e);){const g=s[1].trim();if(o=u(g),o===void 0)if(typeof d=="function"){const v=d(e,s,i);o=typeof v=="string"?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=Ad(o));const m=h.safeValue(o);if(e=e.replace(s[0],m),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;function a(l,c){const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const p=f.match(/'/g),h=f.match(/"/g);(p&&p.length%2===0&&!h||h.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),c&&(o={...c,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${u}${f}`}return delete o.defaultValue,l}for(;i=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=u.shift(),l=u,c=!0}if(s=t(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&typeof s!="string")return s;typeof s!="string"&&(s=Ad(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),c&&(s=l.reduce((u,d)=>this.format(u,d,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}function Xk(n){let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const r=n.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(o=>{if(!o)return;const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,"");t[a.trim()]||(t[a.trim()]=c),c==="false"&&(t[a.trim()]=!1),c==="true"&&(t[a.trim()]=!0),isNaN(c)||(t[a.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:t}}function gr(n){const e={};return function(r,i,s){const o=i+JSON.stringify(s);let a=e[o];return a||(a=n(Zs(i),s),e[o]=a),a(r)}}class Qk{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ut.create("formatter"),this.options=e,this.formats={number:gr((t,r)=>{const i=new Intl.NumberFormat(t,{...r});return s=>i.format(s)}),currency:gr((t,r)=>{const i=new Intl.NumberFormat(t,{...r,style:"currency"});return s=>i.format(s)}),datetime:gr((t,r)=>{const i=new Intl.DateTimeFormat(t,{...r});return s=>i.format(s)}),relativetime:gr((t,r)=>{const i=new Intl.RelativeTimeFormat(t,{...r});return s=>i.format(s,r.range||"day")}),list:gr((t,r)=>{const i=new Intl.ListFormat(t,{...r});return s=>i.format(s)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=gr(t)}format(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return t.split(this.formatSeparator).reduce((a,l)=>{const{formatName:c,formatOptions:u}=Xk(l);if(this.formats[c]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},p=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[c](a,p,{...u,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}function eE(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}class tE extends Do{constructor(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ut.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,t,r,i){const s={},o={},a={},l={};return e.forEach(c=>{let u=!0;t.forEach(d=>{const f=`${c}|${d}`;!r.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,u=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){const i=e.split("|"),s=i[0],o=i[1];t&&this.emit("failedLoading",s,o,t),r&&this.store.addResourceBundle(s,o,r),this.state[e]=t?-1:2;const a={};this.queue.forEach(l=>{$k(l.loaded,[s],o),eE(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&i{this.read.call(this,e,t,r,i+1,s*2,o)},s);return}o(c,u)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const c=l(e,t);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);const s=this.queueLoad(e,t,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${s} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,t,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,t,r,i,l):u=c(e,t,r,i),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(e,t,r,i,a,l)}!e||!e[0]||this.store.addResource(e[0],t,r,i)}}}function Id(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(i=>{t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:(n,e,t,r)=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Bd(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function ns(){}function nE(n){Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}class Ni extends Do{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Bd(e),this.services={},this.logger=Ut,this.modules={external:[]},nE(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof t=="function"&&(r=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(typeof t.ns=="string"?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const i=Id();this.options={...i,...this.options,...Bd(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);function s(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?Ut.init(s(this.modules.logger),this.options):Ut.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=Qk);const d=new Ld(this.options);this.store=new Nd(this.options.resources,this.options);const f=this.services;f.logger=Ut,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Jk(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Yk(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new tE(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var h=arguments.length,g=new Array(h>1?h-1:0),m=1;m1?h-1:0),m=1;m{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ns),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const l=ni(),c=()=>{const u=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ns;const i=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(e,t,r){const i=ni();return e||(e=this.languages),t||(t=this.options.ns),r||(r=ns),this.services.backendConnector.reload(e,t,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&Cg.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,t){var r=this;this.isLanguageChangingTo=e;const i=ni();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),t&&t(l,function(){return r.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),i}getFixedT(e,t,r){var i=this;const s=function(o,a){let l;if(typeof a!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${l.keyPrefix}${f}${h}`):p=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,i.t(p,l)};return typeof e=="string"?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,t){const r=ni();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),t&&t(i)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=ni();typeof e=="string"&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>i.indexOf(o)<0);return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),t&&t(o)}),r):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Ld(Id());return t.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Ni(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ns;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Ni(i);return(e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Nd(this.store.data,i),s.services.resourceStore=s.store),s.translator=new js(s.services,i),s.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;use(e)),this.dropDivHeight="265px",this.dropDivWith="150px"}onDropdownActive(e,t){return t==0?e.isActive("paragraph"):e.isActive("heading",{level:t})}onDropdownItemClick(e){e==0?this.editor.chain().setParagraph().run():this.editor.chain().setHeading({level:e}).run()}onDropdownItemRender(e){return e==0?this.menuData[e]:`${this.menuData[e]}`}onMenuTextRender(e){return this.menuData[e].replace(" ","")}};const sE=[{name:"宋体",value:"SimSun"},{name:"仿宋",value:"FangSong"},{name:"黑体",value:"SimHei"},{name:"楷体",value:"KaiTi"},{name:"微软雅黑",value:"Microsoft YaHei"},{name:"方正仿宋简体_GBK",value:"FangSong_GB2312"},{name:"Arial",value:"Arial"}];let oE=class extends Zr{constructor(){super(),this.width="72px",this.menuTextWidth="60px",this.dropDivWith="150px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.fontFamily)==null?void 0:r.values)||sE,this.menuData=[{name:se("default-font-family"),value:""}].concat(this.menuData)}onDropdownActive(e,t){return e.isActive("textStyle",{fontFamily:this.menuData[t].value})}onDropdownItemClick(e){const t=this.menuData[e].value;t?this.editor.chain().setFontFamily(t).run():this.editor.chain().unsetFontFamily().run()}onDropdownItemRender(e){return this.menuData[e].name}onMenuTextRender(e){return this.menuData[e].name}};const aE=[{name:"9",value:9},{name:"10",value:10},{name:"11",value:11},{name:"12",value:12},{name:"14",value:14},{name:"18",value:18},{name:"20",value:20},{name:"22",value:22},{name:"24",value:24},{name:"26",value:26},{name:"28",value:28},{name:"30",value:30},{name:"36",value:36},{name:"42",value:42},{name:"48",value:48},{name:"56",value:56},{name:"72",value:72}];class lE extends Zr{constructor(){super(),this.dropDivWith="134px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.fontSize)==null?void 0:r.values)||aE;for(let i=0;i{this.onDropdownItemClick(t),this.tippyInstance.hide()}),this.showItemsTip){const i=this.menuData[t];Fe(r,{appendTo:()=>this.closest(".aie-container"),content:i.tip||i.title,theme:"aietip",arrow:!0,placement:"right"})}e.appendChild(r)}return this.tippyEl=e,e}onTransaction(e){var i,s;const t=(i=this.tippyEl)==null?void 0:i.querySelector(".red-dot");t&&t.classList.remove("red-dot");let r=this.defaultMenuIndex;for(let o=0;o1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Pk,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(t)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e]=this.observers[e].filter(r=>r!==t)}}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i{o(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(o=>{o.apply(o,[e,...r])})}}function ri(){let n,e;const t=new Promise((r,i)=>{n=r,e=i});return t.resolve=n,t.reject=e,t}function Td(n){return n==null?"":""+n}function $k(n,e,t){n.forEach(r=>{e[r]&&(t[r]=e[r])})}function _c(n,e,t){function r(o){return o&&o.indexOf("###")>-1?o.replace(/###/g,"."):o}function i(){return!n||typeof n=="string"}const s=typeof e!="string"?[].concat(e):e.split(".");for(;s.length>1;){if(i())return{};const o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function Nd(n,e,t){const{obj:r,k:i}=_c(n,e,Object);r[i]=t}function Fk(n,e,t,r){const{obj:i,k:s}=_c(n,e,Object);i[s]=i[s]||[],r&&(i[s]=i[s].concat(t)),r||i[s].push(t)}function Zs(n,e){const{obj:t,k:r}=_c(n,e);if(t)return t[r]}function zk(n,e,t){const r=Zs(n,t);return r!==void 0?r:Zs(e,t)}function Sg(n,e,t){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):Sg(n[r],e[r],t):n[r]=e[r]);return n}function hr(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Vk={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function qk(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,e=>Vk[e]):n}const Uk=[" ",",","?","!",";"];function Kk(n,e,t){e=e||"",t=t||"";const r=Uk.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(n);if(!s){const o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function Gs(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return n[e];const r=e.split(t);let i=n;for(let s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const c=r.slice(s+o).join(t);return c?Gs(l,c,t):void 0}i=i[r[s]]}return i}function js(n){return n&&n.indexOf("_")>0?n.replace("_","-"):n}class Od extends Bo{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[e,t];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(a=e.split("."));const l=Zs(this.data,a);return l||!o||typeof r!="string"?l:Gs(this.data&&this.data[e]&&this.data[e][t],r,s)}addResource(e,t,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),i=t,t=a[1]),this.addNamespaces(t),Nd(this.data,a,i),s.silent||this.emit("added",e,t,r,i)}addResources(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(typeof r[s]=="string"||Object.prototype.toString.apply(r[s])==="[object Array]")&&this.addResource(e,t,s,r[s],{silent:!0});i.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),i=r,r=t,t=a[1]),this.addNamespaces(t);let l=Zs(this.data,a)||{};i?Sg(l,r,s):l={...l,...r},Nd(this.data,a,l),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var _g={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,r,i){return n.forEach(s=>{this.processors[s]&&(e=this.processors[s].process(e,t,r,i))}),e}};const Ld={};class Js extends Bo{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),$k(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ut.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,t);return r&&r.res!==void 0}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Kk(e,r,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:s};const c=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(i)}return typeof s=="string"&&(s=[s]),{key:e,namespaces:s}}translate(e,t,r){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],t),l=a[a.length-1],c=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const b=t.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${b}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const d=this.resolve(e,t);let f=d&&d.res;const p=d&&d.usedKey||o,h=d&&d.exactUsedKey||o,g=Object.prototype.toString.apply(f),m=["[object Number]","[object Function]","[object RegExp]"],v=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&m.indexOf(g)<0&&!(typeof v=="string"&&g==="[object Array]")){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...t,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d.usedParams=this.getUsedParamsDetails(t),d):b}if(s){const b=g==="[object Array]",E=b?[]:{},w=b?h:p;for(const S in f)if(Object.prototype.hasOwnProperty.call(f,S)){const A=`${w}${s}${S}`;E[S]=this.translate(A,{...t,joinArrays:!1,ns:a}),E[S]===A&&(E[S]=f[S])}f=E}}else if(y&&typeof v=="string"&&g==="[object Array]")f=f.join(v),f&&(f=this.extendTranslation(f,e,t,r));else{let b=!1,E=!1;const w=t.count!==void 0&&typeof t.count!="string",S=Js.hasDefaultValue(t),A=w?this.pluralResolver.getSuffix(c,t.count,t):"",M=t.ordinal&&w?this.pluralResolver.getSuffix(c,t.count,{ordinal:!1}):"",L=t[`defaultValue${A}`]||t[`defaultValue${M}`]||t.defaultValue;!this.isValidLookup(f)&&S&&(b=!0,f=L),this.isValidLookup(f)||(E=!0,f=o);const q=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:f,U=S&&L!==f&&this.options.updateMissing;if(E||b||U){if(this.logger.log(U?"updateKey":"missingKey",c,l,o,U?L:f),s){const x=this.resolve(o,{...t,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let T=[];const H=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&H&&H[0])for(let x=0;x{const P=S&&D!==f?D:q;this.options.missingKeyHandler?this.options.missingKeyHandler(x,l,_,P,U,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(x,l,_,P,U,t),this.emit("missingKey",x,l,_,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?T.forEach(x=>{this.pluralResolver.getSuffixes(x,t).forEach(_=>{C([x],o+_,t[`defaultValue${_}`]||L)})}):C(T,o,L))}f=this.extendTranslation(f,e,t,d,r),E&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(E||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(t),d):f}extendTranslation(e,t,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language,r),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const c=this.extractFromKey(l,t),u=c.key;i=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=t.count!==void 0&&typeof t.count!="string",p=f&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),h=t.context!==void 0&&(typeof t.context=="string"||typeof t.context=="number")&&t.context!=="",g=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(m=>{this.isValidLookup(r)||(a=m,!Ld[`${g[0]}-${m}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(Ld[`${g[0]}-${m}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(v=>{if(this.isValidLookup(r))return;o=v;const y=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,u,v,m,t);else{let b;f&&(b=this.pluralResolver.getSuffix(v,t.count,t));const E=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(u+b),t.ordinal&&b.indexOf(w)===0&&y.push(u+b.replace(w,this.options.pluralSeparator)),p&&y.push(u+E)),h){const S=`${u}${this.options.contextSeparator}${t.context}`;y.push(S),f&&(y.push(S+b),t.ordinal&&b.indexOf(w)===0&&y.push(S+b.replace(w,this.options.pluralSeparator)),p&&y.push(S+E))}}let k;for(;k=y.pop();)this.isValidLookup(r)||(s=k,r=this.getResource(v,m,k,t))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,i):this.resourceStore.getResource(e,t,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&typeof e.replace!="string";let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of t)delete i[s]}return i}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&e[r]!==void 0)return!0;return!1}}function Aa(n){return n.charAt(0).toUpperCase()+n.slice(1)}class Rd{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ut.create("languageUtils")}getScriptPartFromCode(e){if(e=js(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=js(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const t=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Aa(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Aa(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Aa(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(r=>{if(t)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&s.indexOf(i)===0)return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):typeof e=="string"&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let Wk=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Zk={1:function(n){return+(n>1)},2:function(n){return+(n!=1)},3:function(n){return 0},4:function(n){return n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2},5:function(n){return n==0?0:n==1?1:n==2?2:n%100>=3&&n%100<=10?3:n%100>=11?4:5},6:function(n){return n==1?0:n>=2&&n<=4?1:2},7:function(n){return n==1?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2},8:function(n){return n==1?0:n==2?1:n!=8&&n!=11?2:3},9:function(n){return+(n>=2)},10:function(n){return n==1?0:n==2?1:n<7?2:n<11?3:4},11:function(n){return n==1||n==11?0:n==2||n==12?1:n>2&&n<20?2:3},12:function(n){return+(n%10!=1||n%100==11)},13:function(n){return+(n!==0)},14:function(n){return n==1?0:n==2?1:n==3?2:3},15:function(n){return n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?1:2},16:function(n){return n%10==1&&n%100!=11?0:n!==0?1:2},17:function(n){return n==1||n%10==1&&n%100!=11?0:1},18:function(n){return n==0?0:n==1?1:2},19:function(n){return n==1?0:n==0||n%100>1&&n%100<11?1:n%100>10&&n%100<20?2:3},20:function(n){return n==1?0:n==0||n%100>0&&n%100<20?1:2},21:function(n){return n%100==1?1:n%100==2?2:n%100==3||n%100==4?3:0},22:function(n){return n==1?0:n==2?1:(n<0||n>10)&&n%10==0?2:3}};const Gk=["v1","v2","v3"],jk=["v4"],Dd={zero:0,one:1,two:2,few:3,many:4,other:5};function Jk(){const n={};return Wk.forEach(e=>{e.lngs.forEach(t=>{n[t]={numbers:e.nr,plurals:Zk[e.fc]}})}),n}class Yk{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Ut.create("pluralResolver"),(!this.options.compatibilityJSON||jk.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Jk()}addRule(e,t){this.rules[e]=t}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(js(e),{type:t.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${t}${i}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,t);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>Dd[i]-Dd[s]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,t)):[]}getSuffix(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:this.getSuffixRetroCompatible(i,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Gk.includes(this.options.compatibilityJSON)}}function Id(n,e,t){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=zk(n,e,t);return!s&&i&&typeof t=="string"&&(s=Gs(n,t,r),s===void 0&&(s=Gs(e,t,r))),s}class Xk{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ut.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const t=e.interpolation;this.escape=t.escape!==void 0?t.escape:qk,this.escapeValue=t.escapeValue!==void 0?t.escapeValue:!0,this.useRawValueToEscape=t.useRawValueToEscape!==void 0?t.useRawValueToEscape:!1,this.prefix=t.prefix?hr(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?hr(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?hr(t.nestingPrefix):t.nestingPrefixEscaped||hr("$t("),this.nestingSuffix=t.nestingSuffix?hr(t.nestingSuffix):t.nestingSuffixEscaped||hr(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=t.alwaysFormat!==void 0?t.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(e,"g");const t=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(t,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(e,t,r,i){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(h){return h.replace(/\$/g,"$$$$")}const u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=Id(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...t,interpolationkey:h}):y}const g=h.split(this.formatSeparator),m=g.shift().trim(),v=g.join(this.formatSeparator).trim();return this.format(Id(t,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...i,...t,interpolationkey:m})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>c(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?c(this.escape(h)):c(h)}].forEach(h=>{for(a=0;s=h.regex.exec(e);){const g=s[1].trim();if(o=u(g),o===void 0)if(typeof d=="function"){const v=d(e,s,i);o=typeof v=="string"?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=Td(o));const m=h.safeValue(o);if(e=e.replace(s[0],m),f?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;function a(l,c){const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const p=f.match(/'/g),h=f.match(/"/g);(p&&p.length%2===0&&!h||h.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),c&&(o={...c,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${u}${f}`}return delete o.defaultValue,l}for(;i=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=u.shift(),l=u,c=!0}if(s=t(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&typeof s!="string")return s;typeof s!="string"&&(s=Td(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),c&&(s=l.reduce((u,d)=>this.format(u,d,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}function Qk(n){let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const r=n.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(o=>{if(!o)return;const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,"");t[a.trim()]||(t[a.trim()]=c),c==="false"&&(t[a.trim()]=!1),c==="true"&&(t[a.trim()]=!0),isNaN(c)||(t[a.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:t}}function gr(n){const e={};return function(r,i,s){const o=i+JSON.stringify(s);let a=e[o];return a||(a=n(js(i),s),e[o]=a),a(r)}}class ex{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Ut.create("formatter"),this.options=e,this.formats={number:gr((t,r)=>{const i=new Intl.NumberFormat(t,{...r});return s=>i.format(s)}),currency:gr((t,r)=>{const i=new Intl.NumberFormat(t,{...r,style:"currency"});return s=>i.format(s)}),datetime:gr((t,r)=>{const i=new Intl.DateTimeFormat(t,{...r});return s=>i.format(s)}),relativetime:gr((t,r)=>{const i=new Intl.RelativeTimeFormat(t,{...r});return s=>i.format(s,r.range||"day")}),list:gr((t,r)=>{const i=new Intl.ListFormat(t,{...r});return s=>i.format(s)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=gr(t)}format(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return t.split(this.formatSeparator).reduce((a,l)=>{const{formatName:c,formatOptions:u}=Qk(l);if(this.formats[c]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},p=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[c](a,p,{...u,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}function tx(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}class nx extends Bo{constructor(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Ut.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,t,r,i){const s={},o={},a={},l={};return e.forEach(c=>{let u=!0;t.forEach(d=>{const f=`${c}|${d}`;!r.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,u=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){const i=e.split("|"),s=i[0],o=i[1];t&&this.emit("failedLoading",s,o,t),r&&this.store.addResourceBundle(s,o,r),this.state[e]=t?-1:2;const a={};this.queue.forEach(l=>{Fk(l.loaded,[s],o),tx(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&i{this.read.call(this,e,t,r,i+1,s*2,o)},s);return}o(c,u)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const c=l(e,t);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof t=="string"&&(t=[t]);const s=this.queueLoad(e,t,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${s} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,t,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,t,r,i,l):u=c(e,t,r,i),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(e,t,r,i,a,l)}!e||!e[0]||this.store.addResource(e[0],t,r,i)}}}function Bd(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(i=>{t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:(n,e,t,r)=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Hd(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function ns(){}function rx(n){Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}class Oi extends Bo{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Hd(e),this.services={},this.logger=Ut,this.modules={external:[]},rx(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof t=="function"&&(r=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(typeof t.ns=="string"?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const i=Bd();this.options={...i,...this.options,...Hd(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);function s(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?Ut.init(s(this.modules.logger),this.options):Ut.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=ex);const d=new Rd(this.options);this.store=new Od(this.options.resources,this.options);const f=this.services;f.logger=Ut,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Yk(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Xk(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new nx(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var h=arguments.length,g=new Array(h>1?h-1:0),m=1;m1?h-1:0),m=1;m{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ns),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const l=ri(),c=()=>{const u=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ns;const i=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(e,t,r){const i=ri();return e||(e=this.languages),t||(t=this.options.ns),r||(r=ns),this.services.backendConnector.reload(e,t,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&_g.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,t){var r=this;this.isLanguageChangingTo=e;const i=ri();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),t&&t(l,function(){return r.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),i}getFixedT(e,t,r){var i=this;const s=function(o,a){let l;if(typeof a!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${l.keyPrefix}${f}${h}`):p=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,i.t(p,l)};return typeof e=="string"?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,t){const r=ri();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),t&&t(i)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=ri();typeof e=="string"&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>i.indexOf(o)<0);return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),t&&t(o)}),r):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Rd(Bd());return t.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Oi(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ns;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Oi(i);return(e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Od(this.store.data,i),s.services.resourceStore=s.store),s.translator=new Js(s.services,i),s.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;ure(e)),this.dropDivHeight="265px",this.dropDivWith="150px"}onDropdownActive(e,t){return t==0?e.isActive("paragraph"):e.isActive("heading",{level:t})}onDropdownItemClick(e){e==0?this.editor.chain().setParagraph().run():this.editor.chain().setHeading({level:e}).run()}onDropdownItemRender(e){return e==0?this.menuData[e]:`${this.menuData[e]}`}onMenuTextRender(e){return this.menuData[e].replace(" ","")}};const ox=[{name:"宋体",value:"SimSun"},{name:"仿宋",value:"FangSong"},{name:"黑体",value:"SimHei"},{name:"楷体",value:"KaiTi"},{name:"微软雅黑",value:"Microsoft YaHei"},{name:"方正仿宋简体_GBK",value:"FangSong_GB2312"},{name:"Arial",value:"Arial"}];let ax=class extends jr{constructor(){super(),this.width="72px",this.menuTextWidth="60px",this.dropDivWith="150px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.fontFamily)==null?void 0:r.values)||ox,this.menuData=[{name:re("default-font-family"),value:""}].concat(this.menuData)}onDropdownActive(e,t){return e.isActive("textStyle",{fontFamily:this.menuData[t].value})}onDropdownItemClick(e){const t=this.menuData[e].value;t?this.editor.chain().setFontFamily(t).run():this.editor.chain().unsetFontFamily().run()}onDropdownItemRender(e){return this.menuData[e].name}onMenuTextRender(e){return this.menuData[e].name}};const lx=[{name:"9",value:9},{name:"10",value:10},{name:"11",value:11},{name:"12",value:12},{name:"14",value:14},{name:"18",value:18},{name:"20",value:20},{name:"22",value:22},{name:"24",value:24},{name:"26",value:26},{name:"28",value:28},{name:"30",value:30},{name:"36",value:36},{name:"42",value:42},{name:"48",value:48},{name:"56",value:56},{name:"72",value:72}];class cx extends jr{constructor(){super(),this.dropDivWith="134px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.fontSize)==null?void 0:r.values)||lx;for(let i=0;i - `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBold()}onActive(e){return e.isActive("bold")}},uE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBold()}onActive(e){return e.isActive("bold")}},dx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleItalic()}onActive(e){return e.isActive("italic")}},dE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleItalic()}onActive(e){return e.isActive("italic")}},fx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleUnderline()}onActive(e){return e.isActive("underline")}},fE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleUnderline()}onActive(e){return e.isActive("underline")}},px=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleStrike()}onActive(e){return e.isActive("strike")}},pE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleStrike()}onActive(e){return e.isActive("strike")}},hx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleSubscript()}onActive(e){return e.isActive("subscript")}},hE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleSubscript()}onActive(e){return e.isActive("subscript")}},gx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleSuperscript()}onActive(e){return e.isActive("superscript")}};const gE=["ffffff","000000","e9d989","2972f4","609eec","de3c36","a1d533","7334c5","27b5d9","ff8926","f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","6e6e6e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],mE=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"];class Sg extends ge{constructor(){super(),this.historyColorsKey="historyColors",this.historyColors=[]}connectedCallback(){this.template=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleSuperscript()}onActive(e){return e.isActive("superscript")}};const mx=["ffffff","000000","e9d989","2972f4","609eec","de3c36","a1d533","7334c5","27b5d9","ff8926","f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","6e6e6e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],bx=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"];class Mg extends ge{constructor(){super(),this.historyColorsKey="historyColors",this.historyColors=[]}connectedCallback(){this.template=`
${this.iconSvg}
@@ -141,154 +141,154 @@ img.ProseMirror-separator {
- `,super.connectedCallback();const e=localStorage.getItem(this.historyColorsKey);e&&(this.historyColors=JSON.parse(e)),this.querySelector(".currentColor").addEventListener("click",()=>{this.onColorItemClick(this.historyColors.length>0?this.historyColors[0]:"#ccc")}),this.menuColorEL=this.querySelector("#menuColorEL"),this.historyColors&&this.historyColors.length>0&&(this.menuColorEL.style.background=this.historyColors[0]),Ke(this.querySelector("#dropdown"),{content:this.createMenuElement(),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");return e.style.height="278px",e.style.width="250px",e.classList.add("aie-dropdown-container"),e.innerHTML=` + `,super.connectedCallback();const e=localStorage.getItem(this.historyColorsKey);e&&(this.historyColors=JSON.parse(e)),this.querySelector(".currentColor").addEventListener("click",()=>{this.onColorItemClick(this.historyColors.length>0?this.historyColors[0]:"#ccc")}),this.menuColorEL=this.querySelector("#menuColorEL"),this.historyColors&&this.historyColors.length>0&&(this.menuColorEL.style.background=this.historyColors[0]),Fe(this.querySelector("#dropdown"),{content:this.createMenuElement(),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");return e.style.height="278px",e.style.width="250px",e.classList.add("aie-dropdown-container"),e.innerHTML=`
-
${se("default")}
+
${re("default")}
- ${gE.map((t,r)=>`
`).join(" ")} + ${mx.map((t,r)=>`
`).join(" ")}
-
${se("standardColors")}
+
${re("standardColors")}
- ${mE.map(t=>`
`).join(" ")} + ${bx.map(t=>`
`).join(" ")}
-
${se("historyColors")}
+
${re("historyColors")}
${this.historyColors.map(t=>`
`).join(" ")}
`,e.querySelector("#defaultColor").addEventListener("click",()=>{this.onDefaultColorClick()}),e.querySelectorAll(".color-item").forEach(t=>{t.addEventListener("click",()=>{this.invokeColorItemClick(e,t)}),t.addEventListener("mouseover",()=>{t.style.border="solid 1px #999"}),t.addEventListener("mouseout",()=>{let r=t.getAttribute("data-color");r==="#ffffff"&&(r="#efefef"),t.style.border=`solid 1px ${r}`})}),e.querySelector("#history-colors").addEventListener("click",t=>{const r=t.target.closest(".history-color-item");r&&this.invokeColorItemClick(e,r)}),e}invokeColorItemClick(e,t){const r=t.getAttribute("data-color");this.historyColors=this.historyColors.filter(i=>i!==r),this.historyColors.unshift(r),this.historyColors.length>7&&(this.historyColors=this.historyColors.slice(0,7)),e.querySelector("#history-colors").innerHTML=` ${this.historyColors.map(i=>`
`).join(" ")} - `,localStorage.setItem(this.historyColorsKey,JSON.stringify(this.historyColors)),this.menuColorEL.style.background=r,this.onColorItemClick(r)}}let bE=class extends Sg{constructor(){super(),this.historyColorsKey="highlightHistoryColors",this.iconSvg='',this.onDefaultColorClick=()=>{var e;(e=this.editor)==null||e.chain().focus().unsetHighlight().run()},this.onColorItemClick=e=>{var t;(t=this.editor)==null||t.chain().focus().setHighlight({color:e}).run()}}onActive(e){return e.isActive("highlight")}};class yE extends Sg{constructor(){super(),this.historyColorsKey="fontHistoryColors",this.iconSvg='',this.onDefaultColorClick=()=>{var e;(e=this.editor)==null||e.chain().focus().unsetColor().run()},this.onColorItemClick=e=>{var t;(t=this.editor)==null||t.chain().focus().setColor(e).run()}}onActive(e){return e.isActive("textStyle")}}class vE extends ge{constructor(){super();const e=` + `,localStorage.setItem(this.historyColorsKey,JSON.stringify(this.historyColors)),this.menuColorEL.style.background=r,this.onColorItemClick(r)}}let yx=class extends Mg{constructor(){super(),this.historyColorsKey="highlightHistoryColors",this.iconSvg='',this.onDefaultColorClick=()=>{var e;(e=this.editor)==null||e.chain().focus().unsetHighlight().run()},this.onColorItemClick=e=>{var t;(t=this.editor)==null||t.chain().focus().setHighlight({color:e}).run()}}onActive(e){return e.isActive("highlight")}};class vx extends Mg{constructor(){super(),this.historyColorsKey="fontHistoryColors",this.iconSvg='',this.onDefaultColorClick=()=>{var e;(e=this.editor)==null||e.chain().focus().unsetColor().run()},this.onColorItemClick=e=>{var t;(t=this.editor)==null||t.chain().focus().setColor(e).run()}}onActive(e){return e.isActive("textStyle")}}class wx extends ge{constructor(){super();const e=`
- `;this.template=e}}let wE=class extends ge{constructor(){super();const e=` + `;this.template=e}}let kx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBulletList()}onActive(e){return e.isActive("bulletList")}},kE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBulletList()}onActive(e){return e.isActive("bulletList")}},xx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleOrderedList()}onActive(e){return e.isActive("orderedList")}};class EE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleOrderedList()}onActive(e){return e.isActive("orderedList")}};class Ex extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.outdent()}}class xE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.outdent()}}class Cx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.indent()}}const CE=[{icon:'
',title:"align-left",value:"left"},{icon:'
',title:"align-center",value:"center"},{icon:'
',title:"align-right",value:"right"},{icon:'
',title:"align-justify",value:"justify"}];class SE extends Zr{constructor(){super(),this.menuData=CE.map(e=>({...e,title:se(e.title)})),this.dropDivHeight="112px",this.dropDivWith="60px",this.width="36px",this.menuTextWidth="20px",this.showItemsTip=!0}onDropdownActive(e,t){return e.isActive({textAlign:this.menuData[t].value})}onDropdownItemClick(e){this.editor.chain().focus().setTextAlign(this.menuData[e].value).run()}onDropdownItemRender(e){return this.menuData[e].icon}onMenuTextRender(e){return this.menuData[e].icon}}class _g{setContent(e){this.content=e}onConfirmClick(e){this.onConfirmClickFunc=e}onShow(e){this.onShowFunc=e}setTrigger(e,t="bottom"){this.tippyInstance=Ke(e,{content:this.createContentElement(),appendTo:e.closest(".aie-container"),placement:t,trigger:"click",interactive:!0,arrow:!1,onShow:r=>{this.onShowFunc&&this.onShowFunc(r)}})}createContentElement(){const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.indent()}}const Sx=[{icon:'
',title:"align-left",value:"left"},{icon:'
',title:"align-center",value:"center"},{icon:'
',title:"align-right",value:"right"},{icon:'
',title:"align-justify",value:"justify"}];class _x extends jr{constructor(){super(),this.menuData=Sx.map(e=>({...e,title:re(e.title)})),this.dropDivHeight="112px",this.dropDivWith="60px",this.width="36px",this.menuTextWidth="20px",this.showItemsTip=!0}onDropdownActive(e,t){return e.isActive({textAlign:this.menuData[t].value})}onDropdownItemClick(e){this.editor.chain().focus().setTextAlign(this.menuData[e].value).run()}onDropdownItemRender(e){return this.menuData[e].icon}onMenuTextRender(e){return this.menuData[e].icon}}class Ag{setContent(e){this.content=e}onConfirmClick(e){this.onConfirmClickFunc=e}onShow(e){this.onShowFunc=e}setTrigger(e,t="bottom"){this.tippyInstance=Fe(e,{content:this.createContentElement(),appendTo:e.closest(".aie-container"),placement:t,trigger:"click",interactive:!0,arrow:!1,onShow:r=>{this.onShowFunc&&this.onShowFunc(r)}})}createContentElement(){const e=`
${this.content}
- `,t=document.createElement("div");return t.innerHTML=e,t.querySelector(".aie-popover-header-close").addEventListener("click",()=>{this.tippyInstance.hide()}),t.querySelector(".aie-popover-footer-confirm").addEventListener("click",()=>{this.onConfirmClickFunc&&this.onConfirmClickFunc(this.tippyInstance),this.tippyInstance.hide()}),t}}let _E=class extends ge{constructor(){super();const e=` + `,t=document.createElement("div");return t.innerHTML=e,t.querySelector(".aie-popover-header-close").addEventListener("click",()=>{this.tippyInstance.hide()}),t.querySelector(".aie-popover-footer-confirm").addEventListener("click",()=>{this.onConfirmClickFunc&&this.onConfirmClickFunc(this.tippyInstance),this.tippyInstance.hide()}),t}}let Mx=class extends ge{constructor(){super();const e=`
- `;this.template=e}connectedCallback(){super.connectedCallback();const e=new _g;e.setContent(` -
${se("link-address")}
+ `;this.template=e}connectedCallback(){super.connectedCallback();const e=new Ag;e.setContent(` +
${re("link-address")}
-
${se("link-open-type")}
+
${re("link-open-type")}
- `),e.onConfirmClick(t=>{var s,o;const r=t.popper.querySelector("#href").value;if(r.trim()===""){(s=this.editor)==null||s.chain().focus().extendMarkRange("link").unsetLink().run();return}let i=t.popper.querySelector("#target").value;i.trim()===""&&(i=null),(o=this.editor)==null||o.chain().focus().extendMarkRange("link").setLink({href:r,target:i,rel:null}).run()}),e.onShow(t=>{var i;const r=(i=this.editor)==null?void 0:i.getAttributes("link");r&&r.href?t.popper.querySelector("#href").value=r.href:t.popper.querySelector("#href").value="",r&&r.target?t.popper.querySelector("#target").value=r.target:t.popper.querySelector("#target").value=""}),e.setTrigger(this.querySelector("div"),"bottom")}};class ME extends ge{constructor(){super();const e=` + `),e.onConfirmClick(t=>{var s,o;const r=t.popper.querySelector("#href").value;if(r.trim()===""){(s=this.editor)==null||s.chain().focus().extendMarkRange("link").unsetLink().run();return}let i=t.popper.querySelector("#target").value;i.trim()===""&&(i=null),(o=this.editor)==null||o.chain().focus().extendMarkRange("link").setLink({href:r,target:i,rel:null}).run()}),e.onShow(t=>{var i;const r=(i=this.editor)==null?void 0:i.getAttributes("link");r&&r.href?t.popper.querySelector("#href").value=r.href:t.popper.querySelector("#href").value="",r&&r.target?t.popper.querySelector("#target").value=r.target:t.popper.querySelector("#target").value=""}),e.setTrigger(this.querySelector("div"),"bottom")}};class Ax extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleTaskList()}onActive(e){return e.isActive("taskList")}}const AE=["1.0","1.25","1.5","2.0","2.5","3.0"];class TE extends Zr{constructor(){super(),this.menuData=AE,this.refreshMenuText=!1,this.dropDivHeight="180px",this.dropDivWith="70px",this.width="36px",this.menuTextWidth="20px"}onDropdownActive(e,t){return t==0?e.isActive("paragraph"):e.isActive("heading",{level:t})}onDropdownItemClick(e){const t=`${(Number(this.menuData[e])*100).toFixed(0)}%`;this.editor.chain().setLineHeight(t).run()}onDropdownItemRender(e){return this.menuData[e]}onMenuTextRender(e){return` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleTaskList()}onActive(e){return e.isActive("taskList")}}const Tx=["1.0","1.25","1.5","2.0","2.5","3.0"];class Nx extends jr{constructor(){super(),this.menuData=Tx,this.refreshMenuText=!1,this.dropDivHeight="180px",this.dropDivWith="70px",this.width="36px",this.menuTextWidth="20px"}onDropdownActive(e,t){return t==0?e.isActive("paragraph"):e.isActive("heading",{level:t})}onDropdownItemClick(e){const t=`${(Number(this.menuData[e])*100).toFixed(0)}%`;this.editor.chain().setLineHeight(t).run()}onDropdownItemRender(e){return this.menuData[e]}onMenuTextRender(e){return`
- `}}class NE extends ge{constructor(){super();const e=` + `}}class Ox extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBlockquote()}}let OE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleBlockquote()}}let Lx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.image)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadImage(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.image)!=null&&r.customMenuInvoke?this.options.image.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}};class LE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.image)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadImage(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.image)!=null&&r.customMenuInvoke?this.options.image.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}};class Rx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.video)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadVideo(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.video)!=null&&r.customMenuInvoke?this.options.video.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}}let RE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.video)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadVideo(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.video)!=null&&r.customMenuInvoke?this.options.video.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}}let Dx=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleCode()}onActive(e){return e.isActive("code")}},DE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleCode()}onActive(e){return e.isActive("code")}},Ix=class extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.toggleCodeBlock()}onActive(e){return e.isActive("codeBlock")}};class IE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.toggleCodeBlock()}onActive(e){return e.isActive("codeBlock")}};class Bx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.unsetAllMarks()}}class BE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.unsetAllMarks()}}class Hx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.setHorizontalRule()}}let HE=class extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.setHorizontalRule()}}let Px=class extends ge{constructor(){super();const e=`
- `;this.template=e}connectedCallback(){super.connectedCallback(),this.instance=Ke(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");e.classList.add("aie-dropdown-container"),e.innerHTML=` + `;this.template=e}connectedCallback(){super.connectedCallback(),this.instance=Fe(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");e.classList.add("aie-dropdown-container"),e.innerHTML=`
-
${se("insertTable")}
+
${re("insertTable")}
${[...Array(8).keys()].map((r,i)=>[...Array(10).keys()].map((s,o)=>`
`).join("")).join("")}
- `;const t=e.querySelector("#table-cells");return t.addEventListener("click",r=>{var s,o;const i=r.target.closest(".table-cell");if(i){let a=i.getAttribute("data-i"),l=i.getAttribute("data-j");(s=this.editor)==null||s.commands.insertTable({rows:Number(a)+1,cols:Number(l)+1,withHeaderRow:!0}),(o=this.instance)==null||o.hide()}}),t.addEventListener("mouseover",r=>{const i=r.target.closest(".table-cell");if(i){let s=Number(i.getAttribute("data-i")),o=Number(i.getAttribute("data-j"));const a=t.querySelectorAll("div"),l=e.querySelector("#columnRows");l.textContent=`${s+1} ${se("row")} x ${o+1} ${se("column")}`,a.forEach(c=>{let u=Number(c.getAttribute("data-i")),d=Number(c.getAttribute("data-j"));u<=s&&d<=o?c.classList.add("active"):c.classList.remove("active")})}}),t.addEventListener("mouseleave",()=>{t.querySelectorAll("div").forEach(s=>{s.classList.remove("active")});const i=e.querySelector("#columnRows");i.textContent=""}),e}};class PE extends ge{constructor(){super();const e=` + `;const t=e.querySelector("#table-cells");return t.addEventListener("click",r=>{var s,o;const i=r.target.closest(".table-cell");if(i){let a=i.getAttribute("data-i"),l=i.getAttribute("data-j");(s=this.editor)==null||s.commands.insertTable({rows:Number(a)+1,cols:Number(l)+1,withHeaderRow:!0}),(o=this.instance)==null||o.hide()}}),t.addEventListener("mouseover",r=>{const i=r.target.closest(".table-cell");if(i){let s=Number(i.getAttribute("data-i")),o=Number(i.getAttribute("data-j"));const a=t.querySelectorAll("div"),l=e.querySelector("#columnRows");l.textContent=`${s+1} ${re("row")} x ${o+1} ${re("column")}`,a.forEach(c=>{let u=Number(c.getAttribute("data-i")),d=Number(c.getAttribute("data-j"));u<=s&&d<=o?c.classList.add("active"):c.classList.remove("active")})}}),t.addEventListener("mouseleave",()=>{t.querySelectorAll("div").forEach(s=>{s.classList.remove("active")});const i=e.querySelector("#columnRows");i.textContent=""}),e}};class $x extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){e.setHardBreak()}}class $E extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){e.setHardBreak()}}class Fx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.attachment)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadAttachment(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.attachment)!=null&&r.customMenuInvoke?this.options.attachment.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}}class FE extends ge{constructor(){super(),this.fullscreenSvg='',this.fullscreenExitSvg='',this.isFullscreen=!1;const e=` + `;this.template=e,this.registerClickListener()}connectedCallback(){var e,t;super.connectedCallback(),(t=(e=this.options)==null?void 0:e.attachment)!=null&&t.customMenuInvoke?this.querySelector("input").remove():(this.fileInput=this.querySelector("input"),this.fileInput.addEventListener("change",()=>{var i,s;const r=(i=this.fileInput)==null?void 0:i.files;if(r&&r.length>0)for(let o of r)(s=this.editor)==null||s.commands.uploadAttachment(o);this.fileInput.value=""}))}onClick(e){var t,r,i;(r=(t=this.options)==null?void 0:t.attachment)!=null&&r.customMenuInvoke?this.options.attachment.customMenuInvoke(this.editor.aiEditor):(i=this.fileInput)==null||i.click()}}class zx extends ge{constructor(){super(),this.fullscreenSvg='',this.fullscreenExitSvg='',this.isFullscreen=!1;const e=`
${this.fullscreenSvg}
- `;this.template=e,this.registerClickListener()}onClick(e){const t=this.closest(".aie-container");this.isFullscreen?(t.style.height="100%",t.style.width="",t.style.background="",t.style.position="",t.style.top="",t.style.left="",t.style.zIndex=""):(t.style.height="calc(100vh - 2px)",t.style.width="calc(100% - 2px)",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.zIndex="9999"),this.isFullscreen=!this.isFullscreen,this.querySelector("div").innerHTML=this.isFullscreen?this.fullscreenExitSvg:this.fullscreenSvg}}class zE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){const t=this.closest(".aie-container");this.isFullscreen?(t.style.height="100%",t.style.width="",t.style.background="",t.style.position="",t.style.top="",t.style.left="",t.style.zIndex=""):(t.style.height="calc(100vh - 2px)",t.style.width="calc(100% - 2px)",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.zIndex="9999"),this.isFullscreen=!this.isFullscreen,this.querySelector("div").innerHTML=this.isFullscreen?this.fullscreenExitSvg:this.fullscreenSvg}}class Vx extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){let t=this.closest(".aie-container").querySelector(".aie-content").innerHTML;t=`
${t}
`;const i=Array.from(document.querySelectorAll("style, link")).map(l=>l.outerHTML).join("")+t,s=document.createElement("iframe");s.id="aie-print-iframe",s.setAttribute("style","position: absolute; width: 0; height: 0; top: -10px; left: -10px;"),document.body.appendChild(s);const o=s.contentWindow,a=s.contentDocument||s.contentWindow&&s.contentWindow.document;a&&(a.open(),a.write(i),a.close()),o&&(s.onload=function(){try{setTimeout(()=>{o.focus();try{o.document.execCommand("print",!1)||o.print()}catch{o.print()}o.close()},10)}catch(l){console.error(l)}setTimeout(function(){document.body.removeChild(s)},100)})}}const VE=["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😶‍🌫","😏","😒","🙄","😬","😮‍💨","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🤧","🥵","🥶","🥴","😵","😵‍💫","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","😟","🙁","😮","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿","💀","☠️","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣️","💔","💋","💯","💢","💥","💫","💦","💨","💤"];class qE extends ge{constructor(){super();const e=` + `;this.template=e,this.registerClickListener()}onClick(e){let t=this.closest(".aie-container").querySelector(".aie-content").innerHTML;t=`
${t}
`;const i=Array.from(document.querySelectorAll("style, link")).map(l=>l.outerHTML).join("")+t,s=document.createElement("iframe");s.id="aie-print-iframe",s.setAttribute("style","position: absolute; width: 0; height: 0; top: -10px; left: -10px;"),document.body.appendChild(s);const o=s.contentWindow,a=s.contentDocument||s.contentWindow&&s.contentWindow.document;a&&(a.open(),a.write(i),a.close()),o&&(s.onload=function(){try{setTimeout(()=>{o.focus();try{o.document.execCommand("print",!1)||o.print()}catch{o.print()}o.close()},10)}catch(l){console.error(l)}setTimeout(function(){document.body.removeChild(s)},100)})}}const qx=["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😶‍🌫","😏","😒","🙄","😬","😮‍💨","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🤧","🥵","🥶","🥴","😵","😵‍💫","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","😟","🙁","😮","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿","💀","☠️","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣️","💔","💋","💯","💢","💥","💫","💦","💨","💤"];class Ux extends ge{constructor(){super();const e=`
- `;this.template=e}connectedCallback(){super.connectedCallback(),Ke(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");return e.style.height="220px",e.style.width="400px",e.classList.add("aie-dropdown-container"),e.innerHTML=` + `;this.template=e}connectedCallback(){super.connectedCallback(),Fe(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const e=document.createElement("div");return e.style.height="220px",e.style.width="400px",e.classList.add("aie-dropdown-container"),e.innerHTML=`
- ${VE.map(t=>`
${t}
`).join("")} + ${qx.map(t=>`
${t}
`).join("")}
- `,e.querySelector(".emoji-cells").addEventListener("click",t=>{var i;const r=t.target.closest(".emoji-cell");r&&((i=this.editor)==null||i.commands.insertContent(r.innerHTML))}),e}}class UE extends ge{constructor(){super(),this.svg='';const e=` + `,e.querySelector(".emoji-cells").addEventListener("click",t=>{var i;const r=t.target.closest(".emoji-cell");r&&((i=this.editor)==null||i.commands.insertContent(r.innerHTML))}),e}}class Kx extends ge{constructor(){super(),this.svg='';const e=`
${this.svg}
- `;this.template=e,this.registerClickListener()}onClick(e){var t;e.setPainter((t=this.editor)==null?void 0:t.state.selection.$head.marks())}}class KE{constructor(e){this.isOpen=!1,this.url=e}start(e){this.text=e,this.webSocket=new WebSocket(this.url),this.webSocket.onopen=t=>this.onOpen(t),this.webSocket.onmessage=t=>this.onMessage(t),this.webSocket.onclose=t=>this.onClose(t),this.webSocket.onerror=t=>this.onError(t)}stop(){this.webSocket&&(this.webSocket.close(),this.webSocket=void 0)}send(e){this.webSocket&&this.isOpen&&this.webSocket.send(e)}onOpen(e){this.isOpen=!0,this.send(this.text)}onMessage(e){}onClose(e){this.isOpen=!1}onError(e){this.isOpen=!1}}const Io=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16)),WE=n=>{let e="";return n.descendants(t=>{t.text&&(e+=t.text)}),e};class GE extends KE{constructor(e,t,r,i,s){super(e),this.appId=t,this.version=r,this.editor=i,this.options=s||{markdownParseEnable:!0},this.from=i.view.state.selection.from}getDomain(){switch(this.version){case"v3.1":return"generalv3";case"v2.1":return"generalv2";default:return"general"}}send(e){const t={header:{app_id:this.appId,uid:Io()},parameter:{chat:{domain:this.getDomain(),temperature:.5,max_tokens:2048}},payload:{message:{text:[]}}};t.payload.message.text.push({role:"user",content:e}),super.send(JSON.stringify(t))}onMessage(e){const t=e.data,r=JSON.parse(t);let i=r.payload.choices.text[0].content;if(i){const{state:{tr:s},view:o}=this.editor;if(o.dispatch(s.insertText(i)),r.header.status==2&&this.options.markdownParseEnable){const a=this.editor.state.selection.to,l=this.editor.state.doc.textBetween(this.from,a),{state:{tr:c},view:u}=this.editor,d=this.editor.parseMarkdown(l);if(this.options.useMarkdownTextOnly){const f=WE(d),p=this.editor.schema.text(f);u.dispatch(c.replaceWith(this.from,a,p).scrollIntoView())}else u.dispatch(c.replaceWith(this.from,a,d).scrollIntoView())}this.editor.commands.scrollIntoView()}}}var kn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Mg(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Ag={exports:{}};function ZE(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Sa={exports:{}};const jE={},JE=Object.freeze(Object.defineProperty({__proto__:null,default:jE},Symbol.toStringTag,{value:"Module"})),YE=Mg(JE);var Hd;function Bo(){return Hd||(Hd=1,function(n,e){(function(t,r){n.exports=r()})(kn,function(){var t=t||function(r,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof kn<"u"&&kn.crypto&&(s=kn.crypto),!s&&typeof ZE=="function")try{s=YE}catch{}var o=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function y(){}return function(k){var b;return y.prototype=k,b=new y,y.prototype=null,b}}(),l={},c=l.lib={},u=c.Base=function(){return{extend:function(y){var k=a(this);return y&&k.mixIn(y),(!k.hasOwnProperty("init")||this.init===k.init)&&(k.init=function(){k.$super.init.apply(this,arguments)}),k.init.prototype=k,k.$super=this,k},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var k in y)y.hasOwnProperty(k)&&(this[k]=y[k]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=c.WordArray=u.extend({init:function(y,k){y=this.words=y||[],k!=i?this.sigBytes=k:this.sigBytes=y.length*4},toString:function(y){return(y||p).stringify(this)},concat:function(y){var k=this.words,b=y.words,x=this.sigBytes,w=y.sigBytes;if(this.clamp(),x%4)for(var S=0;S>>2]>>>24-S%4*8&255;k[x+S>>>2]|=A<<24-(x+S)%4*8}else for(var M=0;M>>2]=b[M>>>2];return this.sigBytes+=w,this},clamp:function(){var y=this.words,k=this.sigBytes;y[k>>>2]&=4294967295<<32-k%4*8,y.length=r.ceil(k/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var k=[],b=0;b>>2]>>>24-w%4*8&255;x.push((S>>>4).toString(16)),x.push((S&15).toString(16))}return x.join("")},parse:function(y){for(var k=y.length,b=[],x=0;x>>3]|=parseInt(y.substr(x,2),16)<<24-x%8*4;return new d.init(b,k/2)}},h=f.Latin1={stringify:function(y){for(var k=y.words,b=y.sigBytes,x=[],w=0;w>>2]>>>24-w%4*8&255;x.push(String.fromCharCode(S))}return x.join("")},parse:function(y){for(var k=y.length,b=[],x=0;x>>2]|=(y.charCodeAt(x)&255)<<24-x%4*8;return new d.init(b,k)}},g=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(h.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return h.parse(unescape(encodeURIComponent(y)))}},m=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=g.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var k,b=this._data,x=b.words,w=b.sigBytes,S=this.blockSize,A=S*4,M=w/A;y?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var L=M*S,z=r.min(L*4,w);if(L){for(var q=0;q>>7)^(M<<14|M>>>18)^M>>>3,z=d[A-2],q=(z<<15|z>>>17)^(z<<13|z>>>19)^z>>>10;d[A]=L+d[A-7]+q+d[A-16]}var U=b&x^~b&w,T=m&v^m&y^v&y,H=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),C=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),E=S+C+U+u[A]+d[A],_=H+T;S=w,w=x,x=b,b=k+E|0,k=y,y=v,v=m,m=E+_|0}g[0]=g[0]+m|0,g[1]=g[1]+v|0,g[2]=g[2]+y|0,g[3]=g[3]+k|0,g[4]=g[4]+b|0,g[5]=g[5]+x|0,g[6]=g[6]+w|0,g[7]=g[7]+S|0},_doFinalize:function(){var p=this._data,h=p.words,g=this._nDataBytes*8,m=p.sigBytes*8;return h[m>>>5]|=128<<24-m%32,h[(m+64>>>9<<4)+14]=r.floor(g/4294967296),h[(m+64>>>9<<4)+15]=g,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),t.SHA256})}(_a)),_a.exports}var Ma={exports:{}},$d;function QE(){return $d||($d=1,function(n,e){(function(t,r){n.exports=r(Bo())})(kn,function(t){(function(){var r=t,i=r.lib,s=i.Base,o=r.enc,a=o.Utf8,l=r.algo;l.HMAC=s.extend({init:function(c,u){c=this._hasher=new c.init,typeof u=="string"&&(u=a.parse(u));var d=c.blockSize,f=d*4;u.sigBytes>f&&(u=c.finalize(u)),u.clamp();for(var p=this._oKey=u.clone(),h=this._iKey=u.clone(),g=p.words,m=h.words,v=0;v>>2]>>>24-p%4*8&255,g=c[p+1>>>2]>>>24-(p+1)%4*8&255,m=c[p+2>>>2]>>>24-(p+2)%4*8&255,v=h<<16|g<<8|m,y=0;y<4&&p+y*.75>>6*(3-y)&63));var k=d.charAt(64);if(k)for(;f.length%4;)f.push(k);return f.join("")},parse:function(l){var c=l.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f>>6-p%4*2,m=h|g;d[f>>>2]|=m<<24-f%4*8,f++}return s.create(d,f)}}(),t.enc.Base64})})(Tg);var nx=Tg.exports;const rx=jr(nx);class ix{constructor(e){var l;const{protocol:t,appId:r,apiKey:i,apiSecret:s,version:o,urlSignatureAlgorithm:a}=(l=e.ai)==null?void 0:l.model.xinghuo;this.protocol=t||"ws",this.appId=r,this.apiKey=i,this.apiSecret=s,this.version=o||"v3.1",this.urlSignatureAlgorithm=a}start(e,t,r,i){const s=this.urlSignatureAlgorithm?this.urlSignatureAlgorithm(this):this.createUrl();new GE(s,this.appId,this.version,r,i).start(`"${e}" -${t}`)}createUrl(){const e=new Date().toUTCString().replace("GMT","+0000");let t=`host: spark-api.xf-yun.com + `;this.template=e,this.registerClickListener()}onClick(e){var t;e.setPainter((t=this.editor)==null?void 0:t.state.selection.$head.marks())}}class Wx{constructor(e,t){this.isOpen=!1,this.listeners=[],this.url=e,this.processor=t}addListener(e){this.listeners.push(e)}start(e){for(let t of this.listeners)t.onStart();this.text=e,this.webSocket=new WebSocket(this.url),this.webSocket.onopen=t=>this.onOpen(t),this.webSocket.onmessage=t=>this.onMessage(t),this.webSocket.onclose=t=>this.onClose(t),this.webSocket.onerror=t=>this.onError(t)}stop(){if(this.webSocket){this.webSocket.close(),this.webSocket=void 0;for(let e of this.listeners)e.onStop()}}send(e){this.webSocket&&this.isOpen&&this.webSocket.send(e)}onOpen(e){this.isOpen=!0,this.send(this.text)}onMessage(e){this.processor&&this.processor.onMessage(e.data)}onClose(e){this.isOpen=!1;for(let t of this.listeners)t.onStop()}onError(e){this.isOpen=!1;for(let t of this.listeners)t.onStop()}}const Ho=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16));class Zx extends Wx{constructor(e,t,r,i){super(e,t),this.appId=r,this.version=i}getDomain(){switch(this.version){case"v3.1":return"generalv3";case"v2.1":return"generalv2";default:return"general"}}send(e){const t={header:{app_id:this.appId,uid:Ho()},parameter:{chat:{domain:this.getDomain(),temperature:.5,max_tokens:2048}},payload:{message:{text:[]}}};t.payload.message.text.push({role:"user",content:e}),super.send(JSON.stringify(t))}}var kn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Tg(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Ng={exports:{}};function Gx(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ta={exports:{}};const jx={},Jx=Object.freeze(Object.defineProperty({__proto__:null,default:jx},Symbol.toStringTag,{value:"Module"})),Yx=Tg(Jx);var Pd;function Po(){return Pd||(Pd=1,function(n,e){(function(t,r){n.exports=r()})(kn,function(){var t=t||function(r,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof kn<"u"&&kn.crypto&&(s=kn.crypto),!s&&typeof Gx=="function")try{s=Yx}catch{}var o=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function y(){}return function(k){var b;return y.prototype=k,b=new y,y.prototype=null,b}}(),l={},c=l.lib={},u=c.Base=function(){return{extend:function(y){var k=a(this);return y&&k.mixIn(y),(!k.hasOwnProperty("init")||this.init===k.init)&&(k.init=function(){k.$super.init.apply(this,arguments)}),k.init.prototype=k,k.$super=this,k},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var k in y)y.hasOwnProperty(k)&&(this[k]=y[k]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=c.WordArray=u.extend({init:function(y,k){y=this.words=y||[],k!=i?this.sigBytes=k:this.sigBytes=y.length*4},toString:function(y){return(y||p).stringify(this)},concat:function(y){var k=this.words,b=y.words,E=this.sigBytes,w=y.sigBytes;if(this.clamp(),E%4)for(var S=0;S>>2]>>>24-S%4*8&255;k[E+S>>>2]|=A<<24-(E+S)%4*8}else for(var M=0;M>>2]=b[M>>>2];return this.sigBytes+=w,this},clamp:function(){var y=this.words,k=this.sigBytes;y[k>>>2]&=4294967295<<32-k%4*8,y.length=r.ceil(k/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var k=[],b=0;b>>2]>>>24-w%4*8&255;E.push((S>>>4).toString(16)),E.push((S&15).toString(16))}return E.join("")},parse:function(y){for(var k=y.length,b=[],E=0;E>>3]|=parseInt(y.substr(E,2),16)<<24-E%8*4;return new d.init(b,k/2)}},h=f.Latin1={stringify:function(y){for(var k=y.words,b=y.sigBytes,E=[],w=0;w>>2]>>>24-w%4*8&255;E.push(String.fromCharCode(S))}return E.join("")},parse:function(y){for(var k=y.length,b=[],E=0;E>>2]|=(y.charCodeAt(E)&255)<<24-E%4*8;return new d.init(b,k)}},g=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(h.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return h.parse(unescape(encodeURIComponent(y)))}},m=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=g.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var k,b=this._data,E=b.words,w=b.sigBytes,S=this.blockSize,A=S*4,M=w/A;y?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var L=M*S,z=r.min(L*4,w);if(L){for(var q=0;q>>7)^(M<<14|M>>>18)^M>>>3,z=d[A-2],q=(z<<15|z>>>17)^(z<<13|z>>>19)^z>>>10;d[A]=L+d[A-7]+q+d[A-16]}var U=b&E^~b&w,T=m&v^m&y^v&y,H=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),C=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),x=S+C+U+u[A]+d[A],_=H+T;S=w,w=E,E=b,b=k+x|0,k=y,y=v,v=m,m=x+_|0}g[0]=g[0]+m|0,g[1]=g[1]+v|0,g[2]=g[2]+y|0,g[3]=g[3]+k|0,g[4]=g[4]+b|0,g[5]=g[5]+E|0,g[6]=g[6]+w|0,g[7]=g[7]+S|0},_doFinalize:function(){var p=this._data,h=p.words,g=this._nDataBytes*8,m=p.sigBytes*8;return h[m>>>5]|=128<<24-m%32,h[(m+64>>>9<<4)+14]=r.floor(g/4294967296),h[(m+64>>>9<<4)+15]=g,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=a.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),t.SHA256})}(Na)),Na.exports}var Oa={exports:{}},Fd;function Qx(){return Fd||(Fd=1,function(n,e){(function(t,r){n.exports=r(Po())})(kn,function(t){(function(){var r=t,i=r.lib,s=i.Base,o=r.enc,a=o.Utf8,l=r.algo;l.HMAC=s.extend({init:function(c,u){c=this._hasher=new c.init,typeof u=="string"&&(u=a.parse(u));var d=c.blockSize,f=d*4;u.sigBytes>f&&(u=c.finalize(u)),u.clamp();for(var p=this._oKey=u.clone(),h=this._iKey=u.clone(),g=p.words,m=h.words,v=0;v>>2]>>>24-p%4*8&255,g=c[p+1>>>2]>>>24-(p+1)%4*8&255,m=c[p+2>>>2]>>>24-(p+2)%4*8&255,v=h<<16|g<<8|m,y=0;y<4&&p+y*.75>>6*(3-y)&63));var k=d.charAt(64);if(k)for(;f.length%4;)f.push(k);return f.join("")},parse:function(l){var c=l.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f>>6-p%4*2,m=h|g;d[f>>>2]|=m<<24-f%4*8,f++}return s.create(d,f)}}(),t.enc.Base64})})(Og);var nE=Og.exports;const rE=Jr(nE),iE=n=>{let e="";return n.descendants(t=>{t.text&&(e+=t.text)}),e};class sE{constructor(e,t){this.editor=e,this.from=e.view.state.selection.from,this.options=t||{markdownParseEnable:!0}}onMessage(e){const t=JSON.parse(e);let r=t.payload.choices.text[0].content;if(r){const{state:{tr:i},view:s}=this.editor;if(s.dispatch(i.insertText(r)),t.header.status==2&&this.options.markdownParseEnable){const o=this.editor.state.selection.to,a=this.editor.state.doc.textBetween(this.from,o),{state:{tr:l},view:c}=this.editor,u=this.editor.parseMarkdown(a);if(this.options.useMarkdownTextOnly){const d=iE(u),f=this.editor.schema.text(d);c.dispatch(l.replaceWith(this.from,o,f).scrollIntoView())}else c.dispatch(l.replaceWith(this.from,o,u).scrollIntoView())}this.editor.commands.scrollIntoView()}}}class oE{constructor(e){var l;this.listeners=[];const{protocol:t,appId:r,apiKey:i,apiSecret:s,version:o,urlSignatureAlgorithm:a}=(l=e.ai)==null?void 0:l.model.xinghuo;this.protocol=t||"ws",this.appId=r,this.apiKey=i,this.apiSecret=s,this.version=o||"v3.1",this.urlSignatureAlgorithm=a}start(e,t,r,i){this.startWithProcessor(e,t,new sE(r,i))}startWithProcessor(e,t,r){const i=this.urlSignatureAlgorithm?this.urlSignatureAlgorithm(this):this.createUrl();this.socket=new Zx(i,r,this.appId,this.version);for(let s of this.listeners)this.socket.addListener(s);this.socket.start(`${e} +${t}`)}stop(){var e;(e=this.socket)==null||e.stop()}addListener(e){this.listeners.push(e)}removeListener(e){this.listeners=this.listeners.filter(t=>t!=e)}createUrl(){const e=new Date().toUTCString().replace("GMT","+0000");let t=`host: spark-api.xf-yun.com `;t+="date: "+e+` -`,t+=`GET /${this.version}/chat HTTP/1.1`;const r=tx(t,this.apiSecret),i=rx.stringify(r),s=`api_key="${this.apiKey}", algorithm="hmac-sha256", headers="host date request-line", signature="${i}"`,o=btoa(s);return`${this.protocol}://spark-api.xf-yun.com/${this.version}/chat?authorization=${o}&date=${encodeURIComponent(e)}&host=spark-api.xf-yun.com`}}class Oi{static create(e,t){let r=this.models[e];return r||(e==="xinghuo"&&(r=new ix(t)),r&&(this.models[e]=r),r)}}Oi.models={};const sx=[{icon:'',name:"AI 续写",prompt:"请帮我继续扩展一些这段话的内容",text:"focusBefore",model:"xinghuo"},{icon:'',name:"AI 优化",prompt:"请帮我优化一下这段文字的内容,并返回结果",text:"selected",model:"xinghuo"},{icon:'',name:"AI 校对",prompt:"请帮我找出这段话的错别字,把错别字修改后,并返回结果,不要解释或其他多余的内容",text:"selected",model:"xinghuo"},{icon:'',name:"AI 翻译",prompt:"请帮我把这段内容翻译为英语,直接返回英语结果",text:"selected",model:"xinghuo"}];class ox extends Zr{constructor(){super(),this.dropDivHeight="auto",this.dropDivWith="94px",this.width="36px",this.menuTextWidth="20px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.ai)==null?void 0:r.menus)||sx}renderTemplate(){this.template=` +`,t+=`GET /${this.version}/chat HTTP/1.1`;const r=tE(t,this.apiSecret),i=rE.stringify(r),s=`api_key="${this.apiKey}", algorithm="hmac-sha256", headers="host date request-line", signature="${i}"`,o=btoa(s);return`${this.protocol}://spark-api.xf-yun.com/${this.version}/chat?authorization=${o}&date=${encodeURIComponent(e)}&host=spark-api.xf-yun.com`}}class Kr{static create(e,t){let r=this.models[e];return r||(e==="xinghuo"&&(r=new oE(t)),r&&(this.models[e]=r),r)}}Kr.models={};const aE=[{icon:'',name:"AI 续写",prompt:"请帮我继续扩展一些这段话的内容",text:"focusBefore",model:"xinghuo"},{icon:'',name:"AI 优化",prompt:"请帮我优化一下这段文字的内容,并返回结果",text:"selected",model:"xinghuo"},{icon:'',name:"AI 校对",prompt:"请帮我找出这段话的错别字,把错别字修改后,并返回结果,不要解释或其他多余的内容",text:"selected",model:"xinghuo"},{icon:'',name:"AI 翻译",prompt:"请帮我把这段内容翻译为英语,直接返回英语结果",text:"selected",model:"xinghuo"}];class lE extends jr{constructor(){super(),this.dropDivHeight="auto",this.dropDivWith="94px",this.width="36px",this.menuTextWidth="20px"}onCreate(e,t){var r;super.onCreate(e,t),this.menuData=((r=t.ai)==null?void 0:r.menus)||aE}renderTemplate(){this.template=`
`}createMenuElement(){const e=document.createElement("div");e.style.height=this.dropDivHeight,e.style.width=this.dropDivWith,e.classList.add("aie-dropdown-container");for(let t=0;t${this.onDropdownItemRender(t)}
- `,r.addEventListener("click",()=>{this.onDropdownItemClick(t),this.tippyInstance.hide()}),e.appendChild(r)}return this.tippyEl=e,e}onTransaction(e){}onDropdownActive(e,t){return!1}getSelectedText(e){if(e==="selected"){const{selection:t,doc:r}=this.editor.state;return r.textBetween(t.from,t.to)}else return this.editor.state.selection.$head.parent.textContent}onDropdownItemClick(e){const t=this.menuData[e],r=this.getSelectedText(t.text);if(r){const i=Oi.create(t.model,this.options);i?i==null||i.start(r,t.prompt,this.editor):console.error("Ai model config error.")}else console.error("Can not get selected text.")}onDropdownItemRender(e){return`
${this.menuData[e].icon}
${this.menuData[e].name}
`}onMenuTextRender(e){return this.menuData[e].icon}}class ax extends ge{constructor(){super();const e=` + `,r.addEventListener("click",()=>{this.onDropdownItemClick(t),this.tippyInstance.hide()}),e.appendChild(r)}return this.tippyEl=e,e}onTransaction(e){}onDropdownActive(e,t){return!1}getSelectedText(e){if(e==="selected"){const{selection:t,doc:r}=this.editor.state;return r.textBetween(t.from,t.to)}else return this.editor.state.selection.$head.parent.textContent}onDropdownItemClick(e){const t=this.menuData[e],r=this.getSelectedText(t.text);if(r){const i=Kr.create(t.model,this.options);i?i==null||i.start(r,t.prompt,this.editor):console.error("Ai model config error.")}else console.error("Can not get selected text.")}onDropdownItemRender(e){return`
${this.menuData[e].icon}
${this.menuData[e].name}
`}onMenuTextRender(e){return this.menuData[e].icon}}class cE extends ge{constructor(){super();const e=`
- `;this.template=e,this.registerClickListener()}onClick(e){var t;(t=this.editor)!=null&&t.isActive("container")?e.unsetContainer():e.setContainer("warning"),e.focus()}}class lx extends ge{constructor(){super()}onConfig(e){this.config=e,e.html?this.template=e.html:e.icon&&(this.template=`
${e.icon}
`),this.addEventListener("click",t=>{this.config&&this.config.onClick&&this.config.onClick(t,this.editor.aiEditor)})}}window.customElements.define("aie-undo",ow);window.customElements.define("aie-redo",aw);window.customElements.define("aie-brush",UE);window.customElements.define("aie-container",ax);window.customElements.define("aie-custom",lx);window.customElements.define("aie-eraser",IE);window.customElements.define("aie-heading",iE);window.customElements.define("aie-font-family",oE);window.customElements.define("aie-font-size",lE);window.customElements.define("aie-bold",cE);window.customElements.define("aie-italic",uE);window.customElements.define("aie-underline",dE);window.customElements.define("aie-strike",fE);window.customElements.define("aie-link",_E);window.customElements.define("aie-code",RE);window.customElements.define("aie-subscript",pE);window.customElements.define("aie-superscript",hE);window.customElements.define("aie-highlight",bE);window.customElements.define("aie-font-color",yE);window.customElements.define("aie-divider",vE);window.customElements.define("aie-bullet-list",wE);window.customElements.define("aie-ordered-list",kE);window.customElements.define("aie-indent-decrease",EE);window.customElements.define("aie-indent-increase",xE);window.customElements.define("aie-align",SE);window.customElements.define("aie-todo",ME);window.customElements.define("aie-line-height",TE);window.customElements.define("aie-break",PE);window.customElements.define("aie-quote",NE);window.customElements.define("aie-image",OE);window.customElements.define("aie-video",LE);window.customElements.define("aie-code-block",DE);window.customElements.define("aie-hr",BE);window.customElements.define("aie-table",HE);window.customElements.define("aie-attachment",$E);window.customElements.define("aie-fullscreen",FE);window.customElements.define("aie-printer",zE);window.customElements.define("aie-emoji",qE);window.customElements.define("aie-ai",ox);const cx=["undo","redo","brush","eraser","divider","heading","font-family","font-size","divider","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","divider","highlight","font-color","divider","align","line-height","divider","bullet-list","ordered-list","indent-decrease","indent-increase","break","divider","image","video","attachment","quote","container","code-block","table","divider","printer","fullscreen","ai"];class ux extends HTMLElement{constructor(){super(),this.menuButtons=[]}connectedCallback(){const e=document.createElement("div");for(let t of this.menuButtons)e.appendChild(t);e.style.display="flex",e.style.flexWrap="wrap",this.appendChild(e)}onCreate(e,t){let r=t.toolbarKeys||cx;for(let i of r)if(i)try{if(typeof i=="string"){i=i.trim(),i==="|"&&(i="divider");const s=document.createElement("aie-"+i);if(s.classList.add("aie-menu-item"),s.onCreate(e,t),i!=="divider"){const o=se(i);o&&Ke(s,{appendTo:()=>e.editor.view.dom.closest(".aie-container"),content:o,theme:"aietip",arrow:!0})}this.menuButtons.push(s)}else{const s=i,o=document.createElement("aie-custom");if(o.classList.add("aie-menu-item"),o.onCreate(e,t),o.onConfig(s),s.tip){const a=se(s.tip);a&&Ke(o,{appendTo:()=>e.editor.view.dom.closest(".aie-container"),content:a,theme:"aietip",arrow:!0})}this.menuButtons.push(o)}}catch{console.error("Can not create toolbar by key: "+i)}}onTransaction(e){for(let t of this.menuButtons)t.onTransaction(e)}}class dx extends HTMLElement{constructor(){super(),this.count=0;let e,t,r=300,i=300,s,o,a;const l=u=>{u.preventDefault(),document.removeEventListener("mouseup",l),document.removeEventListener("mousemove",c)},c=u=>{const d=u.clientX-e,f=u.clientY-t;if(d==0&&f==0)return;let p=s+d,h=o+f;p{var f;u.target.closest("svg")&&(u.preventDefault(),document.addEventListener("mouseup",l),document.addEventListener("mousemove",c),a=(f=u.target.closest(".aie-container"))==null?void 0:f.parentElement,s=a.clientWidth,o=a.clientHeight,e=u.clientX,t=u.clientY)}),this.addEventListener("mouseup",l)}updateCharacters(){this.innerHTML=` + `;this.template=e,this.registerClickListener()}onClick(e){var t;(t=this.editor)!=null&&t.isActive("container")?e.unsetContainer():e.setContainer("warning"),e.focus()}}class uE extends ge{constructor(){super()}onConfig(e){this.config=e,e.html?this.template=e.html:e.icon&&(this.template=`
${e.icon}
`),this.addEventListener("click",t=>{this.config&&this.config.onClick&&this.config.onClick(t,this.editor.aiEditor)})}}window.customElements.define("aie-undo",aw);window.customElements.define("aie-redo",lw);window.customElements.define("aie-brush",Kx);window.customElements.define("aie-container",cE);window.customElements.define("aie-custom",uE);window.customElements.define("aie-eraser",Bx);window.customElements.define("aie-heading",sx);window.customElements.define("aie-font-family",ax);window.customElements.define("aie-font-size",cx);window.customElements.define("aie-bold",ux);window.customElements.define("aie-italic",dx);window.customElements.define("aie-underline",fx);window.customElements.define("aie-strike",px);window.customElements.define("aie-link",Mx);window.customElements.define("aie-code",Dx);window.customElements.define("aie-subscript",hx);window.customElements.define("aie-superscript",gx);window.customElements.define("aie-highlight",yx);window.customElements.define("aie-font-color",vx);window.customElements.define("aie-divider",wx);window.customElements.define("aie-bullet-list",kx);window.customElements.define("aie-ordered-list",xx);window.customElements.define("aie-indent-decrease",Ex);window.customElements.define("aie-indent-increase",Cx);window.customElements.define("aie-align",_x);window.customElements.define("aie-todo",Ax);window.customElements.define("aie-line-height",Nx);window.customElements.define("aie-break",$x);window.customElements.define("aie-quote",Ox);window.customElements.define("aie-image",Lx);window.customElements.define("aie-video",Rx);window.customElements.define("aie-code-block",Ix);window.customElements.define("aie-hr",Hx);window.customElements.define("aie-table",Px);window.customElements.define("aie-attachment",Fx);window.customElements.define("aie-fullscreen",zx);window.customElements.define("aie-printer",Vx);window.customElements.define("aie-emoji",Ux);window.customElements.define("aie-ai",lE);const dE=["undo","redo","brush","eraser","divider","heading","font-family","font-size","divider","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","divider","highlight","font-color","divider","align","line-height","divider","bullet-list","ordered-list","indent-decrease","indent-increase","break","divider","image","video","attachment","quote","container","code-block","table","divider","printer","fullscreen","ai"];class fE extends HTMLElement{constructor(){super(),this.menuButtons=[]}connectedCallback(){const e=document.createElement("div");for(let t of this.menuButtons)e.appendChild(t);e.style.display="flex",e.style.flexWrap="wrap",this.appendChild(e)}onCreate(e,t){let r=t.toolbarKeys||dE;for(let i of r)if(i)try{if(typeof i=="string"){i=i.trim(),i==="|"&&(i="divider");const s=document.createElement("aie-"+i);if(s.classList.add("aie-menu-item"),s.onCreate(e,t),i!=="divider"){const o=re(i);o&&Fe(s,{appendTo:()=>e.editor.view.dom.closest(".aie-container"),content:o,theme:"aietip",arrow:!0})}this.menuButtons.push(s)}else{const s=i,o=document.createElement("aie-custom");if(o.classList.add("aie-menu-item"),o.onCreate(e,t),o.onConfig(s),s.tip){const a=re(s.tip);a&&Fe(o,{appendTo:()=>e.editor.view.dom.closest(".aie-container"),content:a,theme:"aietip",arrow:!0})}this.menuButtons.push(o)}}catch{console.error("Can not create toolbar by key: "+i)}}onTransaction(e){for(let t of this.menuButtons)t.onTransaction(e)}}class pE extends HTMLElement{constructor(){super(),this.count=0;let e,t,r=300,i=300,s,o,a;const l=u=>{u.preventDefault(),document.removeEventListener("mouseup",l),document.removeEventListener("mousemove",c)},c=u=>{const d=u.clientX-e,f=u.clientY-t;if(d==0&&f==0)return;let p=s+d,h=o+f;p{var f;u.target.closest("svg")&&(u.preventDefault(),document.addEventListener("mouseup",l),document.addEventListener("mousemove",c),a=(f=u.target.closest(".aie-container"))==null?void 0:f.parentElement,s=a.clientWidth,o=a.clientHeight,e=u.clientX,t=u.clientY)}),this.addEventListener("mouseup",l)}updateCharacters(){this.innerHTML=`
Powered by AiEditor, Characters: ${this.count}
- `}onCreate(e,t){this.count=e.editor.storage.characterCount.characters(),this.updateCharacters()}onTransaction(e){const t=e.editor.storage.characterCount.characters();t!=this.count&&(this.count=t,this.updateCharacters())}}const fx=/^\s*>\s$/,px=ae.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ir({find:fx,type:this.type})]}}),hx=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,gx=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,mx=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,bx=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,yx=Le.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[rr({find:hx,type:this.type}),rr({find:mx,type:this.type})]},addPasteRules(){return[Nn({find:gx,type:this.type}),Nn({find:bx,type:this.type})]}}),vx=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Fd=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),zd=/^\s*([-+*])\s$/,wx=ae.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:n}){return["ul",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(vx.name,this.editor.getAttributes(Fd.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ir({find:zd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ir({find:zd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Fd.name),editor:this.editor})),[n]}}),kx=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,Ex=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,xx=Le.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rr({find:kx,type:this.type})]},addPasteRules(){return[Nn({find:Ex,type:this.type})]}}),Cx=/^```([a-z]+)?[\s\n]$/,Sx=/^~~~([a-z]+)?[\s\n]$/,Ng=ae.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",fe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + `}onCreate(e,t){this.count=e.editor.storage.characterCount.characters(),this.updateCharacters()}onTransaction(e){const t=e.editor.storage.characterCount.characters();t!=this.count&&(this.count=t,this.updateCharacters())}}const hE=/^\s*>\s$/,gE=ae.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ir({find:hE,type:this.type})]}}),mE=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,bE=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,yE=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,vE=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,wE=Le.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[rr({find:mE,type:this.type}),rr({find:yE,type:this.type})]},addPasteRules(){return[Nn({find:bE,type:this.type}),Nn({find:vE,type:this.type})]}}),kE=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),zd=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Vd=/^\s*([-+*])\s$/,xE=ae.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:n}){return["ul",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kE.name,this.editor.getAttributes(zd.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ir({find:Vd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ir({find:Vd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zd.name),editor:this.editor})),[n]}}),EE=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,CE=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,SE=Le.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rr({find:EE,type:this.type})]},addPasteRules(){return[Nn({find:CE,type:this.type})]}}),_E=/^```([a-z]+)?[\s\n]$/,ME=/^~~~([a-z]+)?[\s\n]$/,Lg=ae.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",fe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` -`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0||r.nodeAt(a)?!1:n.commands.exitCode()}}},addInputRules(){return[El({find:Cx,type:this.type,getAttributes:n=>({language:n[1]})}),El({find:Sx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ce({key:new _e("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o}=n.state;return o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(Y.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(t.replace(/\r\n?/g,` -`)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),_x=ae.create({name:"doc",topNode:!0,content:"block+"});function Mx(n={}){return new Ce({view(e){return new Ax(e,n)}})}class Ax{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler: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,r;if(t){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"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}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=sh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const Tx=ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Mx(this.options)]}});class Oe extends te{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Oe.valid(r)?new Oe(r):te.near(r)}content(){return F.empty}eq(e){return e instanceof Oe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Oe(e.resolve(t.pos))}getBookmark(){return new Cc(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Nx(e)||!Ox(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Oe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Oe.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!X.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Oe.valid(a))return a}return null}}}Oe.prototype.visible=!1;Oe.findFrom=Oe.findGapCursorFrom;te.jsonID("gapcursor",Oe);class Cc{constructor(e){this.pos=e}map(e){return new Cc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Oe.valid(t)?new Oe(t):te.near(t)}}function Nx(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Ox(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Lx(){return new Ce({props:{decorations:Bx,createSelectionBetween(n,e,t){return e.pos==t.pos&&Oe.valid(t)?new Oe(t):null},handleClick:Dx,handleKeyDown:Rx,handleDOMEvents:{beforeinput:Ix}}})}const Rx=ic({ArrowLeft:rs("horiz",-1),ArrowRight:rs("horiz",1),ArrowUp:rs("vert",-1),ArrowDown:rs("vert",1)});function rs(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Y){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Oe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Oe(c))),!0):!1}}function Dx(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Oe.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&X.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Oe(r))),!0)}function Ix(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Oe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=R.empty;for(let o=r.length-1;o>=0;o--)i=R.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new F(i,0,0));return s.setSelection(Y.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Bx(n){if(!(n.selection instanceof Oe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",we.create(n.doc,[Ie.widget(n.selection.head,e,{key:"gapcursor"})])}const Hx=ke.create({name:"gapCursor",addProseMirrorPlugins(){return[Lx()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=re(W(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Px=ae.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",fe(this.options.HTMLAttributes,n)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Og=ae.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>El({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Js=200,Pe=function(){};Pe.prototype.append=function(e){return e.length?(e=Pe.from(e),!this.length&&e||e.length=t?Pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};Pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Pe.from=function(e){return e instanceof Pe?e:e&&e.length?new Lg(e):Pe.empty};var Lg=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Js)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Js)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Pe);Pe.empty=new Lg([]);var $x=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Pe);const Fx=500;class Nt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new Bt(d.map));let p=d.step.map(i.slice(s)),h;p&&o.maybeStep(p).doc&&(h=o.mapping.maps[o.mapping.maps.length-1],c.push(new Bt(h,void 0,void 0,c.length+u.length))),s--,h&&i.appendMap(h,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;uVx&&(a=zx(a,c),o-=c),new Nt(a.append(s),o)}remapping(e,t){let r=new Or;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Nt(this.items.append(e.map(t=>new Bt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let h=s.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),m=f.selection&&f.selection.map(s.slice(l+1,p));m&&a++,r.push(new Bt(h,g,m))}else r.push(new Bt(h))},i);let c=[];for(let f=t;fFx&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let d=new Bt(c.invert(),l,u),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Nt(Pe.from(i.reverse()),s)}}Nt.empty=new Nt(Pe.empty,0);function zx(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Bt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Bt(t.getMap().invert(),t,this.selection)}}}class fn{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Vx=20;function qx(n,e,t,r){let i=t.getMeta(Mn),s;if(i)return i.historyState;t.getMeta(Kx)&&(n=new fn(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Mn))return o.getMeta(Mn).redo?new fn(n.done.addTransform(t,void 0,r,Ss(e)),n.undone,Vd(t.mapping.maps[t.steps.length-1]),n.prevTime,n.prevComposition):new fn(n.done,n.undone.addTransform(t,void 0,r,Ss(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Ux(t,n.prevRanges)),c=o?Aa(n.prevRanges,t.mapping):Vd(t.mapping.maps[t.steps.length-1]);return new fn(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,Ss(e)),Nt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new fn(n.done.rebased(t,s),n.undone.rebased(t,s),Aa(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new fn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Aa(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Ux(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function Vd(n){let e=[];return n.forEach((t,r,i,s)=>e.push(i,s)),e}function Aa(n,e){if(!n)return null;let t=[];for(let r=0;r{let t=Mn.getState(n);return!t||t.done.eventCount==0?!1:(e&&Rg(t,n,e,!1),!0)},Ig=(n,e)=>{let t=Mn.getState(n);return!t||t.undone.eventCount==0?!1:(e&&Rg(t,n,e,!0),!0)},Gx=ke.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Dg(n,e),redo:()=>({state:n,dispatch:e})=>Ig(n,e)}},addProseMirrorPlugins(){return[Wx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Zx=ae.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",fe(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{$to:t}=e.selection,r=n();return t.parentOffset===0?r.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:a}=i.selection,l=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(Y.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(X.create(i.doc,a.pos)):i.setSelection(Y.create(i.doc,a.pos));else{const c=(o=a.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(l,c),i.setSelection(Y.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[hc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),jx=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,Jx=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,Yx=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Xx=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,Qx=Le.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[rr({find:jx,type:this.type}),rr({find:Yx,type:this.type})]},addPasteRules(){return[Nn({find:Jx,type:this.type}),Nn({find:Xx,type:this.type})]}}),eC=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tC=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Ud=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Kd=/^(\d+)\.\s$/,nC=ae.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",fe(this.options.HTMLAttributes,t),0]:["ol",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tC.name,this.editor.getAttributes(Ud.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=ir({find:Kd,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)&&(n=ir({find:Kd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ud.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),rC=ae.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iC=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,sC=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,oC=Le.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return uc()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[rr({find:iC,type:this.type})]},addPasteRules(){return[Nn({find:sC,type:this.type})]}}),aC=ae.create({name:"text",group:"inline"}),Wd=ke.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,a,l,c,u,d,f,p,h,g,m,v;const y=[];return this.options.blockquote!==!1&&y.push(px.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&y.push(yx.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&y.push(wx.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&y.push(xx.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(Ng.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(_x.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&y.push(Tx.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&y.push(Hx.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(Px.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(Og.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&y.push(Gx.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&y.push(Zx.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(Qx.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&y.push(eC.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(nC.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&y.push(rC.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&y.push(oC.configure((m=this.options)===null||m===void 0?void 0:m.strike)),this.options.text!==!1&&y.push(aC.configure((v=this.options)===null||v===void 0?void 0:v.text)),y}}),lC=Le.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),cC=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),uC=ke.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>{var e;return(e=n.style.fontFamily)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Bg=n=>{const e=document.createElement("div");return e.classList.add("aie-loader-placeholder"),e.innerHTML=` +`);return!s||!o?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0||r.nodeAt(a)?!1:n.commands.exitCode()}}},addInputRules(){return[_l({find:_E,type:this.type,getAttributes:n=>({language:n[1]})}),_l({find:ME,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Ce({key:new _e("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o}=n.state;return o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(Y.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(t.replace(/\r\n?/g,` +`)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),AE=ae.create({name:"doc",topNode:!0,content:"block+"});function TE(n={}){return new Ce({view(e){return new NE(e,n)}})}class NE{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler: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,r;if(t){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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 s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let a=i.getBoundingClientRect();s=a.left-i.scrollLeft,o=a.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"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}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=oh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const OE=ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[TE(this.options)]}});class Oe extends te{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Oe.valid(r)?new Oe(r):te.near(r)}content(){return F.empty}eq(e){return e instanceof Oe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Oe(e.resolve(t.pos))}getBookmark(){return new Mc(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!LE(e)||!RE(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Oe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Oe.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!X.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Oe.valid(a))return a}return null}}}Oe.prototype.visible=!1;Oe.findFrom=Oe.findGapCursorFrom;te.jsonID("gapcursor",Oe);class Mc{constructor(e){this.pos=e}map(e){return new Mc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Oe.valid(t)?new Oe(t):te.near(t)}}function LE(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function RE(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function DE(){return new Ce({props:{decorations:PE,createSelectionBetween(n,e,t){return e.pos==t.pos&&Oe.valid(t)?new Oe(t):null},handleClick:BE,handleKeyDown:IE,handleDOMEvents:{beforeinput:HE}}})}const IE=lc({ArrowLeft:rs("horiz",-1),ArrowRight:rs("horiz",1),ArrowUp:rs("vert",-1),ArrowDown:rs("vert",1)});function rs(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Y){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Oe.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new Oe(c))),!0):!1}}function BE(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Oe.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&X.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Oe(r))),!0)}function HE(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Oe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=R.empty;for(let o=r.length-1;o>=0;o--)i=R.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new F(i,0,0));return s.setSelection(Y.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function PE(n){if(!(n.selection instanceof Oe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",we.create(n.doc,[Ie.widget(n.selection.head,e,{key:"gapcursor"})])}const $E=ke.create({name:"gapCursor",addProseMirrorPlugins(){return[DE()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ie(W(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),FE=ae.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",fe(this.options.HTMLAttributes,n)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Rg=ae.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(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>_l({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Ys=200,Pe=function(){};Pe.prototype.append=function(e){return e.length?(e=Pe.from(e),!this.length&&e||e.length=t?Pe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Pe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};Pe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Pe.from=function(e){return e instanceof Pe?e:e&&e.length?new Dg(e):Pe.empty};var Dg=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ys)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ys)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Pe);Pe.empty=new Dg([]);var zE=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Pe);const VE=500;class Nt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new Bt(d.map));let p=d.step.map(i.slice(s)),h;p&&o.maybeStep(p).doc&&(h=o.mapping.maps[o.mapping.maps.length-1],c.push(new Bt(h,void 0,void 0,c.length+u.length))),s--,h&&i.appendMap(h,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Nt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;uUE&&(a=qE(a,c),o-=c),new Nt(a.append(s),o)}remapping(e,t){let r=new Or;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Nt(this.items.append(e.map(t=>new Bt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let h=s.maps[p];if(f.step){let g=e.steps[p].invert(e.docs[p]),m=f.selection&&f.selection.map(s.slice(l+1,p));m&&a++,r.push(new Bt(h,g,m))}else r.push(new Bt(h))},i);let c=[];for(let f=t;fVE&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let d=new Bt(c.invert(),l,u),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Nt(Pe.from(i.reverse()),s)}}Nt.empty=new Nt(Pe.empty,0);function qE(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Bt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Bt(t.getMap().invert(),t,this.selection)}}}class fn{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const UE=20;function KE(n,e,t,r){let i=t.getMeta(Mn),s;if(i)return i.historyState;t.getMeta(ZE)&&(n=new fn(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Mn))return o.getMeta(Mn).redo?new fn(n.done.addTransform(t,void 0,r,_s(e)),n.undone,qd(t.mapping.maps[t.steps.length-1]),n.prevTime,n.prevComposition):new fn(n.done,n.undone.addTransform(t,void 0,r,_s(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!WE(t,n.prevRanges)),c=o?La(n.prevRanges,t.mapping):qd(t.mapping.maps[t.steps.length-1]);return new fn(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,_s(e)),Nt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new fn(n.done.rebased(t,s),n.undone.rebased(t,s),La(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new fn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),La(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function WE(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function qd(n){let e=[];return n.forEach((t,r,i,s)=>e.push(i,s)),e}function La(n,e){if(!n)return null;let t=[];for(let r=0;r{let t=Mn.getState(n);return!t||t.done.eventCount==0?!1:(e&&Ig(t,n,e,!1),!0)},Hg=(n,e)=>{let t=Mn.getState(n);return!t||t.undone.eventCount==0?!1:(e&&Ig(t,n,e,!0),!0)},jE=ke.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Bg(n,e),redo:()=>({state:n,dispatch:e})=>Hg(n,e)}},addProseMirrorPlugins(){return[GE(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),JE=ae.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",fe(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{$to:t}=e.selection,r=n();return t.parentOffset===0?r.insertContentAt(Math.max(t.pos-2,0),{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:a}=i.selection,l=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?i.setSelection(Y.create(i.doc,a.pos+1)):a.nodeAfter.isBlock?i.setSelection(X.create(i.doc,a.pos)):i.setSelection(Y.create(i.doc,a.pos));else{const c=(o=a.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();c&&(i.insert(l,c),i.setSelection(Y.create(i.doc,l+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[bc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),YE=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,XE=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,QE=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,eC=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,tC=Le.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[rr({find:YE,type:this.type}),rr({find:QE,type:this.type})]},addPasteRules(){return[Nn({find:XE,type:this.type}),Nn({find:eC,type:this.type})]}}),nC=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),rC=ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Kd=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Wd=/^(\d+)\.\s$/,iC=ae.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",fe(this.options.HTMLAttributes,t),0]:["ol",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(rC.name,this.editor.getAttributes(Kd.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=ir({find:Wd,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)&&(n=ir({find:Wd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Kd.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),sC=ae.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oC=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,aC=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,lC=Le.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return hc()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[rr({find:oC,type:this.type})]},addPasteRules(){return[Nn({find:aC,type:this.type})]}}),cC=ae.create({name:"text",group:"inline"}),Zd=ke.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,a,l,c,u,d,f,p,h,g,m,v;const y=[];return this.options.blockquote!==!1&&y.push(gE.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&y.push(wE.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&y.push(xE.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&y.push(SE.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&y.push(Lg.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&y.push(AE.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&y.push(OE.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&y.push($E.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&y.push(FE.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&y.push(Rg.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&y.push(jE.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&y.push(JE.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&y.push(tC.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&y.push(nC.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&y.push(iC.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&y.push(sC.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&y.push(lC.configure((m=this.options)===null||m===void 0?void 0:m.strike)),this.options.text!==!1&&y.push(cC.configure((v=this.options)===null||v===void 0?void 0:v.text)),y}}),uC=Le.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),dC=Le.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ui(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),fC=ke.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>{var e;return(e=n.style.fontFamily)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Pg=n=>{const e=document.createElement("div");return e.classList.add("aie-loader-placeholder"),e.innerHTML=` - `,Ie.widget(n.pos,e,{id:n.id})},dC=n=>{const e=document.createElement("div");return e.classList.add("aie-loader-placeholder"),e.style.height="20px",e.style.display="inline-block",e.innerHTML=` + `,Ie.widget(n.pos,e,{id:n.id})},pC=n=>{const e=document.createElement("div");return e.classList.add("aie-loader-placeholder"),e.style.height="20px",e.style.display="inline-block",e.innerHTML=` ${n.text} - `,Ie.widget(n.pos,e,{id:n.id})},fC=(n,e,t,r)=>{const i=new FormData;return i.append(r,n),new Promise((s,o)=>{fetch(e,{method:"post",headers:{Accept:"application/json",...t},body:i}).then(a=>a.json()).then(a=>{s(a)}).catch(a=>{o(a)})})},pC=(n,e,t,r)=>{let i=new FileReader;return new Promise((s,o)=>{i.onload=()=>s({errorCode:0,data:{src:i.result,href:n.name}}),i.onerror=()=>o(i.error),setTimeout(()=>i.readAsDataURL(n),5e3*Math.random())})},Sc=n=>n?fC:pC,Gd=new _e("aie-attachment-plugin"),ri="attachment_action",hC=ke.create({name:"attachment",addOptions(){return{uploadUrl:"",uploadHeaders:{},HTMLAttributes:{}}},addCommands(){return{uploadAttachment:n=>()=>{const e=Io(),{state:{tr:t},view:r,schema:i}=this.editor;return t.selection.empty||t.deleteSelection(),r.dispatch(t.setMeta(ri,{type:"add",id:e,pos:t.selection.from,text:n.name})),this.options.uploaderEvent&&this.options.uploaderEvent.onBeforeUpload&&this.options.uploaderEvent.onBeforeUpload(n,this.options.uploadUrl,this.options.uploadHeaders),(this.options.uploader||Sc(this.options.uploadUrl))(n,this.options.uploadUrl,this.options.uploadHeaders,"attachment").then(o=>{if(this.options.uploaderEvent&&this.options.uploaderEvent.onSuccess){const a=this.options.uploaderEvent.onSuccess(n,o);if(typeof a=="boolean"&&!a)return;typeof a=="object"&&(o=a)}if(o.errorCode===0&&o.data&&o.data.href){let l=Gd.getState(this.editor.state).find(void 0,void 0,u=>u.id==e);const c=o.data.fileName||n.name;r.dispatch(r.state.tr.insertText(` ${c} `,l[0].from).addMark(l[0].from+1,c.length+l[0].from+1,i.marks.link.create({href:o.data.href,target:"_blank"})).setMeta(ri,{type:"remove",id:e}))}else r.dispatch(t.setMeta(ri,{type:"remove",id:e})),this.options.uploaderEvent&&this.options.uploaderEvent.onFailed&&this.options.uploaderEvent.onFailed(n,o)}).catch(o=>{const{state:{tr:a},view:l}=this.editor;l.dispatch(a.setMeta(ri,{type:"remove",id:e})),this.options.uploaderEvent&&this.options.uploaderEvent.onError&&this.options.uploaderEvent.onError(n,o)}),!0}}},addProseMirrorPlugins(){const n=this.editor;return[new Ce({key:Gd,state:{init:()=>we.empty,apply:(e,t)=>{const r=e.getMeta(ri);return t=t.map(e.mapping,e.doc),r&&r.type==="add"?t=t.add(e.doc,[dC(r)]):r&&r.type==="remove"&&(t=t.remove(t.find(void 0,void 0,i=>i.id==r.id))),t}},props:{decorations(e){return this.getState(e)},handleDOMEvents:{drop(e,t){if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const i=Array.from(t.dataTransfer.files).filter(s=>!/video/i.test(s.type)&&!/image/i.test(s.type));return t.preventDefault(),i.forEach(s=>{n.commands.uploadAttachment(s)}),!0}}}})]}}),gC=ke.create({name:"painter",addCommands(){return{setPainter:n=>({view:{dispatch:e,state:{tr:t},dom:r}})=>(r.style.cursor="context-menu",e(t.setMeta("painterAction",{type:"start",marks:n})),!0)}},addProseMirrorPlugins(){return[new Ce({key:new _e("aie-painter"),state:{init:()=>[],apply:(n,e)=>{const t=n.getMeta("painterAction");return t&&t.type==="start"?e=t.marks:t&&t.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(n,e){const t=this.getState(n.state);if(!t||t.length==0)return!1;const r=()=>{document.removeEventListener("mouseup",r);let{dispatch:i,state:{tr:s,selection:o},dom:a}=n;a.style.cursor="",s=s.removeMark(o.from,o.to);for(let l of t)l.type.name!="link"&&(s=s.addMark(o.from,o.to,l));i(s.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),mC=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/,bC=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g,yC=Le.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[rr({find:mC,type:this.type})]},addPasteRules(){return[Nn({find:bC,type:this.type})]}}),vC=ke.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),wC=ke.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>{var e;return(e=n.style.fontSize)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),kC=ke.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],heights:["100%","125%","150%","200%","250%","300%"],defaultHeight:"100%"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:this.options.defaultHeight,parseHTML:n=>n.style.lineHeight||this.options.defaultHeight,renderHTML:n=>n.lineHeight===this.options.defaultHeight?{}:{style:`line-height: ${n.lineHeight}`}}}}]},addCommands(){return{setLineHeight:n=>({commands:e})=>this.options.heights.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{lineHeight:n})):!1,unsetLineHeight:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"lineHeight"))}}}),EC=ke.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),xC=ke.create({name:"indent",addOptions(){return{types:["listItem","paragraph"],minLevel:0,maxLevel:8}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:n=>{const e=Number(n.getAttribute("data-indent"));return e&&e>this.options.minLevel?e:null},renderHTML:n=>n.indent?{style:`text-indent: ${(n==null?void 0:n.indent)*10}px`,"data-indent":n==null?void 0:n.indent}:{}}}}]},addCommands(){const n=(r,i,s)=>{var a;const o=(a=r==null?void 0:r.doc)==null?void 0:a.nodeAt(i);if(o){const l=(o.attrs.indent||0)+s,{minLevel:c,maxLevel:u}=this.options,d=lu?u:l;if(d!==o.attrs.indent){const{indent:f,...p}=o.attrs,h=d>c?{...p,indent:d}:p;return r.setNodeMarkup(i,o.type,h,o.marks)}}return r},e=(r,i)=>{const{doc:s,selection:o}=r;if(s&&o&&(o instanceof Y||o instanceof Et)){const{from:a,to:l}=o;s.nodesBetween(a,l,(c,u)=>this.options.types.includes(c.type.name)?(r=n(r,u,i),!1):!0)}return r},t=r=>()=>({tr:i,state:s,dispatch:o})=>{const{selection:a}=s;return i=i.setSelection(a),i=e(i,r),i.docChanged?(o==null||o(i),!0):!1};return{indent:t(1),outdent:t(-1)}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}}),CC=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,SC=ae.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},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}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[hc({find:CC,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Hg=(n,e,t)=>{const r=n.querySelector(".resize-obj"),i=10;let s,o,a,l;const c=f=>{f.preventDefault(),e.addEventListener("mousemove",u),e.addEventListener("mouseup",d),e.addEventListener("mouseleave",d),s=f.clientX,o=Number(r.getAttribute("data-with"))||r.clientWidth,a=f.target.getAttribute("data-position"),l=e.clientWidth-100},u=f=>{const p=f.clientX-s;if(p==0)return;const h=a==="right"?p>0:p<0;let g=o+Math.abs(p)*(h?1:-1);g>=l&&(g=l),g{e.removeEventListener("mousemove",u),e.removeEventListener("mouseup",d),e.removeEventListener("mouseleave",d);const f={width:Number(r.getAttribute("data-width"))};t(f)};for(let f of n.querySelector(".aie-resize").children)f.addEventListener("mousedown",c)},Zd=new _e("aie-image-plugin"),ii="image_action",_C=SC.extend({name:"image",draggable:!0,selectable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),uploadUrl:"",uploadHeaders:{},uploader:void 0,defaultSize:350}},allowGapCursor(){return!this.options.inline},addAttributes(){return{src:{default:"",parseHTML:n=>`${n.getAttribute("src")??""}`},alt:{default:""},title:{default:""},width:{default:this.options.defaultSize},height:{default:"auto"},align:{default:"left"}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),uploadImage:e=>()=>{const t=Io(),{state:{tr:r},view:i,schema:s}=this.editor;return r.selection.empty||r.deleteSelection(),i.dispatch(r.setMeta(ii,{type:"add",id:t,pos:r.selection.from})),this.options.uploaderEvent&&this.options.uploaderEvent.onBeforeUpload&&this.options.uploaderEvent.onBeforeUpload(e,this.options.uploadUrl,this.options.uploadHeaders),(this.options.uploader||Sc(this.options.uploadUrl))(e,this.options.uploadUrl,this.options.uploadHeaders,"image").then(a=>{if(this.options.uploaderEvent&&this.options.uploaderEvent.onSuccess){const l=this.options.uploaderEvent.onSuccess(e,a);if(typeof l=="boolean"&&!l)return;typeof l=="object"&&(a=l)}if(a.errorCode===0&&a.data&&a.data.src){let c=Zd.getState(this.editor.state).find(void 0,void 0,u=>u.id==t);i.dispatch(i.state.tr.insert(c[0].from,s.nodes.image.create({src:a.data.src,alt:a.data.alt})).setMeta(ii,{type:"remove",id:t}))}else i.dispatch(r.setMeta(ii,{type:"remove",id:t})),this.options.uploaderEvent&&this.options.uploaderEvent.onFailed&&this.options.uploaderEvent.onFailed(e,a)}).catch(a=>{const{state:{tr:l},view:c}=this.editor;c.dispatch(l.setMeta(ii,{type:"remove",id:t})),this.options.uploaderEvent&&this.options.uploaderEvent.onError&&this.options.uploaderEvent.onError(e,a)}),!0}}},addNodeView(){return n=>{const e=document.createElement("div"),{src:t,width:r,height:i,align:s}=n.node.attrs;return e.classList.add(`align-${s}`),e.innerHTML=` + `,Ie.widget(n.pos,e,{id:n.id})},hC=(n,e,t,r)=>{const i=new FormData;return i.append(r,n),new Promise((s,o)=>{fetch(e,{method:"post",headers:{Accept:"application/json",...t},body:i}).then(a=>a.json()).then(a=>{s(a)}).catch(a=>{o(a)})})},gC=(n,e,t,r)=>{let i=new FileReader;return new Promise((s,o)=>{i.onload=()=>s({errorCode:0,data:{src:i.result,href:n.name}}),i.onerror=()=>o(i.error),setTimeout(()=>i.readAsDataURL(n),5e3*Math.random())})},Ac=n=>n?hC:gC,Gd=new _e("aie-attachment-plugin"),ii="attachment_action",mC=ke.create({name:"attachment",addOptions(){return{uploadUrl:"",uploadHeaders:{},HTMLAttributes:{}}},addCommands(){return{uploadAttachment:n=>()=>{const e=Ho(),{state:{tr:t},view:r,schema:i}=this.editor;return t.selection.empty||t.deleteSelection(),r.dispatch(t.setMeta(ii,{type:"add",id:e,pos:t.selection.from,text:n.name})),this.options.uploaderEvent&&this.options.uploaderEvent.onBeforeUpload&&this.options.uploaderEvent.onBeforeUpload(n,this.options.uploadUrl,this.options.uploadHeaders),(this.options.uploader||Ac(this.options.uploadUrl))(n,this.options.uploadUrl,this.options.uploadHeaders,"attachment").then(o=>{if(this.options.uploaderEvent&&this.options.uploaderEvent.onSuccess){const a=this.options.uploaderEvent.onSuccess(n,o);if(typeof a=="boolean"&&!a)return;typeof a=="object"&&(o=a)}if(o.errorCode===0&&o.data&&o.data.href){let l=Gd.getState(this.editor.state).find(void 0,void 0,u=>u.id==e);const c=o.data.fileName||n.name;r.dispatch(r.state.tr.insertText(` ${c} `,l[0].from).addMark(l[0].from+1,c.length+l[0].from+1,i.marks.link.create({href:o.data.href,target:"_blank"})).setMeta(ii,{type:"remove",id:e}))}else r.dispatch(t.setMeta(ii,{type:"remove",id:e})),this.options.uploaderEvent&&this.options.uploaderEvent.onFailed&&this.options.uploaderEvent.onFailed(n,o)}).catch(o=>{const{state:{tr:a},view:l}=this.editor;l.dispatch(a.setMeta(ii,{type:"remove",id:e})),this.options.uploaderEvent&&this.options.uploaderEvent.onError&&this.options.uploaderEvent.onError(n,o)}),!0}}},addProseMirrorPlugins(){const n=this.editor;return[new Ce({key:Gd,state:{init:()=>we.empty,apply:(e,t)=>{const r=e.getMeta(ii);return t=t.map(e.mapping,e.doc),r&&r.type==="add"?t=t.add(e.doc,[pC(r)]):r&&r.type==="remove"&&(t=t.remove(t.find(void 0,void 0,i=>i.id==r.id))),t}},props:{decorations(e){return this.getState(e)},handleDOMEvents:{drop(e,t){if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const i=Array.from(t.dataTransfer.files).filter(s=>!/video/i.test(s.type)&&!/image/i.test(s.type));return t.preventDefault(),i.forEach(s=>{n.commands.uploadAttachment(s)}),!0}}}})]}}),bC=ke.create({name:"painter",addCommands(){return{setPainter:n=>({view:{dispatch:e,state:{tr:t},dom:r}})=>(r.style.cursor="context-menu",e(t.setMeta("painterAction",{type:"start",marks:n})),!0)}},addProseMirrorPlugins(){return[new Ce({key:new _e("aie-painter"),state:{init:()=>[],apply:(n,e)=>{const t=n.getMeta("painterAction");return t&&t.type==="start"?e=t.marks:t&&t.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(n,e){const t=this.getState(n.state);if(!t||t.length==0)return!1;const r=()=>{document.removeEventListener("mouseup",r);let{dispatch:i,state:{tr:s,selection:o},dom:a}=n;a.style.cursor="",s=s.removeMark(o.from,o.to);for(let l of t)l.type.name!="link"&&(s=s.addMark(o.from,o.to,l));i(s.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),yC=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/,vC=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g,wC=Le.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[rr({find:yC,type:this.type})]},addPasteRules(){return[Nn({find:vC,type:this.type})]}}),kC=ke.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),xC=ke.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>{var e;return(e=n.style.fontSize)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),EC=ke.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],heights:["100%","125%","150%","200%","250%","300%"],defaultHeight:"100%"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:this.options.defaultHeight,parseHTML:n=>n.style.lineHeight||this.options.defaultHeight,renderHTML:n=>n.lineHeight===this.options.defaultHeight?{}:{style:`line-height: ${n.lineHeight}`}}}}]},addCommands(){return{setLineHeight:n=>({commands:e})=>this.options.heights.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{lineHeight:n})):!1,unsetLineHeight:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"lineHeight"))}}}),CC=ke.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),SC=ke.create({name:"indent",addOptions(){return{types:["listItem","paragraph"],minLevel:0,maxLevel:8}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:n=>{const e=Number(n.getAttribute("data-indent"));return e&&e>this.options.minLevel?e:null},renderHTML:n=>n.indent?{style:`text-indent: ${(n==null?void 0:n.indent)*10}px`,"data-indent":n==null?void 0:n.indent}:{}}}}]},addCommands(){const n=(r,i,s)=>{var a;const o=(a=r==null?void 0:r.doc)==null?void 0:a.nodeAt(i);if(o){const l=(o.attrs.indent||0)+s,{minLevel:c,maxLevel:u}=this.options,d=lu?u:l;if(d!==o.attrs.indent){const{indent:f,...p}=o.attrs,h=d>c?{...p,indent:d}:p;return r.setNodeMarkup(i,o.type,h,o.marks)}}return r},e=(r,i)=>{const{doc:s,selection:o}=r;if(s&&o&&(o instanceof Y||o instanceof xt)){const{from:a,to:l}=o;s.nodesBetween(a,l,(c,u)=>this.options.types.includes(c.type.name)?(r=n(r,u,i),!1):!0)}return r},t=r=>()=>({tr:i,state:s,dispatch:o})=>{const{selection:a}=s;return i=i.setSelection(a),i=e(i,r),i.docChanged?(o==null||o(i),!0):!1};return{indent:t(1),outdent:t(-1)}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}}),_C=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,MC=ae.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},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}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[bc({find:_C,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),$g=(n,e,t)=>{const r=n.querySelector(".resize-obj"),i=10;let s,o,a,l;const c=f=>{f.preventDefault(),e.addEventListener("mousemove",u),e.addEventListener("mouseup",d),e.addEventListener("mouseleave",d),s=f.clientX,o=Number(r.getAttribute("data-with"))||r.clientWidth,a=f.target.getAttribute("data-position"),l=e.clientWidth-100},u=f=>{const p=f.clientX-s;if(p==0)return;const h=a==="right"?p>0:p<0;let g=o+Math.abs(p)*(h?1:-1);g>=l&&(g=l),g{e.removeEventListener("mousemove",u),e.removeEventListener("mouseup",d),e.removeEventListener("mouseleave",d);const f={width:Number(r.getAttribute("data-width"))};t(f)};for(let f of n.querySelector(".aie-resize").children)f.addEventListener("mousedown",c)},jd=new _e("aie-image-plugin"),si="image_action",AC=MC.extend({name:"image",draggable:!0,selectable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),uploadUrl:"",uploadHeaders:{},uploader:void 0,defaultSize:350}},allowGapCursor(){return!this.options.inline},addAttributes(){return{src:{default:"",parseHTML:n=>`${n.getAttribute("src")??""}`},alt:{default:""},title:{default:""},width:{default:this.options.defaultSize},height:{default:"auto"},align:{default:"left"}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),uploadImage:e=>()=>{const t=Ho(),{state:{tr:r},view:i,schema:s}=this.editor;return r.selection.empty||r.deleteSelection(),i.dispatch(r.setMeta(si,{type:"add",id:t,pos:r.selection.from})),this.options.uploaderEvent&&this.options.uploaderEvent.onBeforeUpload&&this.options.uploaderEvent.onBeforeUpload(e,this.options.uploadUrl,this.options.uploadHeaders),(this.options.uploader||Ac(this.options.uploadUrl))(e,this.options.uploadUrl,this.options.uploadHeaders,"image").then(a=>{if(this.options.uploaderEvent&&this.options.uploaderEvent.onSuccess){const l=this.options.uploaderEvent.onSuccess(e,a);if(typeof l=="boolean"&&!l)return;typeof l=="object"&&(a=l)}if(a.errorCode===0&&a.data&&a.data.src){let c=jd.getState(this.editor.state).find(void 0,void 0,u=>u.id==t);i.dispatch(i.state.tr.insert(c[0].from,s.nodes.image.create({src:a.data.src,alt:a.data.alt})).setMeta(si,{type:"remove",id:t}))}else i.dispatch(r.setMeta(si,{type:"remove",id:t})),this.options.uploaderEvent&&this.options.uploaderEvent.onFailed&&this.options.uploaderEvent.onFailed(e,a)}).catch(a=>{const{state:{tr:l},view:c}=this.editor;c.dispatch(l.setMeta(si,{type:"remove",id:t})),this.options.uploaderEvent&&this.options.uploaderEvent.onError&&this.options.uploaderEvent.onError(e,a)}),!0}}},addNodeView(){return n=>{const e=document.createElement("div"),{src:t,width:r,height:i,align:s}=n.node.attrs;return e.classList.add(`align-${s}`),e.innerHTML=`
@@ -329,16 +329,16 @@ ${t}`)}createUrl(){const e=new Date().toUTCString().replace("GMT","+0000");let t
- `,Hg(e,n.editor.view.dom,o=>n.editor.commands.updateAttributes("image",o)),{dom:e}}},addProseMirrorPlugins(){const n=this.editor;return[new Ce({key:Zd,state:{init:()=>we.empty,apply:(e,t)=>{const r=e.getMeta(ii);if(r){let i=!1;const s=t.map(e.mapping,e.doc,{onRemove:o=>{i=!0}});i||(t=s),r.type==="add"?t=t.add(e.doc,[Bg(r)]):r.type==="remove"&&(t=t.remove(t.find(void 0,void 0,o=>o.id==r.id)))}return t}},props:{decorations(e){return this.getState(e)},handlePaste:(e,t)=>{var i;const r=Array.from(((i=t.clipboardData)==null?void 0:i.items)||[]);for(const s of r)if(s.type.indexOf("image")===0){t.preventDefault();const o=s.getAsFile();o&&this.editor.commands.uploadImage(o)}},handleDOMEvents:{drop(e,t){if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const i=Array.from(t.dataTransfer.files).filter(c=>/image/i.test(c.type));if(i.length===0)return!1;t.preventDefault();const{state:{tr:s,doc:o},dispatch:a}=e,l=e.posAtCoords({left:t.clientX,top:t.clientY});return a(s.setSelection(Y.create(o,l.pos)).scrollIntoView()),i.forEach(c=>{n.commands.uploadImage(c)}),!0}}}})]}});var Al,Tl;if(typeof WeakMap<"u"){let n=new WeakMap;Al=e=>n.get(e),Tl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Al=r=>{for(let i=0;i(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Te=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-k});break}const b=i+k*e;for(let x=0;xr&&(s+=c.attrs.colspan)}}for(let o=0;o1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function TC(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function OC(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Rt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ho(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Jr(e.$head)||LC(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function LC(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Nl(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function RC(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function _c(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Pg(n,e,t){const r=n.node(-1),i=Te.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function or(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function $g(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;ic!=e.pos-i);a.unshift(e.pos-i);const l=a.map(c=>{const u=t.nodeAt(c);if(!u)throw RangeError(`No cell with offset ${c} found`);const d=i+c+1;return new uh(o.resolve(d),o.resolve(d+u.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=n,this.$headCell=e}map(n,e){const t=n.resolve(e.map(this.$anchorCell.pos)),r=n.resolve(e.map(this.$headCell.pos));if(Nl(t)&&Nl(r)&&_c(t,r)){const i=this.$anchorCell.node(-1)!=t.node(-1);return i&&this.isRowSelection()?de.rowSelection(t,r):i&&this.isColSelection()?de.colSelection(t,r):new de(t,r)}return Y.between(t,r)}content(){const n=this.$anchorCell.node(-1),e=Te.get(n),t=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-t,this.$headCell.pos-t),i={},s=[];for(let a=r.top;a0||g>0){let m=p.attrs;if(h>0&&(m=or(m,0,h)),g>0&&(m=or(m,m.colspan-g,g)),f.leftr.bottom){const m={...p.attrs,rowspan:Math.min(f.bottom,r.bottom)-Math.max(f.top,r.top)};f.top0)return!1;const t=n+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(t,r)==this.$headCell.node(-1).childCount}static colSelection(n,e=n){const t=n.node(-1),r=Te.get(t),i=n.start(-1),s=r.findCell(n.pos-i),o=r.findCell(e.pos-i),a=n.node(0);return s.top<=o.top?(s.top>0&&(n=a.resolve(i+r.map[s.left])),o.bottom0&&(e=a.resolve(i+r.map[o.left])),s.bottom0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,o)==e.width}eq(n){return n instanceof de&&n.$anchorCell.pos==this.$anchorCell.pos&&n.$headCell.pos==this.$headCell.pos}static rowSelection(n,e=n){const t=n.node(-1),r=Te.get(t),i=n.start(-1),s=r.findCell(n.pos-i),o=r.findCell(e.pos-i),a=n.node(0);return s.left<=o.left?(s.left>0&&(n=a.resolve(i+r.map[s.top*r.width])),o.right0&&(e=a.resolve(i+r.map[o.top*r.width])),s.right{e.push(Ie.node(r,r+t.nodeSize,{class:"selectedCell"}))}),we.create(n.doc,e)}function BC({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(i+1)=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function HC({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function PC(n,e,t){const r=(e||n).selection,i=(e||n).doc;let s,o;if(r instanceof X&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=de.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=de.rowSelection(a,a)}else if(!t){const a=Te.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];s=de.create(i,l+1,c)}}else r instanceof Y&&BC(r)?s=Y.create(i,r.from):r instanceof Y&&HC(r)&&(s=Y.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var $C=new _e("fix-tables");function zg(n,e,t,r){const i=n.childCount,s=e.childCount;e:for(let o=0,a=0;o{i.type.spec.tableRole=="table"&&(t=FC(n,i,s,t))};return e?e.doc!=n.doc&&zg(e.doc,n.doc,0,r):n.doc.descendants(r),t}function FC(n,e,t,r){const i=Te.get(e);if(!i.problems)return r;r||(r=n.tr);const s=[];for(let l=0;l0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const h=[];for(let m=0;m0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c=e.length&&e.push(R.empty),t[i]r&&(f=f.type.createChecked(or(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;pi&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(R.from(l))}t=s,e=i}return{width:n,height:e,rows:t}}function UC(n,e,t,r,i,s,o){const a=n.doc.type.schema,l=Je(a);let c,u;if(i>e.width)for(let d=0,f=0;de.height){const d=[];for(let h=0,g=(e.height-1)*e.width;h=e.width?!1:t.nodeAt(e.map[g+h]).type==l.header_cell;d.push(m?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,R.from(d)),p=[];for(let h=e.height;h{if(!i)return!1;const s=t.selection;if(s instanceof de)return _s(t,r,te.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=qg(i,n,e);if(o==null)return!1;if(n=="horiz")return _s(t,r,te.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=Pg(a,n,e);let c;return l?c=te.near(l,1):e<0?c=te.near(t.doc.resolve(a.before(-1)),-1):c=te.near(t.doc.resolve(a.after(-1)),1),_s(t,r,c)}}}function ss(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof de)o=s;else{const l=qg(i,n,e);if(l==null)return!1;o=new de(t.doc.resolve(l))}const a=Pg(o.$headCell,n,e);return a?_s(t,r,new de(o.$anchorCell,a)):!1}}function as(n,e){const t=n.selection;if(!(t instanceof de))return!1;if(e){const r=n.tr,i=Je(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new F(i,0,0))}),r.docChanged&&e(r)}return!0}function WC(n,e){const t=n.state.doc,r=Jr(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new de(r))),!0):!1}function GC(n,e,t){if(!Rt(n.state))return!1;let r=zC(t);const i=n.state.selection;if(i instanceof de){r||(r={width:1,height:1,rows:[R.from(Ol(Je(n.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Te.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=qC(r,a.right-a.left,a.bottom-a.top),Yd(n.state,n.dispatch,o,a,r),!0}else if(r){const s=Ho(n.state),o=s.start(-1);return Yd(n.state,n.dispatch,o,Te.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function ZC(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Xd(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof de)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Jr(n.state.selection.$anchor))!=null&&((t=Na(n,e))==null?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,c){let u=Na(n,c);const d=mn.getState(n.state)==null;if(!u||!_c(l,u))if(d)u=l;else return;const f=new de(l,u);if(d||!n.state.selection.eq(f)){const p=n.state.tr.setSelection(f);d&&p.setMeta(mn,l.pos),n.dispatch(p)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",a),mn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(mn,-1))}function a(l){const c=l,u=mn.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(Xd(n,c.target)!=r&&(d=Na(n,e),!d))return o();d&&s(d,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",a)}function qg(n,e,t){if(!(n.state.selection instanceof Y))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function Xd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Na(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Jr(n.state.doc.resolve(t.pos)):null}var jC=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ll(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Ll(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ll(n,e,t,r,i,s){var o;let a=0,l=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;dnew t(a,e,l),new Ms(-1,!1)},apply(s,o){return o.apply(s)}},props:{attributes:s=>{const o=kt.getState(s);return o&&o.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,o)=>{YC(s,o,n,e,r)},mouseleave:s=>{XC(s)},mousedown:(s,o)=>{QC(s,o,e)}},decorations:s=>{const o=kt.getState(s);if(o&&o.activeHandle>-1)return sS(s,o.activeHandle)},nodeViews:{}}});return i}var Ms=class{constructor(n,e){this.activeHandle=n,this.dragging=e}apply(n){const e=this,t=n.getMeta(kt);if(t&&t.setHandle!=null)return new Ms(t.setHandle,!1);if(t&&t.setDragging!==void 0)return new Ms(e.activeHandle,t.setDragging);if(e.activeHandle>-1&&n.docChanged){let r=n.mapping.map(e.activeHandle,-1);return Nl(n.doc.resolve(r))||(r=-1),new Ms(r,e.dragging)}return e}};function YC(n,e,t,r,i){const s=kt.getState(n.state);if(s&&!s.dragging){const o=tS(e.target);let a=-1;if(o){const{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=Qd(n,e,"left",t):c-e.clientX<=t&&(a=Qd(n,e,"right",t))}if(a!=s.activeHandle){if(!i&&a!==-1){const l=n.state.doc.resolve(a),c=l.node(-1),u=Te.get(c),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}Ug(n,a)}}}function XC(n){const e=kt.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Ug(n,-1)}function QC(n,e,t){const r=kt.getState(n.state);if(!r||r.activeHandle==-1||r.dragging)return!1;const i=n.state.doc.nodeAt(r.activeHandle),s=eS(n,r.activeHandle,i.attrs);n.dispatch(n.state.tr.setMeta(kt,{setDragging:{startX:e.clientX,startWidth:s}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);const c=kt.getState(n.state);c!=null&&c.dragging&&(nS(n,c.activeHandle,ef(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(kt,{setDragging:null})))}function a(l){if(!l.which)return o(l);const c=kt.getState(n.state);if(c&&c.dragging){const u=ef(c.dragging,l,t);rS(n,c.activeHandle,u,t)}}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function eS(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,l=t;if(r)for(let c=0;c0?-1:0;DC(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o0&&i0&&e.map[a-1]==l||i0?-1:0;uS(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c0&&i0&&u==e.map[c-e.width]){const d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,{...d,rowspan:d.rowspan-1}),l+=d.colspan-1}else if(i0&&t[s]==t[s-1]||r.right0&&t[i]==t[i-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function mS(n){return(e,t)=>{var r;const i=e.selection;let s,o;if(i instanceof de){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(s=OC(i.$from),!s)return!1;o=(r=Jr(i.$from))==null?void 0:r.pos}if(s==null||o==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Yt(e),d=e.tr;for(let p=0;p{o.attrs[n]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function yS(n){return function(e,t){if(!Rt(e))return!1;if(t){const r=Je(e.schema),i=Yt(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l{const h=p+s.tableStart,g=o.doc.nodeAt(h);g&&o.setNodeMarkup(h,f,g.attrs)}),r(o)}return!0}}Li("row",{useDeprecatedLogic:!0});Li("column",{useDeprecatedLogic:!0});var vS=Li("cell",{useDeprecatedLogic:!0});function wS(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function ES({allowTableNodeSelection:n=!1}={}){return new Ce({key:mn,state:{init(){return null},apply(e,t){const r=e.getMeta(mn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:IC,handleDOMEvents:{mousedown:ZC},createSelectionBetween(e){return mn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:WC,handleKeyDown:KC,handlePaste:GC},appendTransaction(e,t,r){return PC(r,Vg(r,t),n)}})}function af(n,e,t,r,i,s){let o=0,a=!0,l=e.firstChild;const c=n.firstChild;for(let u=0,d=0;u{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function SS(n,e,t,r,i){const s=CS(n),o=[],a=[];for(let c=0;c{const{selection:e}=n.state;if(!_S(e))return!1;let t=0;const r=ng(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},MS=ae.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:xS,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({HTMLAttributes:n}){return["table",fe(this.options.HTMLAttributes,n),["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=SS(s.schema,n,e,t);if(i){const a=r.selection.anchor+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Y.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>oS(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>aS(n,e),deleteColumn:()=>({state:n,dispatch:e})=>cS(n,e),addRowBefore:()=>({state:n,dispatch:e})=>dS(n,e),addRowAfter:()=>({state:n,dispatch:e})=>fS(n,e),deleteRow:()=>({state:n,dispatch:e})=>hS(n,e),deleteTable:()=>({state:n,dispatch:e})=>kS(n,e),mergeCells:()=>({state:n,dispatch:e})=>nf(n,e),splitCell:()=>({state:n,dispatch:e})=>rf(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Li("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Li("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>vS(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>nf(n,e)?!0:rf(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>bS(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>of(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>of(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Vg(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=de.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ls,"Mod-Backspace":ls,Delete:ls,"Mod-Delete":ls}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[JC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],ES({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:re(W(n,"tableRole",e))}}}),AS=ae.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",fe(this.options.HTMLAttributes,n),0]}}),TS=ae.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",fe(this.options.HTMLAttributes,n),0]}}),NS=ae.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",fe(this.options.HTMLAttributes,n),0]}}),OS=ke.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize"}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;return((n==null?void 0:n.mode)||this.options.mode)==="textSize"?e.textBetween(0,e.content.size,void 0," ").length:e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;return e.textBetween(0,e.content.size," "," ").split(" ").filter(i=>i!=="").length}},addProseMirrorPlugins(){return[new Ce({key:new _e("characterCount"),filterTransaction:(n,e)=>{const t=this.options.limit;if(!n.docChanged||t===0||t===null||t===void 0)return!0;const r=this.storage.characters({node:e.doc}),i=this.storage.characters({node:n.doc});if(i<=t||r>t&&i>t&&i<=r)return!0;if(r>t&&i>t&&i>r||!n.getMeta("paste"))return!1;const o=n.selection.$head.pos,a=i-t,l=o-a,c=o;return n.deleteRange(l,c),!(this.storage.characters({node:n.doc})>t)}})]}}),LS="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",RS="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو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",Kr=(n,e)=>{for(const t in e)n[t]=e[t];return n},Rl="numeric",Dl="ascii",Il="alpha",As="asciinumeric",cs="alphanumeric",Bl="domain",Gg="emoji",DS="scheme",IS="slashscheme",cf="whitespace";function BS(n,e){return n in e||(e[n]=[]),e[n]}function qn(n,e,t){e[Rl]&&(e[As]=!0,e[cs]=!0),e[Dl]&&(e[As]=!0,e[Il]=!0),e[As]&&(e[cs]=!0),e[Il]&&(e[cs]=!0),e[cs]&&(e[Bl]=!0),e[Gg]&&(e[Bl]=!0);for(const r in e){const i=BS(r,t);i.indexOf(n)<0&&i.push(n)}}function HS(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function at(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}at.groups={};at.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,i),vt=(n,e,t,r,i)=>n.tr(e,t,r,i),uf=(n,e,t,r,i)=>n.ts(e,t,r,i),B=(n,e,t,r,i)=>n.tt(e,t,r,i),tn="WORD",Hl="UWORD",Ri="LOCALHOST",Pl="TLD",$l="UTLD",Ts="SCHEME",xr="SLASH_SCHEME",Mc="NUM",Zg="WS",Ac="NL",Ar="OPENBRACE",bi="OPENBRACKET",yi="OPENANGLEBRACKET",vi="OPENPAREN",$n="CLOSEBRACE",Tr="CLOSEBRACKET",Nr="CLOSEANGLEBRACKET",Fn="CLOSEPAREN",Ys="AMPERSAND",Xs="APOSTROPHE",Qs="ASTERISK",pn="AT",eo="BACKSLASH",to="BACKTICK",no="CARET",bn="COLON",Tc="COMMA",ro="DOLLAR",Ht="DOT",io="EQUALS",Nc="EXCLAMATION",Pt="HYPHEN",so="PERCENT",oo="PIPE",ao="PLUS",lo="POUND",co="QUERY",Oc="QUOTE",Lc="SEMI",$t="SLASH",wi="TILDE",uo="UNDERSCORE",jg="EMOJI",fo="SYM";var Jg=Object.freeze({__proto__:null,WORD:tn,UWORD:Hl,LOCALHOST:Ri,TLD:Pl,UTLD:$l,SCHEME:Ts,SLASH_SCHEME:xr,NUM:Mc,WS:Zg,NL:Ac,OPENBRACE:Ar,OPENBRACKET:bi,OPENANGLEBRACKET:yi,OPENPAREN:vi,CLOSEBRACE:$n,CLOSEBRACKET:Tr,CLOSEANGLEBRACKET:Nr,CLOSEPAREN:Fn,AMPERSAND:Ys,APOSTROPHE:Xs,ASTERISK:Qs,AT:pn,BACKSLASH:eo,BACKTICK:to,CARET:no,COLON:bn,COMMA:Tc,DOLLAR:ro,DOT:Ht,EQUALS:io,EXCLAMATION:Nc,HYPHEN:Pt,PERCENT:so,PIPE:oo,PLUS:ao,POUND:lo,QUERY:co,QUOTE:Oc,SEMI:Lc,SLASH:$t,TILDE:wi,UNDERSCORE:uo,EMOJI:jg,SYM:fo});const mr=/[a-z]/,Oa=/\p{L}/u,La=/\p{Emoji}/u,Ra=/\d/,df=/\s/,ff=` -`,PS="️",$S="‍";let us=null,ds=null;function FS(n){n===void 0&&(n=[]);const e={};at.groups=e;const t=new at;us==null&&(us=pf(LS)),ds==null&&(ds=pf(RS)),B(t,"'",Xs),B(t,"{",Ar),B(t,"[",bi),B(t,"<",yi),B(t,"(",vi),B(t,"}",$n),B(t,"]",Tr),B(t,">",Nr),B(t,")",Fn),B(t,"&",Ys),B(t,"*",Qs),B(t,"@",pn),B(t,"`",to),B(t,"^",no),B(t,":",bn),B(t,",",Tc),B(t,"$",ro),B(t,".",Ht),B(t,"=",io),B(t,"!",Nc),B(t,"-",Pt),B(t,"%",so),B(t,"|",oo),B(t,"+",ao),B(t,"#",lo),B(t,"?",co),B(t,'"',Oc),B(t,"/",$t),B(t,";",Lc),B(t,"~",wi),B(t,"_",uo),B(t,"\\",eo);const r=vt(t,Ra,Mc,{[Rl]:!0});vt(r,Ra,r);const i=vt(t,mr,tn,{[Dl]:!0});vt(i,mr,i);const s=vt(t,Oa,Hl,{[Il]:!0});vt(s,mr),vt(s,Oa,s);const o=vt(t,df,Zg,{[cf]:!0});B(t,ff,Ac,{[cf]:!0}),B(o,ff),vt(o,df,o);const a=vt(t,La,jg,{[Gg]:!0});vt(a,La,a),B(a,PS,a);const l=B(a,$S);vt(l,La,a);const c=[[mr,i]],u=[[mr,null],[Oa,s]];for(let d=0;dd[0]>f[0]?1:-1);for(let d=0;d=0?h[Bl]=!0:mr.test(f)?Ra.test(f)?h[As]=!0:h[Dl]=!0:h[Rl]=!0,uf(t,f,f,h)}return uf(t,"localhost",Ri,{ascii:!0}),t.jd=new at(fo),{start:t,tokens:Kr({groups:e},Jg)}}function zS(n,e){const t=VS(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o=0&&(d+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function VS(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function cn(n,e,t,r,i){let s;const o=e.length;for(let a=0;a=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Di={defaultProtocol:"http",events:null,format:hf,formatHref:hf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Rc(n,e){e===void 0&&(e=null);let t=Kr({},Di);n&&(t=Kr(t,n instanceof Rc?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;st?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=Di.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Kr(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Po(n,e){class t extends Yg{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const gf=Po("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),mf=Po("text"),qS=Po("nl"),In=Po("url",{isLink:!0,toHref(n){return n===void 0&&(n=Di.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ri&&n[1].t===bn}}),Be=n=>new at(n);function US(n){let{groups:e}=n;const t=e.domain.concat([Ys,Qs,pn,eo,to,no,ro,io,Pt,Mc,so,oo,ao,lo,$t,fo,wi,uo]),r=[Xs,Nr,$n,Tr,Fn,bn,Tc,Ht,Nc,yi,Ar,bi,vi,co,Oc,Lc],i=[Ys,Xs,Qs,eo,to,no,$n,ro,io,Pt,Ar,so,oo,ao,lo,co,$t,fo,wi,uo],s=Be(),o=B(s,wi);J(o,i,o),J(o,e.domain,o);const a=Be(),l=Be(),c=Be();J(s,e.domain,a),J(s,e.scheme,l),J(s,e.slashscheme,c),J(a,i,o),J(a,e.domain,a);const u=B(a,pn);B(o,pn,u),B(l,pn,u),B(c,pn,u);const d=B(o,Ht);J(d,i,o),J(d,e.domain,o);const f=Be();J(u,e.domain,f),J(f,e.domain,f);const p=B(f,Ht);J(p,e.domain,f);const h=Be(gf);J(p,e.tld,h),J(p,e.utld,h),B(u,Ri,h);const g=B(f,Pt);J(g,e.domain,f),J(h,e.domain,f),B(h,Ht,p),B(h,Pt,g);const m=B(h,bn);J(m,e.numeric,gf);const v=B(a,Pt),y=B(a,Ht);J(v,e.domain,a),J(y,i,o),J(y,e.domain,a);const k=Be(In);J(y,e.tld,k),J(y,e.utld,k),J(k,e.domain,a),J(k,i,o),B(k,Ht,y),B(k,Pt,v),B(k,pn,u);const b=B(k,bn),x=Be(In);J(b,e.numeric,x);const w=Be(In),S=Be();J(w,t,w),J(w,r,S),J(S,t,w),J(S,r,S),B(k,$t,w),B(x,$t,w);const A=B(l,bn),M=B(c,bn),L=B(M,$t),z=B(L,$t);J(l,e.domain,a),B(l,Ht,y),B(l,Pt,v),J(c,e.domain,a),B(c,Ht,y),B(c,Pt,v),J(A,e.domain,w),B(A,$t,w),J(z,e.domain,w),J(z,t,w),B(z,$t,w);const q=B(w,Ar),U=B(w,bi),T=B(w,yi),H=B(w,vi);B(S,Ar,q),B(S,bi,U),B(S,yi,T),B(S,vi,H),B(q,$n,w),B(U,Tr,w),B(T,Nr,w),B(H,Fn,w),B(q,$n,w);const C=Be(In),E=Be(In),_=Be(In),D=Be(In);J(q,t,C),J(U,t,E),J(T,t,_),J(H,t,D);const P=Be(),G=Be(),Q=Be(),pe=Be();return J(q,r),J(U,r),J(T,r),J(H,r),J(C,t,C),J(E,t,E),J(_,t,_),J(D,t,D),J(C,r,C),J(E,r,E),J(_,r,_),J(D,r,D),J(P,t,P),J(G,t,E),J(Q,t,_),J(pe,t,D),J(P,r,P),J(G,r,G),J(Q,r,Q),J(pe,r,pe),B(E,Tr,w),B(_,Nr,w),B(D,Fn,w),B(C,$n,w),B(G,Tr,w),B(Q,Nr,w),B(pe,Fn,w),B(P,Fn,w),B(s,Ri,k),B(s,Ac,qS),{start:s,tokens:Jg}}function KS(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i=0&&f++,i++,u++;if(f<0)i-=u,i0&&(s.push(Da(mf,e,o)),o=[]),i-=f,u-=f;const p=d.t,h=t.slice(i-u,i);s.push(Da(p,e,h))}}return o.length>0&&s.push(Da(mf,e,o)),s}function Da(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const WS=typeof console<"u"&&console&&console.warn||(()=>{}),GS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ae={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ZS(){at.groups={},Ae.scanner=null,Ae.parser=null,Ae.tokenQueue=[],Ae.pluginQueue=[],Ae.customSchemes=[],Ae.initialized=!1}function bf(n,e){if(e===void 0&&(e=!1),Ae.initialized&&WS(`linkifyjs: already initialized - will not register custom scheme "${n}" ${GS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. + `,$g(e,n.editor.view.dom,o=>n.editor.commands.updateAttributes("image",o)),{dom:e}}},addProseMirrorPlugins(){const n=this.editor;return[new Ce({key:jd,state:{init:()=>we.empty,apply:(e,t)=>{const r=e.getMeta(si);if(r){let i=!1;const s=t.map(e.mapping,e.doc,{onRemove:o=>{i=!0}});i||(t=s),r.type==="add"?t=t.add(e.doc,[Pg(r)]):r.type==="remove"&&(t=t.remove(t.find(void 0,void 0,o=>o.id==r.id)))}return t}},props:{decorations(e){return this.getState(e)},handlePaste:(e,t)=>{var i;const r=Array.from(((i=t.clipboardData)==null?void 0:i.items)||[]);for(const s of r)if(s.type.indexOf("image")===0){t.preventDefault();const o=s.getAsFile();o&&this.editor.commands.uploadImage(o)}},handleDOMEvents:{drop(e,t){if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const i=Array.from(t.dataTransfer.files).filter(c=>/image/i.test(c.type));if(i.length===0)return!1;t.preventDefault();const{state:{tr:s,doc:o},dispatch:a}=e,l=e.posAtCoords({left:t.clientX,top:t.clientY});return a(s.setSelection(Y.create(o,l.pos)).scrollIntoView()),i.forEach(c=>{n.commands.uploadImage(c)}),!0}}}})]}});var Ll,Rl;if(typeof WeakMap<"u"){let n=new WeakMap;Ll=e=>n.get(e),Rl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Ll=r=>{for(let i=0;i(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Te=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-k});break}const b=i+k*e;for(let E=0;Er&&(s+=c.attrs.colspan)}}for(let o=0;o1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function OC(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function RC(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Rt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $o(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Yr(e.$head)||DC(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function DC(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Dl(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function IC(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Tc(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Fg(n,e,t){const r=n.node(-1),i=Te.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function or(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function zg(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;ic!=e.pos-i);a.unshift(e.pos-i);const l=a.map(c=>{const u=t.nodeAt(c);if(!u)throw RangeError(`No cell with offset ${c} found`);const d=i+c+1;return new dh(o.resolve(d),o.resolve(d+u.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=n,this.$headCell=e}map(n,e){const t=n.resolve(e.map(this.$anchorCell.pos)),r=n.resolve(e.map(this.$headCell.pos));if(Dl(t)&&Dl(r)&&Tc(t,r)){const i=this.$anchorCell.node(-1)!=t.node(-1);return i&&this.isRowSelection()?de.rowSelection(t,r):i&&this.isColSelection()?de.colSelection(t,r):new de(t,r)}return Y.between(t,r)}content(){const n=this.$anchorCell.node(-1),e=Te.get(n),t=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-t,this.$headCell.pos-t),i={},s=[];for(let a=r.top;a0||g>0){let m=p.attrs;if(h>0&&(m=or(m,0,h)),g>0&&(m=or(m,m.colspan-g,g)),f.leftr.bottom){const m={...p.attrs,rowspan:Math.min(f.bottom,r.bottom)-Math.max(f.top,r.top)};f.top0)return!1;const t=n+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(t,r)==this.$headCell.node(-1).childCount}static colSelection(n,e=n){const t=n.node(-1),r=Te.get(t),i=n.start(-1),s=r.findCell(n.pos-i),o=r.findCell(e.pos-i),a=n.node(0);return s.top<=o.top?(s.top>0&&(n=a.resolve(i+r.map[s.left])),o.bottom0&&(e=a.resolve(i+r.map[o.left])),s.bottom0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,o)==e.width}eq(n){return n instanceof de&&n.$anchorCell.pos==this.$anchorCell.pos&&n.$headCell.pos==this.$headCell.pos}static rowSelection(n,e=n){const t=n.node(-1),r=Te.get(t),i=n.start(-1),s=r.findCell(n.pos-i),o=r.findCell(e.pos-i),a=n.node(0);return s.left<=o.left?(s.left>0&&(n=a.resolve(i+r.map[s.top*r.width])),o.right0&&(e=a.resolve(i+r.map[o.top*r.width])),s.right{e.push(Ie.node(r,r+t.nodeSize,{class:"selectedCell"}))}),we.create(n.doc,e)}function PC({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(i+1)=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function $C({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function FC(n,e,t){const r=(e||n).selection,i=(e||n).doc;let s,o;if(r instanceof X&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=de.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=de.rowSelection(a,a)}else if(!t){const a=Te.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];s=de.create(i,l+1,c)}}else r instanceof Y&&PC(r)?s=Y.create(i,r.from):r instanceof Y&&$C(r)&&(s=Y.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var zC=new _e("fix-tables");function qg(n,e,t,r){const i=n.childCount,s=e.childCount;e:for(let o=0,a=0;o{i.type.spec.tableRole=="table"&&(t=VC(n,i,s,t))};return e?e.doc!=n.doc&&qg(e.doc,n.doc,0,r):n.doc.descendants(r),t}function VC(n,e,t,r){const i=Te.get(e);if(!i.problems)return r;r||(r=n.tr);const s=[];for(let l=0;l0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const h=[];for(let m=0;m0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c=e.length&&e.push(R.empty),t[i]r&&(f=f.type.createChecked(or(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;pi&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(R.from(l))}t=s,e=i}return{width:n,height:e,rows:t}}function WC(n,e,t,r,i,s,o){const a=n.doc.type.schema,l=Je(a);let c,u;if(i>e.width)for(let d=0,f=0;de.height){const d=[];for(let h=0,g=(e.height-1)*e.width;h=e.width?!1:t.nodeAt(e.map[g+h]).type==l.header_cell;d.push(m?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,R.from(d)),p=[];for(let h=e.height;h{if(!i)return!1;const s=t.selection;if(s instanceof de)return Ms(t,r,te.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=Kg(i,n,e);if(o==null)return!1;if(n=="horiz")return Ms(t,r,te.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=Fg(a,n,e);let c;return l?c=te.near(l,1):e<0?c=te.near(t.doc.resolve(a.before(-1)),-1):c=te.near(t.doc.resolve(a.after(-1)),1),Ms(t,r,c)}}}function ss(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof de)o=s;else{const l=Kg(i,n,e);if(l==null)return!1;o=new de(t.doc.resolve(l))}const a=Fg(o.$headCell,n,e);return a?Ms(t,r,new de(o.$anchorCell,a)):!1}}function as(n,e){const t=n.selection;if(!(t instanceof de))return!1;if(e){const r=n.tr,i=Je(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new F(i,0,0))}),r.docChanged&&e(r)}return!0}function GC(n,e){const t=n.state.doc,r=Yr(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new de(r))),!0):!1}function jC(n,e,t){if(!Rt(n.state))return!1;let r=qC(t);const i=n.state.selection;if(i instanceof de){r||(r={width:1,height:1,rows:[R.from(Il(Je(n.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Te.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=KC(r,a.right-a.left,a.bottom-a.top),Xd(n.state,n.dispatch,o,a,r),!0}else if(r){const s=$o(n.state),o=s.start(-1);return Xd(n.state,n.dispatch,o,Te.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function JC(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Qd(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof de)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Yr(n.state.selection.$anchor))!=null&&((t=Da(n,e))==null?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,c){let u=Da(n,c);const d=mn.getState(n.state)==null;if(!u||!Tc(l,u))if(d)u=l;else return;const f=new de(l,u);if(d||!n.state.selection.eq(f)){const p=n.state.tr.setSelection(f);d&&p.setMeta(mn,l.pos),n.dispatch(p)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",a),mn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(mn,-1))}function a(l){const c=l,u=mn.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(Qd(n,c.target)!=r&&(d=Da(n,e),!d))return o();d&&s(d,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",a)}function Kg(n,e,t){if(!(n.state.selection instanceof Y))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function Qd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Da(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Yr(n.state.doc.resolve(t.pos)):null}var YC=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Bl(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Bl(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Bl(n,e,t,r,i,s){var o;let a=0,l=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;dnew t(a,e,l),new As(-1,!1)},apply(s,o){return o.apply(s)}},props:{attributes:s=>{const o=kt.getState(s);return o&&o.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,o)=>{QC(s,o,n,e,r)},mouseleave:s=>{eS(s)},mousedown:(s,o)=>{tS(s,o,e)}},decorations:s=>{const o=kt.getState(s);if(o&&o.activeHandle>-1)return aS(s,o.activeHandle)},nodeViews:{}}});return i}var As=class{constructor(n,e){this.activeHandle=n,this.dragging=e}apply(n){const e=this,t=n.getMeta(kt);if(t&&t.setHandle!=null)return new As(t.setHandle,!1);if(t&&t.setDragging!==void 0)return new As(e.activeHandle,t.setDragging);if(e.activeHandle>-1&&n.docChanged){let r=n.mapping.map(e.activeHandle,-1);return Dl(n.doc.resolve(r))||(r=-1),new As(r,e.dragging)}return e}};function QC(n,e,t,r,i){const s=kt.getState(n.state);if(s&&!s.dragging){const o=rS(e.target);let a=-1;if(o){const{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=ef(n,e,"left",t):c-e.clientX<=t&&(a=ef(n,e,"right",t))}if(a!=s.activeHandle){if(!i&&a!==-1){const l=n.state.doc.resolve(a),c=l.node(-1),u=Te.get(c),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}Wg(n,a)}}}function eS(n){const e=kt.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Wg(n,-1)}function tS(n,e,t){const r=kt.getState(n.state);if(!r||r.activeHandle==-1||r.dragging)return!1;const i=n.state.doc.nodeAt(r.activeHandle),s=nS(n,r.activeHandle,i.attrs);n.dispatch(n.state.tr.setMeta(kt,{setDragging:{startX:e.clientX,startWidth:s}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);const c=kt.getState(n.state);c!=null&&c.dragging&&(iS(n,c.activeHandle,tf(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(kt,{setDragging:null})))}function a(l){if(!l.which)return o(l);const c=kt.getState(n.state);if(c&&c.dragging){const u=tf(c.dragging,l,t);sS(n,c.activeHandle,u,t)}}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function nS(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,l=t;if(r)for(let c=0;c0?-1:0;BC(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o0&&i0&&e.map[a-1]==l||i0?-1:0;fS(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c0&&i0&&u==e.map[c-e.width]){const d=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,{...d,rowspan:d.rowspan-1}),l+=d.colspan-1}else if(i0&&t[s]==t[s-1]||r.right0&&t[i]==t[i-n]||r.bottomt[r.type.spec.tableRole])(n,e)}function yS(n){return(e,t)=>{var r;const i=e.selection;let s,o;if(i instanceof de){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(s=RC(i.$from),!s)return!1;o=(r=Yr(i.$from))==null?void 0:r.pos}if(s==null||o==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Yt(e),d=e.tr;for(let p=0;p{o.attrs[n]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function wS(n){return function(e,t){if(!Rt(e))return!1;if(t){const r=Je(e.schema),i=Yt(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l{const h=p+s.tableStart,g=o.doc.nodeAt(h);g&&o.setNodeMarkup(h,f,g.attrs)}),r(o)}return!0}}Li("row",{useDeprecatedLogic:!0});Li("column",{useDeprecatedLogic:!0});var kS=Li("cell",{useDeprecatedLogic:!0});function xS(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function CS({allowTableNodeSelection:n=!1}={}){return new Ce({key:mn,state:{init(){return null},apply(e,t){const r=e.getMeta(mn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:HC,handleDOMEvents:{mousedown:JC},createSelectionBetween(e){return mn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:GC,handleKeyDown:ZC,handlePaste:jC},appendTransaction(e,t,r){return FC(r,Ug(r,t),n)}})}function lf(n,e,t,r,i,s){let o=0,a=!0,l=e.firstChild;const c=n.firstChild;for(let u=0,d=0;u{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function MS(n,e,t,r,i){const s=_S(n),o=[],a=[];for(let c=0;c{const{selection:e}=n.state;if(!AS(e))return!1;let t=0;const r=rg(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},TS=ae.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:SS,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({HTMLAttributes:n}){return["table",fe(this.options.HTMLAttributes,n),["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=MS(s.schema,n,e,t);if(i){const a=r.selection.anchor+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Y.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>lS(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>cS(n,e),deleteColumn:()=>({state:n,dispatch:e})=>dS(n,e),addRowBefore:()=>({state:n,dispatch:e})=>pS(n,e),addRowAfter:()=>({state:n,dispatch:e})=>hS(n,e),deleteRow:()=>({state:n,dispatch:e})=>mS(n,e),deleteTable:()=>({state:n,dispatch:e})=>ES(n,e),mergeCells:()=>({state:n,dispatch:e})=>rf(n,e),splitCell:()=>({state:n,dispatch:e})=>sf(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Li("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Li("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>kS(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>rf(n,e)?!0:sf(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>vS(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>af(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>af(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Ug(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=de.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ls,"Mod-Backspace":ls,Delete:ls,"Mod-Delete":ls}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[XC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],CS({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:ie(W(n,"tableRole",e))}}}),NS=ae.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",fe(this.options.HTMLAttributes,n),0]}}),OS=ae.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",fe(this.options.HTMLAttributes,n),0]}}),LS=ae.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",fe(this.options.HTMLAttributes,n),0]}}),RS=ke.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize"}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;return((n==null?void 0:n.mode)||this.options.mode)==="textSize"?e.textBetween(0,e.content.size,void 0," ").length:e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;return e.textBetween(0,e.content.size," "," ").split(" ").filter(i=>i!=="").length}},addProseMirrorPlugins(){return[new Ce({key:new _e("characterCount"),filterTransaction:(n,e)=>{const t=this.options.limit;if(!n.docChanged||t===0||t===null||t===void 0)return!0;const r=this.storage.characters({node:e.doc}),i=this.storage.characters({node:n.doc});if(i<=t||r>t&&i>t&&i<=r)return!0;if(r>t&&i>t&&i>r||!n.getMeta("paste"))return!1;const o=n.selection.$head.pos,a=i-t,l=o-a,c=o;return n.deleteRange(l,c),!(this.storage.characters({node:n.doc})>t)}})]}}),DS="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",IS="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو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",Wr=(n,e)=>{for(const t in e)n[t]=e[t];return n},Hl="numeric",Pl="ascii",$l="alpha",Ts="asciinumeric",cs="alphanumeric",Fl="domain",jg="emoji",BS="scheme",HS="slashscheme",uf="whitespace";function PS(n,e){return n in e||(e[n]=[]),e[n]}function qn(n,e,t){e[Hl]&&(e[Ts]=!0,e[cs]=!0),e[Pl]&&(e[Ts]=!0,e[$l]=!0),e[Ts]&&(e[cs]=!0),e[$l]&&(e[cs]=!0),e[cs]&&(e[Fl]=!0),e[jg]&&(e[Fl]=!0);for(const r in e){const i=PS(r,t);i.indexOf(n)<0&&i.push(n)}}function $S(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function at(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}at.groups={};at.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,i),vt=(n,e,t,r,i)=>n.tr(e,t,r,i),df=(n,e,t,r,i)=>n.ts(e,t,r,i),B=(n,e,t,r,i)=>n.tt(e,t,r,i),tn="WORD",zl="UWORD",Ri="LOCALHOST",Vl="TLD",ql="UTLD",Ns="SCHEME",Er="SLASH_SCHEME",Nc="NUM",Jg="WS",Oc="NL",Ar="OPENBRACE",yi="OPENBRACKET",vi="OPENANGLEBRACKET",wi="OPENPAREN",$n="CLOSEBRACE",Tr="CLOSEBRACKET",Nr="CLOSEANGLEBRACKET",Fn="CLOSEPAREN",Xs="AMPERSAND",Qs="APOSTROPHE",eo="ASTERISK",pn="AT",to="BACKSLASH",no="BACKTICK",ro="CARET",bn="COLON",Lc="COMMA",io="DOLLAR",Ht="DOT",so="EQUALS",Rc="EXCLAMATION",Pt="HYPHEN",oo="PERCENT",ao="PIPE",lo="PLUS",co="POUND",uo="QUERY",Dc="QUOTE",Ic="SEMI",$t="SLASH",ki="TILDE",fo="UNDERSCORE",Yg="EMOJI",po="SYM";var Xg=Object.freeze({__proto__:null,WORD:tn,UWORD:zl,LOCALHOST:Ri,TLD:Vl,UTLD:ql,SCHEME:Ns,SLASH_SCHEME:Er,NUM:Nc,WS:Jg,NL:Oc,OPENBRACE:Ar,OPENBRACKET:yi,OPENANGLEBRACKET:vi,OPENPAREN:wi,CLOSEBRACE:$n,CLOSEBRACKET:Tr,CLOSEANGLEBRACKET:Nr,CLOSEPAREN:Fn,AMPERSAND:Xs,APOSTROPHE:Qs,ASTERISK:eo,AT:pn,BACKSLASH:to,BACKTICK:no,CARET:ro,COLON:bn,COMMA:Lc,DOLLAR:io,DOT:Ht,EQUALS:so,EXCLAMATION:Rc,HYPHEN:Pt,PERCENT:oo,PIPE:ao,PLUS:lo,POUND:co,QUERY:uo,QUOTE:Dc,SEMI:Ic,SLASH:$t,TILDE:ki,UNDERSCORE:fo,EMOJI:Yg,SYM:po});const mr=/[a-z]/,Ia=/\p{L}/u,Ba=/\p{Emoji}/u,Ha=/\d/,ff=/\s/,pf=` +`,FS="️",zS="‍";let us=null,ds=null;function VS(n){n===void 0&&(n=[]);const e={};at.groups=e;const t=new at;us==null&&(us=hf(DS)),ds==null&&(ds=hf(IS)),B(t,"'",Qs),B(t,"{",Ar),B(t,"[",yi),B(t,"<",vi),B(t,"(",wi),B(t,"}",$n),B(t,"]",Tr),B(t,">",Nr),B(t,")",Fn),B(t,"&",Xs),B(t,"*",eo),B(t,"@",pn),B(t,"`",no),B(t,"^",ro),B(t,":",bn),B(t,",",Lc),B(t,"$",io),B(t,".",Ht),B(t,"=",so),B(t,"!",Rc),B(t,"-",Pt),B(t,"%",oo),B(t,"|",ao),B(t,"+",lo),B(t,"#",co),B(t,"?",uo),B(t,'"',Dc),B(t,"/",$t),B(t,";",Ic),B(t,"~",ki),B(t,"_",fo),B(t,"\\",to);const r=vt(t,Ha,Nc,{[Hl]:!0});vt(r,Ha,r);const i=vt(t,mr,tn,{[Pl]:!0});vt(i,mr,i);const s=vt(t,Ia,zl,{[$l]:!0});vt(s,mr),vt(s,Ia,s);const o=vt(t,ff,Jg,{[uf]:!0});B(t,pf,Oc,{[uf]:!0}),B(o,pf),vt(o,ff,o);const a=vt(t,Ba,Yg,{[jg]:!0});vt(a,Ba,a),B(a,FS,a);const l=B(a,zS);vt(l,Ba,a);const c=[[mr,i]],u=[[mr,null],[Ia,s]];for(let d=0;dd[0]>f[0]?1:-1);for(let d=0;d=0?h[Fl]=!0:mr.test(f)?Ha.test(f)?h[Ts]=!0:h[Pl]=!0:h[Hl]=!0,df(t,f,f,h)}return df(t,"localhost",Ri,{ascii:!0}),t.jd=new at(po),{start:t,tokens:Wr({groups:e},Xg)}}function qS(n,e){const t=US(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o=0&&(d+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function US(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function cn(n,e,t,r,i){let s;const o=e.length;for(let a=0;a=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Di={defaultProtocol:"http",events:null,format:gf,formatHref:gf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Bc(n,e){e===void 0&&(e=null);let t=Wr({},Di);n&&(t=Wr(t,n instanceof Bc?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;st?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=Di.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Wr(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Fo(n,e){class t extends Qg{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const mf=Fo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bf=Fo("text"),KS=Fo("nl"),In=Fo("url",{isLink:!0,toHref(n){return n===void 0&&(n=Di.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ri&&n[1].t===bn}}),Be=n=>new at(n);function WS(n){let{groups:e}=n;const t=e.domain.concat([Xs,eo,pn,to,no,ro,io,so,Pt,Nc,oo,ao,lo,co,$t,po,ki,fo]),r=[Qs,Nr,$n,Tr,Fn,bn,Lc,Ht,Rc,vi,Ar,yi,wi,uo,Dc,Ic],i=[Xs,Qs,eo,to,no,ro,$n,io,so,Pt,Ar,oo,ao,lo,co,uo,$t,po,ki,fo],s=Be(),o=B(s,ki);J(o,i,o),J(o,e.domain,o);const a=Be(),l=Be(),c=Be();J(s,e.domain,a),J(s,e.scheme,l),J(s,e.slashscheme,c),J(a,i,o),J(a,e.domain,a);const u=B(a,pn);B(o,pn,u),B(l,pn,u),B(c,pn,u);const d=B(o,Ht);J(d,i,o),J(d,e.domain,o);const f=Be();J(u,e.domain,f),J(f,e.domain,f);const p=B(f,Ht);J(p,e.domain,f);const h=Be(mf);J(p,e.tld,h),J(p,e.utld,h),B(u,Ri,h);const g=B(f,Pt);J(g,e.domain,f),J(h,e.domain,f),B(h,Ht,p),B(h,Pt,g);const m=B(h,bn);J(m,e.numeric,mf);const v=B(a,Pt),y=B(a,Ht);J(v,e.domain,a),J(y,i,o),J(y,e.domain,a);const k=Be(In);J(y,e.tld,k),J(y,e.utld,k),J(k,e.domain,a),J(k,i,o),B(k,Ht,y),B(k,Pt,v),B(k,pn,u);const b=B(k,bn),E=Be(In);J(b,e.numeric,E);const w=Be(In),S=Be();J(w,t,w),J(w,r,S),J(S,t,w),J(S,r,S),B(k,$t,w),B(E,$t,w);const A=B(l,bn),M=B(c,bn),L=B(M,$t),z=B(L,$t);J(l,e.domain,a),B(l,Ht,y),B(l,Pt,v),J(c,e.domain,a),B(c,Ht,y),B(c,Pt,v),J(A,e.domain,w),B(A,$t,w),J(z,e.domain,w),J(z,t,w),B(z,$t,w);const q=B(w,Ar),U=B(w,yi),T=B(w,vi),H=B(w,wi);B(S,Ar,q),B(S,yi,U),B(S,vi,T),B(S,wi,H),B(q,$n,w),B(U,Tr,w),B(T,Nr,w),B(H,Fn,w),B(q,$n,w);const C=Be(In),x=Be(In),_=Be(In),D=Be(In);J(q,t,C),J(U,t,x),J(T,t,_),J(H,t,D);const P=Be(),Z=Be(),Q=Be(),pe=Be();return J(q,r),J(U,r),J(T,r),J(H,r),J(C,t,C),J(x,t,x),J(_,t,_),J(D,t,D),J(C,r,C),J(x,r,x),J(_,r,_),J(D,r,D),J(P,t,P),J(Z,t,x),J(Q,t,_),J(pe,t,D),J(P,r,P),J(Z,r,Z),J(Q,r,Q),J(pe,r,pe),B(x,Tr,w),B(_,Nr,w),B(D,Fn,w),B(C,$n,w),B(Z,Tr,w),B(Q,Nr,w),B(pe,Fn,w),B(P,Fn,w),B(s,Ri,k),B(s,Oc,KS),{start:s,tokens:Xg}}function ZS(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i=0&&f++,i++,u++;if(f<0)i-=u,i0&&(s.push(Pa(bf,e,o)),o=[]),i-=f,u-=f;const p=d.t,h=t.slice(i-u,i);s.push(Pa(p,e,h))}}return o.length>0&&s.push(Pa(bf,e,o)),s}function Pa(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const GS=typeof console<"u"&&console&&console.warn||(()=>{}),jS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ae={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function JS(){at.groups={},Ae.scanner=null,Ae.parser=null,Ae.tokenQueue=[],Ae.pluginQueue=[],Ae.customSchemes=[],Ae.initialized=!1}function yf(n,e){if(e===void 0&&(e=!1),Ae.initialized&&GS(`linkifyjs: already initialized - will not register custom scheme "${n}" ${jS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);Ae.customSchemes.push([n,e])}function jS(){Ae.scanner=FS(Ae.customSchemes);for(let n=0;n{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=wv(t.doc,[...e]);if(Mv(a).forEach(({newRange:c})=>{const u=Ev(r.doc,c,p=>p.isTextblock);let d,f;if(u.length>1?(d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")),d&&f){const p=f.split(" ").filter(m=>m!=="");if(p.length<=0)return!1;const h=p[p.length-1],g=d.pos+f.lastIndexOf(h);if(!h)return!1;Dc(h).filter(m=>m.isLink).map(m=>({...m,from:g+m.start+1,to:g+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate?n.validate(m.value):!0).forEach(m=>{fc(m.from,m.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function XS(n){return new Ce({key:new _e("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const a=rg(e.state,n.type.name),l=r.target,c=(i=l==null?void 0:l.href)!==null&&i!==void 0?i:a.href,u=(s=l==null?void 0:l.target)!==null&&s!==void 0?s:a.target;return l&&c?(e.editable&&window.open(c,u),!0):!1}}})}function QS(n){return new Ce({key:new _e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(h=>{l+=h.textContent});const c=Dc(l).find(h=>h.isLink&&h.value===l);if(!l||!c)return!1;const u=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),d=/href="([^"]*)"/,f=u==null?void 0:u.match(d),p=f?f[1]:c.href;return n.editor.commands.setMark(n.type,{href:p}),!0}}})}const e_=Le.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){bf(n);return}bf(n.scheme,n.optionalSlashes)})},onDestroy(){ZS()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){return["a",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Nn({find:n=>Dc(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),s=/href="([^"]*)"/,o=i==null?void 0:i.match(s);return o?{href:o[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(YS({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(XS({type:this.type})),this.options.linkOnPaste&&n.push(QS({editor:this.editor,type:this.type})),n}}),t_=Le.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),n_=Le.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),r_=ae.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:n}){return["ul",fe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),i_=/^\s*(\[([( |x])?\])\s$/,s_=ae.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return s.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=t(),p=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{i.setAttribute(c,u)}),i.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),s.append(a,o),i.append(s,l),Object.entries(e).forEach(([c,u])=>{i.setAttribute(c,u)}),{dom:i,contentDOM:l,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ir({find:i_,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var Ic={exports:{}};function Bc(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];typeof t=="object"&&!Object.isFrozen(t)&&Bc(t)}),n}Ic.exports=Bc;Ic.exports.default=Bc;let yf=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Xg(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function En(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const o_="",vf=n=>!!n.scope||n.sublanguage&&n.language,a_=(n,{prefix:e})=>{if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};let l_=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Xg(e)}openNode(e){if(!vf(e))return;let t="";e.sublanguage?t=`language-${e.language}`:t=a_(e.scope,{prefix:this.classPrefix}),this.span(t)}closeNode(e){vf(e)&&(this.buffer+=o_)}value(){return this.buffer}span(e){this.buffer+=``}};const wf=(n={})=>{const e={children:[]};return Object.assign(e,n),e};let c_=class Qg{constructor(){this.rootNode=wf(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=wf({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{Qg._collapse(t)}))}},u_=class extends c_{constructor(e){super(),this.options=e}addKeyword(e,t){e!==""&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){e!==""&&this.add(e)}addSublanguage(e,t){const r=e.root;r.sublanguage=!0,r.language=t,this.add(r)}toHTML(){return new l_(this,this.options).value()}finalize(){return!0}};function Ii(n){return n?typeof n=="string"?n:n.source:null}function em(n){return lr("(?=",n,")")}function d_(n){return lr("(?:",n,")*")}function f_(n){return lr("(?:",n,")?")}function lr(...n){return n.map(t=>Ii(t)).join("")}function p_(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Hc(...n){return"("+(p_(n).capture?"":"?:")+n.map(r=>Ii(r)).join("|")+")"}function tm(n){return new RegExp(n.toString()+"|").exec("").length-1}function h_(n,e){const t=n&&n.exec(e);return t&&t.index===0}const g_=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Pc(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=Ii(r),o="";for(;s.length>0;){const a=g_.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const m_=/\b\B/,nm="[a-zA-Z]\\w*",$c="[a-zA-Z_]\\w*",rm="\\b\\d+(\\.\\d+)?",im="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",sm="\\b(0b[01]+)",b_="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",y_=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=lr(e,/.*\b/,n.binary,/\b.*/)),En({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},Bi={begin:"\\\\[\\s\\S]",relevance:0},v_={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Bi]},w_={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Bi]},k_={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},$o=function(n,e,t={}){const r=En({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Hc("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:lr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},E_=$o("//","$"),x_=$o("/\\*","\\*/"),C_=$o("#","$"),S_={scope:"number",begin:rm,relevance:0},__={scope:"number",begin:im,relevance:0},M_={scope:"number",begin:sm,relevance:0},A_={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[Bi,{begin:/\[/,end:/\]/,relevance:0,contains:[Bi]}]}]},T_={scope:"title",begin:nm,relevance:0},N_={scope:"title",begin:$c,relevance:0},O_={begin:"\\.\\s*"+$c,relevance:0},L_=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var fs=Object.freeze({__proto__:null,MATCH_NOTHING_RE:m_,IDENT_RE:nm,UNDERSCORE_IDENT_RE:$c,NUMBER_RE:rm,C_NUMBER_RE:im,BINARY_NUMBER_RE:sm,RE_STARTERS_RE:b_,SHEBANG:y_,BACKSLASH_ESCAPE:Bi,APOS_STRING_MODE:v_,QUOTE_STRING_MODE:w_,PHRASAL_WORDS_MODE:k_,COMMENT:$o,C_LINE_COMMENT_MODE:E_,C_BLOCK_COMMENT_MODE:x_,HASH_COMMENT_MODE:C_,NUMBER_MODE:S_,C_NUMBER_MODE:__,BINARY_NUMBER_MODE:M_,REGEXP_MODE:A_,TITLE_MODE:T_,UNDERSCORE_TITLE_MODE:N_,METHOD_GUARD:O_,END_SAME_AS_BEGIN:L_});function R_(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function D_(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function I_(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=R_,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function B_(n,e){Array.isArray(n.illegal)&&(n.illegal=Hc(...n.illegal))}function H_(n,e){if(n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function P_(n,e){n.relevance===void 0&&(n.relevance=1)}const $_=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=lr(t.beforeMatch,em(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},F_=["of","and","for","in","not","or","if","then","parent","list","value"],z_="keyword";function om(n,e,t=z_){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,om(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,V_(l[0],l[1])]})}}function V_(n,e){return e?Number(e):q_(n)?0:1}function q_(n){return F_.includes(n.toLowerCase())}const kf={},Yn=n=>{console.error(n)},Ef=(n,...e)=>{console.log(`WARN: ${n}`,...e)},br=(n,e)=>{kf[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),kf[`${n}/${e}`]=!0)},po=new Error;function am(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=tm(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function U_(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Yn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),po;if(typeof n.beginScope!="object"||n.beginScope===null)throw Yn("beginScope must be object"),po;am(n,n.begin,{key:"beginScope"}),n.begin=Pc(n.begin,{joinWith:""})}}function K_(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Yn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),po;if(typeof n.endScope!="object"||n.endScope===null)throw Yn("endScope must be object"),po;am(n,n.end,{key:"endScope"}),n.end=Pc(n.end,{joinWith:""})}}function W_(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function G_(n){W_(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),U_(n),K_(n)}function Z_(n){function e(o,a){return new RegExp(Ii(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=tm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Pc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[D_,H_,G_,$_].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[I_,B_,P_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=om(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Ii(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return j_(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=En(n.classNameAliases||{}),s(n)}function lm(n){return n?n.endsWithParent||lm(n.starts):!1}function j_(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return En(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:lm(n)?En(n,{starts:n.starts?En(n.starts):null}):Object.isFrozen(n)?En(n):n}var J_="11.6.0";let Y_=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}};const Ia=Xg,xf=En,Cf=Symbol("nomatch"),X_=7,Q_=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u_};function l(C){return a.noHighlightRe.test(C)}function c(C){let E=C.className+" ";E+=C.parentNode?C.parentNode.className:"";const _=a.languageDetectRe.exec(E);if(_){const D=M(_[1]);return D||(Ef(s.replace("{}",_[1])),Ef("Falling back to no-highlight mode for this block.",C)),D?_[1]:"no-highlight"}return E.split(/\s+/).find(D=>l(D)||M(D))}function u(C,E,_){let D="",P="";typeof E=="object"?(D=C,_=E.ignoreIllegals,P=E.language):(br("10.7.0","highlight(lang, code, ...args) has been deprecated."),br("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),P=C,D=E),_===void 0&&(_=!0);const G={code:D,language:P};T("before:highlight",G);const Q=G.result?G.result:d(G.language,G.code,_);return Q.code=G.code,T("after:highlight",Q),Q}function d(C,E,_,D){const P=Object.create(null);function G($,K){return $.keywords[K]}function Q(){if(!ee.keywords){V.addText(le);return}let $=0;ee.keywordPatternRe.lastIndex=0;let K=ee.keywordPatternRe.exec(le),O="";for(;K;){O+=le.substring($,K.index);const I=Me.case_insensitive?K[0].toLowerCase():K[0],j=G(ee,I);if(j){const[ie,Re]=j;if(V.addText(O),O="",P[I]=(P[I]||0)+1,P[I]<=X_&&(me+=Re),ie.startsWith("_"))O+=K[0];else{const pt=Me.classNameAliases[ie]||ie;V.addKeyword(K[0],pt)}}else O+=K[0];$=ee.keywordPatternRe.lastIndex,K=ee.keywordPatternRe.exec(le)}O+=le.substring($),V.addText(O)}function pe(){if(le==="")return;let $=null;if(typeof ee.subLanguage=="string"){if(!e[ee.subLanguage]){V.addText(le);return}$=d(ee.subLanguage,le,!0,At[ee.subLanguage]),At[ee.subLanguage]=$._top}else $=p(le,ee.subLanguage.length?ee.subLanguage:null);ee.relevance>0&&(me+=$.relevance),V.addSublanguage($._emitter,$.language)}function ve(){ee.subLanguage!=null?pe():Q(),le=""}function ce($,K){let O=1;const I=K.length-1;for(;O<=I;){if(!$._emit[O]){O++;continue}const j=Me.classNameAliases[$[O]]||$[O],ie=K[O];j?V.addKeyword(ie,j):(le=ie,Q(),le=""),O++}}function Se($,K){return $.scope&&typeof $.scope=="string"&&V.openNode(Me.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(V.addKeyword(le,Me.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),le=""):$.beginScope._multi&&(ce($.beginScope,K),le="")),ee=Object.create($,{parent:{value:ee}}),ee}function it($,K,O){let I=h_($.endRe,O);if(I){if($["on:end"]){const j=new yf($);$["on:end"](K,j),j.isMatchIgnored&&(I=!1)}if(I){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return it($.parent,K,O)}function Fe($){return ee.matcher.regexIndex===0?(le+=$[0],1):(ze=!0,0)}function dt($){const K=$[0],O=$.rule,I=new yf(O),j=[O.__beforeBegin,O["on:begin"]];for(const ie of j)if(ie&&(ie($,I),I.isMatchIgnored))return Fe(K);return O.skip?le+=K:(O.excludeBegin&&(le+=K),ve(),!O.returnBegin&&!O.excludeBegin&&(le=K)),Se(O,$),O.returnBegin?0:K.length}function st($){const K=$[0],O=E.substring($.index),I=it(ee,$,O);if(!I)return Cf;const j=ee;ee.endScope&&ee.endScope._wrap?(ve(),V.addKeyword(K,ee.endScope._wrap)):ee.endScope&&ee.endScope._multi?(ve(),ce(ee.endScope,$)):j.skip?le+=K:(j.returnEnd||j.excludeEnd||(le+=K),ve(),j.excludeEnd&&(le=K));do ee.scope&&V.closeNode(),!ee.skip&&!ee.subLanguage&&(me+=ee.relevance),ee=ee.parent;while(ee!==I.parent);return I.starts&&Se(I.starts,$),j.returnEnd?0:K.length}function bt(){const $=[];for(let K=ee;K!==Me;K=K.parent)K.scope&&$.unshift(K.scope);$.forEach(K=>V.openNode(K))}let ft={};function ue($,K){const O=K&&K[0];if(le+=$,O==null)return ve(),0;if(ft.type==="begin"&&K.type==="end"&&ft.index===K.index&&O===""){if(le+=E.slice(K.index,K.index+1),!i){const I=new Error(`0 width match regex (${C})`);throw I.languageName=C,I.badRule=ft.rule,I}return 1}if(ft=K,K.type==="begin")return dt(K);if(K.type==="illegal"&&!_){const I=new Error('Illegal lexeme "'+O+'" for mode "'+(ee.scope||"")+'"');throw I.mode=ee,I}else if(K.type==="end"){const I=st(K);if(I!==Cf)return I}if(K.type==="illegal"&&O==="")return 1;if(Ge>1e5&&Ge>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return le+=O,O.length}const Me=M(C);if(!Me)throw Yn(s.replace("{}",C)),new Error('Unknown language: "'+C+'"');const Xe=Z_(Me);let Ne="",ee=D||Xe;const At={},V=new a.__emitter(a);bt();let le="",me=0,oe=0,Ge=0,ze=!1;try{for(ee.matcher.considerAll();;){Ge++,ze?ze=!1:ee.matcher.considerAll(),ee.matcher.lastIndex=oe;const $=ee.matcher.exec(E);if(!$)break;const K=E.substring(oe,$.index),O=ue(K,$);oe=$.index+O}return ue(E.substring(oe)),V.closeAllNodes(),V.finalize(),Ne=V.toHTML(),{language:C,value:Ne,relevance:me,illegal:!1,_emitter:V,_top:ee}}catch($){if($.message&&$.message.includes("Illegal"))return{language:C,value:Ia(E),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:oe,context:E.slice(oe-100,oe+100),mode:$.mode,resultSoFar:Ne},_emitter:V};if(i)return{language:C,value:Ia(E),illegal:!1,relevance:0,errorRaised:$,_emitter:V,_top:ee};throw $}}function f(C){const E={value:Ia(C),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return E._emitter.addText(C),E}function p(C,E){E=E||a.languages||Object.keys(e);const _=f(C),D=E.filter(M).filter(z).map(ve=>d(ve,C,!1));D.unshift(_);const P=D.sort((ve,ce)=>{if(ve.relevance!==ce.relevance)return ce.relevance-ve.relevance;if(ve.language&&ce.language){if(M(ve.language).supersetOf===ce.language)return 1;if(M(ce.language).supersetOf===ve.language)return-1}return 0}),[G,Q]=P,pe=G;return pe.secondBest=Q,pe}function h(C,E,_){const D=E&&t[E]||_;C.classList.add("hljs"),C.classList.add(`language-${D}`)}function g(C){let E=null;const _=c(C);if(l(_))return;if(T("before:highlightElement",{el:C,language:_}),C.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),a.throwUnescapedHTML))throw new Y_("One of your code blocks includes unescaped HTML.",C.innerHTML);E=C;const D=E.textContent,P=_?u(D,{language:_,ignoreIllegals:!0}):p(D);C.innerHTML=P.value,h(C,_,P.language),C.result={language:P.language,re:P.relevance,relevance:P.relevance},P.secondBest&&(C.secondBest={language:P.secondBest.language,relevance:P.secondBest.relevance}),T("after:highlightElement",{el:C,result:P,text:D})}function m(C){a=xf(a,C)}const v=()=>{b(),br("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){b(),br("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function b(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function x(){k&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",x,!1);function w(C,E){let _=null;try{_=E(n)}catch(D){if(Yn("Language definition for '{}' could not be registered.".replace("{}",C)),i)Yn(D);else throw D;_=o}_.name||(_.name=C),e[C]=_,_.rawDefinition=E.bind(null,n),_.aliases&&L(_.aliases,{languageName:C})}function S(C){delete e[C];for(const E of Object.keys(t))t[E]===C&&delete t[E]}function A(){return Object.keys(e)}function M(C){return C=(C||"").toLowerCase(),e[C]||e[t[C]]}function L(C,{languageName:E}){typeof C=="string"&&(C=[C]),C.forEach(_=>{t[_.toLowerCase()]=E})}function z(C){const E=M(C);return E&&!E.disableAutodetect}function q(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=E=>{C["before:highlightBlock"](Object.assign({block:E.el},E))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=E=>{C["after:highlightBlock"](Object.assign({block:E.el},E))})}function U(C){q(C),r.push(C)}function T(C,E){const _=C;r.forEach(function(D){D[_]&&D[_](E)})}function H(C){return br("10.7.0","highlightBlock will be removed entirely in v12.0"),br("10.7.0","Please use highlightElement now."),g(C)}Object.assign(n,{highlight:u,highlightAuto:p,highlightAll:b,highlightElement:g,highlightBlock:H,configure:m,initHighlighting:v,initHighlightingOnLoad:y,registerLanguage:w,unregisterLanguage:S,listLanguages:A,getLanguage:M,registerAliases:L,autoDetection:z,inherit:xf,addPlugin:U}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=J_,n.regex={concat:lr,lookahead:em,either:Hc,optional:f_,anyNumberOfTimes:d_};for(const C in fs)typeof fs[C]=="object"&&Ic.exports(fs[C]);return Object.assign(n,fs),n};var Hi=Q_({}),e2=Hi;Hi.HighlightJS=Hi;Hi.default=Hi;var t2=e2;function cm(n,e=[]){return n.map(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?cm(t.children,r):{text:t.value,classes:r}}).flat()}function Sf(n){return n.value||n.children||[]}function n2(n){return!!t2.getLanguage(n)}function _f({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return wl(n,s=>s.type.name===e).forEach(s=>{let o=s.pos+1;const a=s.node.attrs.language||r,l=t.listLanguages(),c=a&&(l.includes(a)||n2(a))?Sf(t.highlight(a,s.node.textContent)):Sf(t.highlightAuto(s.node.textContent));cm(c).forEach(u=>{const d=o+u.text.length;if(u.classes.length){const f=Ie.inline(o,d,{class:u.classes.join(" ")});i.push(f)}o=d})}),we.create(n,i)}function r2(n){return typeof n=="function"}function i2({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>r2(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Ce({key:new _e("lowlight"),state:{init:(i,{doc:s})=>_f({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=wl(o.doc,f=>f.type.name===n),d=wl(a.doc,f=>f.type.name===n);return i.docChanged&&([l,c].includes(n)||d.length!==u.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?_f({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}const s2=Ng.extend({addOptions(){var n;return{...(n=this.parent)===null||n===void 0?void 0:n.call(this),lowlight:{},defaultLanguage:null}},addProseMirrorPlugins(){var n;return[...((n=this.parent)===null||n===void 0?void 0:n.call(this))||[],i2({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function Mf(n,e,t={}){const{empty:r,ranges:i,from:s,to:o}=n.selection,a=e?ln(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(g=>a?a.name===g.type.name:!0).find(g=>Fr(g.attrs,t,{strict:!1}));let l=s,c=o;const u=[];i.forEach(({$from:g,$to:m})=>{const v=g.pos,y=m.pos;l=Math.min(l,v),c=Math.max(l,y),n.doc.nodesBetween(v,y,(k,b)=>{if(!k.isText&&!k.marks.length)return;const x=Math.max(v,b),w=Math.min(y,b+k.nodeSize);u.push(...k.marks.map(S=>({mark:S,from:x,to:w})))})});const d=c-l;if(d===0)return!1;const f=u.filter(g=>a?a.name===g.mark.type.name:!0).filter(g=>Fr(g.mark.attrs,t,{strict:!1})).reduce((g,m)=>g+m.to-m.from,0),p=u.filter(g=>a?g.mark.type!==a&&g.mark.type.excludes(a):!0).reduce((g,m)=>g+m.to-m.from,0);return(f>0?f+p:f)>=d}function Af(n){var e;return!!((e=n.spec.group)!=null&&e.split(" ").includes("list"))}function Tf(n,e,t={}){if(!e)return nr(n,null,t)||Mf(n,null,t);const r=n.schema.nodes[e];if(r){if(Af(r)){const s=Oo(o=>Af(o.type))(n.selection);return!!(s&&s.node.type.name===e)}return nr(n,e,t)}return n.schema.marks[e]?Mf(n,e,t):!1}function Nf(n){return new qi({find:n.find,handler:({state:e,range:t,match:r,commands:i})=>{const s=e.doc.resolve(t.from),o=re(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o),setTimeout(()=>i.focus(!0),0)}})}const um=[{name:"Auto",value:"auto"},{name:"Plain Text",value:"plaintext",alias:["text","txt"]},{name:"Bash",value:"bash",alias:["sh"]},{name:"BASIC",value:"basic",alias:[]},{name:"C",value:"c",alias:["h"]},{name:"Clojure",value:"clojure",alias:["clj","edn"]},{name:"CMake",value:"cmake",alias:["cmake.in"]},{name:"CoffeeScript",value:"coffeescript",alias:["coffee","cson","iced"]},{name:"C++",value:"cpp",alias:["cc","c++","h++","hpp","hh","hxx","cxx"]},{name:"C#",value:"csharp",alias:["cs","c#"]},{name:"CSS",value:"css",alias:[]},{name:"Dart",value:"dart",alias:[]},{name:"Delphi",value:"delphi",alias:["dpr","dfm","pas","pascal"]},{name:"Dockerfile",value:"dockerfile",alias:["docker"]},{name:"Erlang",value:"erlang",alias:["erl"]},{name:"Go",value:"go",alias:["golang"]},{name:"GraphQL",value:"graphql",alias:["gql"]},{name:"Groovy",value:"groovy",alias:[]},{name:"Java",value:"java",alias:["jsp"]},{name:"JavaScript",value:"javascript",alias:["js","jsx","mjs","cjs"]},{name:"JSON",value:"json",alias:[]},{name:"Kotlin",value:"kotlin",alias:["kt","kts"]},{name:"Lua",value:"lua",alias:[]},{name:"Makefile",value:"makefile",alias:["mk","mak","make"]},{name:"Markdown",value:"markdown",alias:["md","mkdown","mkd"]},{name:"Matlab",value:"matlab",alias:[]},{name:"Objective-C",value:"objectivec",alias:["mm","objc","obj-c","obj-c++","objective-c++"]},{name:"PHP",value:"php",alias:[]},{name:"Properties",value:"properties",alias:[]},{name:"Python",value:"python",alias:["py","gyp","ipython"]},{name:"Ruby",value:"ruby",alias:["rb","gemspec","podspec","thor","irb"]},{name:"Rust",value:"rust",alias:["rs"]},{name:"Scala",value:"scala",alias:[]},{name:"SCSS",value:"scss",alias:[]},{name:"Shell",value:"shell",alias:["console","shellsession"]},{name:"SQL",value:"sql",alias:[]},{name:"Swift",value:"swift",alias:[]},{name:"TypeScript",value:"typescript",alias:["ts","tsx"]},{name:"WebAssembly",value:"wasm",alias:[]},{name:"HTML, XML",value:"xml",alias:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"]},{name:"YAML",value:"yaml",alias:["yml"]}],Of=n=>{if(!n)return null;const e=n.toLocaleLowerCase();return um.find(r=>r.value===e||r.alias&&r.alias.includes(e))};function o2(n,e){const{$from:t,from:r,to:i}=n,a=(e.textContent||"").split(` -`).reduce((p,h,g)=>(p[g]=(p[g-1]||0)+h.length+(g===0?0:1),p),{}),l=t.parentOffset,c=t.parentOffset+i-r,u=Object.keys(a),d=u.find(p=>a[p]>=l),f=u.find(p=>a[p]>=c);return{start:d,end:f}}const a2=/^[`·]{3}([a-z]+)?[\s\n]$/,l2=/^[~~]{3}([a-z]+)?[\s\n]$/,c2=s2.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},defaultLanguage:null,languages:um}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),addCodeComments:(e,t)=>({editor:r})=>{const{storage:i,view:{dispatch:s},state:{tr:o}}=r;s(o.setSelection(X.create(r.state.doc,t)).deleteSelection());const a=i.markdown.serializer.serialize(e),l=Oi.create(this.options.codeCommentsAi.model,r.userOptions);return l==null||l.start(a,this.options.codeCommentsAi.prompt,r,{markdownParseEnable:!0,useMarkdownTextOnly:!0}),!0},addCodeExplain:(e,t)=>({editor:r})=>{const{storage:i,view:{dispatch:s},state:{tr:o}}=r,a=r.state.doc.nodeSize;a<=t+e.nodeSize+2?(r.commands.insertContentAt(t+e.nodeSize+1,"

"),s(o.setSelection(Y.create(r.state.doc,a-2)))):s(o.setSelection(Y.create(r.state.doc,t+e.nodeSize+1)));const l=i.markdown.serializer.serialize(e),c=Oi.create(this.options.codeExplainAi.model,r.userOptions);return c==null||c.start(l,this.options.codeExplainAi.prompt,r),!0},toggleCodeBlock:e=>({commands:t,editor:r,chain:i})=>{const{state:s}=r,{from:o,to:a}=s.selection;if(!Tf(s,this.name)&&!s.selection.empty){let l=!0;const c=[];if(s.doc.nodesBetween(o,a,(u,d)=>{if(u.isInline)return!1;if(u.type.name!=="paragraph")return d+1<=o&&d+u.nodeSize-1>=a?void 0:(l=!1,!1);{const f=(u.textContent||"").slice(d+1>o?0:o-d-1,d+u.nodeSize-11)return i().command(({state:u,tr:d})=>(d.replaceRangeWith(o,a,this.type.create(e,u.schema.text(c.join(` -`)))),!0)).setTextSelection({from:o+2,to:o+2}).run()}return t.toggleNode(this.name,"paragraph",e)}}},addKeyboardShortcuts(){var n;return{...(n=this.parent)==null?void 0:n.call(this),Tab:({editor:e})=>{const{state:t,view:r}=e;if(!Tf(t,this.name))return!1;const{selection:i,tr:s}=t,o=" ";if(i.empty)r.dispatch(s.insertText(o));else{const{$from:a,from:l,to:c}=i,u=a.node();if(u.type!==this.type)return!1;const{start:d,end:f}=o2(i,u);if(d===void 0||f===void 0)return r.dispatch(s.replaceSelectionWith(t.schema.text(o))),!0;const g=(u.textContent||"").split(` +3. "-" cannot repeat`);Ae.customSchemes.push([n,e])}function YS(){Ae.scanner=VS(Ae.customSchemes);for(let n=0;n{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=xv(t.doc,[...e]);if(Tv(a).forEach(({newRange:c})=>{const u=Cv(r.doc,c,p=>p.isTextblock);let d,f;if(u.length>1?(d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")),d&&f){const p=f.split(" ").filter(m=>m!=="");if(p.length<=0)return!1;const h=p[p.length-1],g=d.pos+f.lastIndexOf(h);if(!h)return!1;Hc(h).filter(m=>m.isLink).map(m=>({...m,from:g+m.start+1,to:g+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>n.validate?n.validate(m.value):!0).forEach(m=>{mc(m.from,m.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(m.from,m.to,n.type.create({href:m.href}))})}}),!!o.steps.length)return o}})}function e_(n){return new Ce({key:new _e("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const a=ig(e.state,n.type.name),l=r.target,c=(i=l==null?void 0:l.href)!==null&&i!==void 0?i:a.href,u=(s=l==null?void 0:l.target)!==null&&s!==void 0?s:a.target;return l&&c?(e.editable&&window.open(c,u),!0):!1}}})}function t_(n){return new Ce({key:new _e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(h=>{l+=h.textContent});const c=Hc(l).find(h=>h.isLink&&h.value===l);if(!l||!c)return!1;const u=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),d=/href="([^"]*)"/,f=u==null?void 0:u.match(d),p=f?f[1]:c.href;return n.editor.commands.setMark(n.type,{href:p}),!0}}})}const n_=Le.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){yf(n);return}yf(n.scheme,n.optionalSlashes)})},onDestroy(){JS()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){return["a",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Nn({find:n=>Hc(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),s=/href="([^"]*)"/,o=i==null?void 0:i.match(s);return o?{href:o[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(QS({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(e_({type:this.type})),this.options.linkOnPaste&&n.push(t_({editor:this.editor,type:this.type})),n}}),r_=Le.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),i_=Le.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),s_=ae.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:n}){return["ul",fe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),o_=/^\s*(\[([( |x])?\])\s$/,a_=ae.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return s.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=t(),p=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{i.setAttribute(c,u)}),i.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),s.append(a,o),i.append(s,l),Object.entries(e).forEach(([c,u])=>{i.setAttribute(c,u)}),{dom:i,contentDOM:l,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ir({find:o_,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var Pc={exports:{}};function $c(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];typeof t=="object"&&!Object.isFrozen(t)&&$c(t)}),n}Pc.exports=$c;Pc.exports.default=$c;let vf=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function em(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function xn(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const l_="
",wf=n=>!!n.scope||n.sublanguage&&n.language,c_=(n,{prefix:e})=>{if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};let u_=class{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=em(e)}openNode(e){if(!wf(e))return;let t="";e.sublanguage?t=`language-${e.language}`:t=c_(e.scope,{prefix:this.classPrefix}),this.span(t)}closeNode(e){wf(e)&&(this.buffer+=l_)}value(){return this.buffer}span(e){this.buffer+=``}};const kf=(n={})=>{const e={children:[]};return Object.assign(e,n),e};let d_=class tm{constructor(){this.rootNode=kf(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=kf({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{tm._collapse(t)}))}},f_=class extends d_{constructor(e){super(),this.options=e}addKeyword(e,t){e!==""&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){e!==""&&this.add(e)}addSublanguage(e,t){const r=e.root;r.sublanguage=!0,r.language=t,this.add(r)}toHTML(){return new u_(this,this.options).value()}finalize(){return!0}};function Ii(n){return n?typeof n=="string"?n:n.source:null}function nm(n){return lr("(?=",n,")")}function p_(n){return lr("(?:",n,")*")}function h_(n){return lr("(?:",n,")?")}function lr(...n){return n.map(t=>Ii(t)).join("")}function g_(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Fc(...n){return"("+(g_(n).capture?"":"?:")+n.map(r=>Ii(r)).join("|")+")"}function rm(n){return new RegExp(n.toString()+"|").exec("").length-1}function m_(n,e){const t=n&&n.exec(e);return t&&t.index===0}const b_=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function zc(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=Ii(r),o="";for(;s.length>0;){const a=b_.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const y_=/\b\B/,im="[a-zA-Z]\\w*",Vc="[a-zA-Z_]\\w*",sm="\\b\\d+(\\.\\d+)?",om="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",am="\\b(0b[01]+)",v_="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",w_=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=lr(e,/.*\b/,n.binary,/\b.*/)),xn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},Bi={begin:"\\\\[\\s\\S]",relevance:0},k_={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Bi]},x_={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Bi]},E_={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},zo=function(n,e,t={}){const r=xn({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Fc("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:lr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},C_=zo("//","$"),S_=zo("/\\*","\\*/"),__=zo("#","$"),M_={scope:"number",begin:sm,relevance:0},A_={scope:"number",begin:om,relevance:0},T_={scope:"number",begin:am,relevance:0},N_={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[Bi,{begin:/\[/,end:/\]/,relevance:0,contains:[Bi]}]}]},O_={scope:"title",begin:im,relevance:0},L_={scope:"title",begin:Vc,relevance:0},R_={begin:"\\.\\s*"+Vc,relevance:0},D_=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var fs=Object.freeze({__proto__:null,MATCH_NOTHING_RE:y_,IDENT_RE:im,UNDERSCORE_IDENT_RE:Vc,NUMBER_RE:sm,C_NUMBER_RE:om,BINARY_NUMBER_RE:am,RE_STARTERS_RE:v_,SHEBANG:w_,BACKSLASH_ESCAPE:Bi,APOS_STRING_MODE:k_,QUOTE_STRING_MODE:x_,PHRASAL_WORDS_MODE:E_,COMMENT:zo,C_LINE_COMMENT_MODE:C_,C_BLOCK_COMMENT_MODE:S_,HASH_COMMENT_MODE:__,NUMBER_MODE:M_,C_NUMBER_MODE:A_,BINARY_NUMBER_MODE:T_,REGEXP_MODE:N_,TITLE_MODE:O_,UNDERSCORE_TITLE_MODE:L_,METHOD_GUARD:R_,END_SAME_AS_BEGIN:D_});function I_(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function B_(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function H_(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=I_,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function P_(n,e){Array.isArray(n.illegal)&&(n.illegal=Fc(...n.illegal))}function $_(n,e){if(n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function F_(n,e){n.relevance===void 0&&(n.relevance=1)}const z_=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=lr(t.beforeMatch,nm(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},V_=["of","and","for","in","not","or","if","then","parent","list","value"],q_="keyword";function lm(n,e,t=q_){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,lm(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,U_(l[0],l[1])]})}}function U_(n,e){return e?Number(e):K_(n)?0:1}function K_(n){return V_.includes(n.toLowerCase())}const xf={},Yn=n=>{console.error(n)},Ef=(n,...e)=>{console.log(`WARN: ${n}`,...e)},br=(n,e)=>{xf[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),xf[`${n}/${e}`]=!0)},ho=new Error;function cm(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=rm(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function W_(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Yn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ho;if(typeof n.beginScope!="object"||n.beginScope===null)throw Yn("beginScope must be object"),ho;cm(n,n.begin,{key:"beginScope"}),n.begin=zc(n.begin,{joinWith:""})}}function Z_(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Yn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ho;if(typeof n.endScope!="object"||n.endScope===null)throw Yn("endScope must be object"),ho;cm(n,n.end,{key:"endScope"}),n.end=zc(n.end,{joinWith:""})}}function G_(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function j_(n){G_(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),W_(n),Z_(n)}function J_(n){function e(o,a){return new RegExp(Ii(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=rm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(zc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[B_,$_,j_,z_].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[H_,P_,F_].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=lm(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Ii(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return Y_(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=xn(n.classNameAliases||{}),s(n)}function um(n){return n?n.endsWithParent||um(n.starts):!1}function Y_(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return xn(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:um(n)?xn(n,{starts:n.starts?xn(n.starts):null}):Object.isFrozen(n)?xn(n):n}var X_="11.6.0";let Q_=class extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}};const $a=em,Cf=xn,Sf=Symbol("nomatch"),e2=7,t2=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:f_};function l(C){return a.noHighlightRe.test(C)}function c(C){let x=C.className+" ";x+=C.parentNode?C.parentNode.className:"";const _=a.languageDetectRe.exec(x);if(_){const D=M(_[1]);return D||(Ef(s.replace("{}",_[1])),Ef("Falling back to no-highlight mode for this block.",C)),D?_[1]:"no-highlight"}return x.split(/\s+/).find(D=>l(D)||M(D))}function u(C,x,_){let D="",P="";typeof x=="object"?(D=C,_=x.ignoreIllegals,P=x.language):(br("10.7.0","highlight(lang, code, ...args) has been deprecated."),br("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),P=C,D=x),_===void 0&&(_=!0);const Z={code:D,language:P};T("before:highlight",Z);const Q=Z.result?Z.result:d(Z.language,Z.code,_);return Q.code=Z.code,T("after:highlight",Q),Q}function d(C,x,_,D){const P=Object.create(null);function Z($,K){return $.keywords[K]}function Q(){if(!ee.keywords){V.addText(le);return}let $=0;ee.keywordPatternRe.lastIndex=0;let K=ee.keywordPatternRe.exec(le),O="";for(;K;){O+=le.substring($,K.index);const I=Me.case_insensitive?K[0].toLowerCase():K[0],j=Z(ee,I);if(j){const[se,Re]=j;if(V.addText(O),O="",P[I]=(P[I]||0)+1,P[I]<=e2&&(me+=Re),se.startsWith("_"))O+=K[0];else{const pt=Me.classNameAliases[se]||se;V.addKeyword(K[0],pt)}}else O+=K[0];$=ee.keywordPatternRe.lastIndex,K=ee.keywordPatternRe.exec(le)}O+=le.substring($),V.addText(O)}function pe(){if(le==="")return;let $=null;if(typeof ee.subLanguage=="string"){if(!e[ee.subLanguage]){V.addText(le);return}$=d(ee.subLanguage,le,!0,At[ee.subLanguage]),At[ee.subLanguage]=$._top}else $=p(le,ee.subLanguage.length?ee.subLanguage:null);ee.relevance>0&&(me+=$.relevance),V.addSublanguage($._emitter,$.language)}function ve(){ee.subLanguage!=null?pe():Q(),le=""}function ce($,K){let O=1;const I=K.length-1;for(;O<=I;){if(!$._emit[O]){O++;continue}const j=Me.classNameAliases[$[O]]||$[O],se=K[O];j?V.addKeyword(se,j):(le=se,Q(),le=""),O++}}function Se($,K){return $.scope&&typeof $.scope=="string"&&V.openNode(Me.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(V.addKeyword(le,Me.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),le=""):$.beginScope._multi&&(ce($.beginScope,K),le="")),ee=Object.create($,{parent:{value:ee}}),ee}function it($,K,O){let I=m_($.endRe,O);if(I){if($["on:end"]){const j=new vf($);$["on:end"](K,j),j.isMatchIgnored&&(I=!1)}if(I){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return it($.parent,K,O)}function ze($){return ee.matcher.regexIndex===0?(le+=$[0],1):(Ve=!0,0)}function dt($){const K=$[0],O=$.rule,I=new vf(O),j=[O.__beforeBegin,O["on:begin"]];for(const se of j)if(se&&(se($,I),I.isMatchIgnored))return ze(K);return O.skip?le+=K:(O.excludeBegin&&(le+=K),ve(),!O.returnBegin&&!O.excludeBegin&&(le=K)),Se(O,$),O.returnBegin?0:K.length}function st($){const K=$[0],O=x.substring($.index),I=it(ee,$,O);if(!I)return Sf;const j=ee;ee.endScope&&ee.endScope._wrap?(ve(),V.addKeyword(K,ee.endScope._wrap)):ee.endScope&&ee.endScope._multi?(ve(),ce(ee.endScope,$)):j.skip?le+=K:(j.returnEnd||j.excludeEnd||(le+=K),ve(),j.excludeEnd&&(le=K));do ee.scope&&V.closeNode(),!ee.skip&&!ee.subLanguage&&(me+=ee.relevance),ee=ee.parent;while(ee!==I.parent);return I.starts&&Se(I.starts,$),j.returnEnd?0:K.length}function bt(){const $=[];for(let K=ee;K!==Me;K=K.parent)K.scope&&$.unshift(K.scope);$.forEach(K=>V.openNode(K))}let ft={};function ue($,K){const O=K&&K[0];if(le+=$,O==null)return ve(),0;if(ft.type==="begin"&&K.type==="end"&&ft.index===K.index&&O===""){if(le+=x.slice(K.index,K.index+1),!i){const I=new Error(`0 width match regex (${C})`);throw I.languageName=C,I.badRule=ft.rule,I}return 1}if(ft=K,K.type==="begin")return dt(K);if(K.type==="illegal"&&!_){const I=new Error('Illegal lexeme "'+O+'" for mode "'+(ee.scope||"")+'"');throw I.mode=ee,I}else if(K.type==="end"){const I=st(K);if(I!==Sf)return I}if(K.type==="illegal"&&O==="")return 1;if(Ze>1e5&&Ze>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return le+=O,O.length}const Me=M(C);if(!Me)throw Yn(s.replace("{}",C)),new Error('Unknown language: "'+C+'"');const Xe=J_(Me);let Ne="",ee=D||Xe;const At={},V=new a.__emitter(a);bt();let le="",me=0,oe=0,Ze=0,Ve=!1;try{for(ee.matcher.considerAll();;){Ze++,Ve?Ve=!1:ee.matcher.considerAll(),ee.matcher.lastIndex=oe;const $=ee.matcher.exec(x);if(!$)break;const K=x.substring(oe,$.index),O=ue(K,$);oe=$.index+O}return ue(x.substring(oe)),V.closeAllNodes(),V.finalize(),Ne=V.toHTML(),{language:C,value:Ne,relevance:me,illegal:!1,_emitter:V,_top:ee}}catch($){if($.message&&$.message.includes("Illegal"))return{language:C,value:$a(x),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:oe,context:x.slice(oe-100,oe+100),mode:$.mode,resultSoFar:Ne},_emitter:V};if(i)return{language:C,value:$a(x),illegal:!1,relevance:0,errorRaised:$,_emitter:V,_top:ee};throw $}}function f(C){const x={value:$a(C),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return x._emitter.addText(C),x}function p(C,x){x=x||a.languages||Object.keys(e);const _=f(C),D=x.filter(M).filter(z).map(ve=>d(ve,C,!1));D.unshift(_);const P=D.sort((ve,ce)=>{if(ve.relevance!==ce.relevance)return ce.relevance-ve.relevance;if(ve.language&&ce.language){if(M(ve.language).supersetOf===ce.language)return 1;if(M(ce.language).supersetOf===ve.language)return-1}return 0}),[Z,Q]=P,pe=Z;return pe.secondBest=Q,pe}function h(C,x,_){const D=x&&t[x]||_;C.classList.add("hljs"),C.classList.add(`language-${D}`)}function g(C){let x=null;const _=c(C);if(l(_))return;if(T("before:highlightElement",{el:C,language:_}),C.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(C)),a.throwUnescapedHTML))throw new Q_("One of your code blocks includes unescaped HTML.",C.innerHTML);x=C;const D=x.textContent,P=_?u(D,{language:_,ignoreIllegals:!0}):p(D);C.innerHTML=P.value,h(C,_,P.language),C.result={language:P.language,re:P.relevance,relevance:P.relevance},P.secondBest&&(C.secondBest={language:P.secondBest.language,relevance:P.secondBest.relevance}),T("after:highlightElement",{el:C,result:P,text:D})}function m(C){a=Cf(a,C)}const v=()=>{b(),br("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){b(),br("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function b(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function E(){k&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",E,!1);function w(C,x){let _=null;try{_=x(n)}catch(D){if(Yn("Language definition for '{}' could not be registered.".replace("{}",C)),i)Yn(D);else throw D;_=o}_.name||(_.name=C),e[C]=_,_.rawDefinition=x.bind(null,n),_.aliases&&L(_.aliases,{languageName:C})}function S(C){delete e[C];for(const x of Object.keys(t))t[x]===C&&delete t[x]}function A(){return Object.keys(e)}function M(C){return C=(C||"").toLowerCase(),e[C]||e[t[C]]}function L(C,{languageName:x}){typeof C=="string"&&(C=[C]),C.forEach(_=>{t[_.toLowerCase()]=x})}function z(C){const x=M(C);return x&&!x.disableAutodetect}function q(C){C["before:highlightBlock"]&&!C["before:highlightElement"]&&(C["before:highlightElement"]=x=>{C["before:highlightBlock"](Object.assign({block:x.el},x))}),C["after:highlightBlock"]&&!C["after:highlightElement"]&&(C["after:highlightElement"]=x=>{C["after:highlightBlock"](Object.assign({block:x.el},x))})}function U(C){q(C),r.push(C)}function T(C,x){const _=C;r.forEach(function(D){D[_]&&D[_](x)})}function H(C){return br("10.7.0","highlightBlock will be removed entirely in v12.0"),br("10.7.0","Please use highlightElement now."),g(C)}Object.assign(n,{highlight:u,highlightAuto:p,highlightAll:b,highlightElement:g,highlightBlock:H,configure:m,initHighlighting:v,initHighlightingOnLoad:y,registerLanguage:w,unregisterLanguage:S,listLanguages:A,getLanguage:M,registerAliases:L,autoDetection:z,inherit:Cf,addPlugin:U}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=X_,n.regex={concat:lr,lookahead:nm,either:Fc,optional:h_,anyNumberOfTimes:p_};for(const C in fs)typeof fs[C]=="object"&&Pc.exports(fs[C]);return Object.assign(n,fs),n};var Hi=t2({}),n2=Hi;Hi.HighlightJS=Hi;Hi.default=Hi;var r2=n2;function dm(n,e=[]){return n.map(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?dm(t.children,r):{text:t.value,classes:r}}).flat()}function _f(n){return n.value||n.children||[]}function i2(n){return!!r2.getLanguage(n)}function Mf({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return Cl(n,s=>s.type.name===e).forEach(s=>{let o=s.pos+1;const a=s.node.attrs.language||r,l=t.listLanguages(),c=a&&(l.includes(a)||i2(a))?_f(t.highlight(a,s.node.textContent)):_f(t.highlightAuto(s.node.textContent));dm(c).forEach(u=>{const d=o+u.text.length;if(u.classes.length){const f=Ie.inline(o,d,{class:u.classes.join(" ")});i.push(f)}o=d})}),we.create(n,i)}function s2(n){return typeof n=="function"}function o2({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>s2(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Ce({key:new _e("lowlight"),state:{init:(i,{doc:s})=>Mf({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Cl(o.doc,f=>f.type.name===n),d=Cl(a.doc,f=>f.type.name===n);return i.docChanged&&([l,c].includes(n)||d.length!==u.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Mf({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}const a2=Lg.extend({addOptions(){var n;return{...(n=this.parent)===null||n===void 0?void 0:n.call(this),lowlight:{},defaultLanguage:null}},addProseMirrorPlugins(){var n;return[...((n=this.parent)===null||n===void 0?void 0:n.call(this))||[],o2({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}});function Af(n,e,t={}){const{empty:r,ranges:i,from:s,to:o}=n.selection,a=e?ln(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(g=>a?a.name===g.type.name:!0).find(g=>Fr(g.attrs,t,{strict:!1}));let l=s,c=o;const u=[];i.forEach(({$from:g,$to:m})=>{const v=g.pos,y=m.pos;l=Math.min(l,v),c=Math.max(l,y),n.doc.nodesBetween(v,y,(k,b)=>{if(!k.isText&&!k.marks.length)return;const E=Math.max(v,b),w=Math.min(y,b+k.nodeSize);u.push(...k.marks.map(S=>({mark:S,from:E,to:w})))})});const d=c-l;if(d===0)return!1;const f=u.filter(g=>a?a.name===g.mark.type.name:!0).filter(g=>Fr(g.mark.attrs,t,{strict:!1})).reduce((g,m)=>g+m.to-m.from,0),p=u.filter(g=>a?g.mark.type!==a&&g.mark.type.excludes(a):!0).reduce((g,m)=>g+m.to-m.from,0);return(f>0?f+p:f)>=d}function Tf(n){var e;return!!((e=n.spec.group)!=null&&e.split(" ").includes("list"))}function Nf(n,e,t={}){if(!e)return nr(n,null,t)||Af(n,null,t);const r=n.schema.nodes[e];if(r){if(Tf(r)){const s=Lo(o=>Tf(o.type))(n.selection);return!!(s&&s.node.type.name===e)}return nr(n,e,t)}return n.schema.marks[e]?Af(n,e,t):!1}function Of(n){return new qi({find:n.find,handler:({state:e,range:t,match:r,commands:i})=>{const s=e.doc.resolve(t.from),o=ie(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o),setTimeout(()=>i.focus(!0),0)}})}const fm=[{name:"Auto",value:"auto"},{name:"Plain Text",value:"plaintext",alias:["text","txt"]},{name:"Bash",value:"bash",alias:["sh"]},{name:"BASIC",value:"basic",alias:[]},{name:"C",value:"c",alias:["h"]},{name:"Clojure",value:"clojure",alias:["clj","edn"]},{name:"CMake",value:"cmake",alias:["cmake.in"]},{name:"CoffeeScript",value:"coffeescript",alias:["coffee","cson","iced"]},{name:"C++",value:"cpp",alias:["cc","c++","h++","hpp","hh","hxx","cxx"]},{name:"C#",value:"csharp",alias:["cs","c#"]},{name:"CSS",value:"css",alias:[]},{name:"Dart",value:"dart",alias:[]},{name:"Delphi",value:"delphi",alias:["dpr","dfm","pas","pascal"]},{name:"Dockerfile",value:"dockerfile",alias:["docker"]},{name:"Erlang",value:"erlang",alias:["erl"]},{name:"Go",value:"go",alias:["golang"]},{name:"GraphQL",value:"graphql",alias:["gql"]},{name:"Groovy",value:"groovy",alias:[]},{name:"Java",value:"java",alias:["jsp"]},{name:"JavaScript",value:"javascript",alias:["js","jsx","mjs","cjs"]},{name:"JSON",value:"json",alias:[]},{name:"Kotlin",value:"kotlin",alias:["kt","kts"]},{name:"Lua",value:"lua",alias:[]},{name:"Makefile",value:"makefile",alias:["mk","mak","make"]},{name:"Markdown",value:"markdown",alias:["md","mkdown","mkd"]},{name:"Matlab",value:"matlab",alias:[]},{name:"Objective-C",value:"objectivec",alias:["mm","objc","obj-c","obj-c++","objective-c++"]},{name:"PHP",value:"php",alias:[]},{name:"Properties",value:"properties",alias:[]},{name:"Python",value:"python",alias:["py","gyp","ipython"]},{name:"Ruby",value:"ruby",alias:["rb","gemspec","podspec","thor","irb"]},{name:"Rust",value:"rust",alias:["rs"]},{name:"Scala",value:"scala",alias:[]},{name:"SCSS",value:"scss",alias:[]},{name:"Shell",value:"shell",alias:["console","shellsession"]},{name:"SQL",value:"sql",alias:[]},{name:"Swift",value:"swift",alias:[]},{name:"TypeScript",value:"typescript",alias:["ts","tsx"]},{name:"WebAssembly",value:"wasm",alias:[]},{name:"HTML, XML",value:"xml",alias:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"]},{name:"YAML",value:"yaml",alias:["yml"]}],Lf=n=>{if(!n)return null;const e=n.toLocaleLowerCase();return fm.find(r=>r.value===e||r.alias&&r.alias.includes(e))};function l2(n,e){const{$from:t,from:r,to:i}=n,a=(e.textContent||"").split(` +`).reduce((p,h,g)=>(p[g]=(p[g-1]||0)+h.length+(g===0?0:1),p),{}),l=t.parentOffset,c=t.parentOffset+i-r,u=Object.keys(a),d=u.find(p=>a[p]>=l),f=u.find(p=>a[p]>=c);return{start:d,end:f}}const c2=/^[`·]{3}([a-z]+)?[\s\n]$/,u2=/^[~~]{3}([a-z]+)?[\s\n]$/,d2=a2.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},defaultLanguage:null,languages:fm}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),addCodeComments:(e,t)=>({editor:r})=>{const{storage:i,view:{dispatch:s},state:{tr:o}}=r;s(o.setSelection(X.create(r.state.doc,t)).deleteSelection());const a=i.markdown.serializer.serialize(e),l=Kr.create(this.options.codeCommentsAi.model,r.userOptions);return l==null||l.start(a,this.options.codeCommentsAi.prompt,r,{markdownParseEnable:!0,useMarkdownTextOnly:!0}),!0},addCodeExplain:(e,t)=>({editor:r})=>{const{storage:i,view:{dispatch:s},state:{tr:o}}=r,a=r.state.doc.nodeSize;a<=t+e.nodeSize+2?(r.commands.insertContentAt(t+e.nodeSize+1,"

"),s(o.setSelection(Y.create(r.state.doc,a-2)))):s(o.setSelection(Y.create(r.state.doc,t+e.nodeSize+1)));const l=i.markdown.serializer.serialize(e),c=Kr.create(this.options.codeExplainAi.model,r.userOptions);return c==null||c.start(l,this.options.codeExplainAi.prompt,r),!0},toggleCodeBlock:e=>({commands:t,editor:r,chain:i})=>{const{state:s}=r,{from:o,to:a}=s.selection;if(!Nf(s,this.name)&&!s.selection.empty){let l=!0;const c=[];if(s.doc.nodesBetween(o,a,(u,d)=>{if(u.isInline)return!1;if(u.type.name!=="paragraph")return d+1<=o&&d+u.nodeSize-1>=a?void 0:(l=!1,!1);{const f=(u.textContent||"").slice(d+1>o?0:o-d-1,d+u.nodeSize-11)return i().command(({state:u,tr:d})=>(d.replaceRangeWith(o,a,this.type.create(e,u.schema.text(c.join(` +`)))),!0)).setTextSelection({from:o+2,to:o+2}).run()}return t.toggleNode(this.name,"paragraph",e)}}},addKeyboardShortcuts(){var n;return{...(n=this.parent)==null?void 0:n.call(this),Tab:({editor:e})=>{const{state:t,view:r}=e;if(!Nf(t,this.name))return!1;const{selection:i,tr:s}=t,o=" ";if(i.empty)r.dispatch(s.insertText(o));else{const{$from:a,from:l,to:c}=i,u=a.node();if(u.type!==this.type)return!1;const{start:d,end:f}=l2(i,u);if(d===void 0||f===void 0)return r.dispatch(s.replaceSelectionWith(t.schema.text(o))),!0;const g=(u.textContent||"").split(` `).map((y,k)=>k>=d&&k<=f&&y?o+y:y),m=a.node(1),v=a.start(1);s.replaceWith(v,v+m.nodeSize-2,t.schema.text(g.join(` -`))),s.setSelection(Y.between(s.doc.resolve(l+o.length),s.doc.resolve(c+(f-d+1)*o.length))),r.dispatch(s)}return!0}}},addInputRules(){return[Nf({find:a2,type:this.type,getAttributes:n=>{var e;return{language:((e=Of(n[1]))==null?void 0:e.value)||this.options.defaultLanguage}}}),Nf({find:l2,type:this.type,getAttributes:n=>{var e;return{language:((e=Of(n[1]))==null?void 0:e.value)||this.options.defaultLanguage}}})]},addNodeView(){return n=>{var s,o;const e=document.createElement("div");e.classList.add("aie-codeblock-wrapper");const{language:t}=n.node.attrs;e.innerHTML=` +`))),s.setSelection(Y.between(s.doc.resolve(l+o.length),s.doc.resolve(c+(f-d+1)*o.length))),r.dispatch(s)}return!0}}},addInputRules(){return[Of({find:c2,type:this.type,getAttributes:n=>{var e;return{language:((e=Lf(n[1]))==null?void 0:e.value)||this.options.defaultLanguage}}}),Of({find:u2,type:this.type,getAttributes:n=>{var e;return{language:((e=Lf(n[1]))==null?void 0:e.value)||this.options.defaultLanguage}}})]},addNodeView(){return n=>{var s,o;const e=document.createElement("div");e.classList.add("aie-codeblock-wrapper");const{language:t}=n.node.attrs;e.innerHTML=`
${this.options.codeCommentsAi?'
自动注释
':""} ${this.options.codeExplainAi?'
代码解释
':""} @@ -346,10 +346,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`),P=C,D=E),_===void 0&&(
`;const r=()=>{const a=document.createElement("div");return a.classList.add("aie-codeblock-langs"),a.innerHTML=` - ${this.options.languages.map(l=>`
${l.name}
`).join("")}`,a.addEventListener("click",l=>{const c=l.target.closest(".aie-codeblock-langs-item");if(c){const u=c.getAttribute("data-item");n.editor.chain().setCodeBlock({language:u}).run()}}),a},i=Ke(e.querySelector(".aie-codeblock-tools-lang"),{content:r(),appendTo:n.editor.options.element,placement:"bottom-end",trigger:"click",interactive:!0,arrow:!1,aria:{content:null,expanded:!1}});return(s=e.querySelector(".aie-codeblock-tools-comments"))==null||s.addEventListener("click",a=>{const l=n.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),c=n.editor.state.doc.resolve(l.pos).parent;n.editor.chain().addCodeComments(c,l.pos)}),(o=e.querySelector(".aie-codeblock-tools-explain"))==null||o.addEventListener("click",a=>{const l=n.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),c=n.editor.state.doc.resolve(l.pos).parent;n.editor.chain().addCodeExplain(c,l.pos)}),{dom:e,contentDOM:e.querySelector("code"),destroy:()=>{i.destroy()}}}}});function u2(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="<[^<>]+>",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(s)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],b={type:g,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},x={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[x,d,a,t,n.C_BLOCK_COMMENT_MODE,u,c],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function d2(n){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},t=u2(n),r=t.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,t.name="Arduino",t.aliases=["ino"],t.supersetOf="cpp",t}function f2(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(o);const a={match:/\\"/},l={className:"string",begin:/'/,end:/'/},c={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=n.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},h=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],g=["true","false"],m={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],b=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:h,literal:g,built_in:[...v,...y,"set","shopt",...k,...b]},contains:[f,n.SHEBANG(),p,u,n.HASH_COMMENT_MODE,s,m,o,a,l,c,t]}}function p2(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="<[^<>]+>",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(s)+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",m={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},v=[d,a,t,n.C_BLOCK_COMMENT_MODE,u,c],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:m,contains:v.concat([{begin:/\(/,end:/\)/,keywords:m,contains:v.concat(["self"]),relevance:0}]),relevance:0},k={begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:m,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:m,relevance:0},{begin:p,returnBegin:!0,contains:[n.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:m,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:m}}}function h2(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="<[^<>]+>",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(s)+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],v=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],b={type:g,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},x={className:"function.dispatch",relevance:0,keywords:{_hint:v},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[x,d,a,t,n.C_BLOCK_COMMENT_MODE,u,c],S={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function g2(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=n.inherit(n.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=n.inherit(c,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=n.inherit(d,{illegal:/\n/}),p={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,f]},h={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},g=n.inherit(h,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});d.contains=[h,p,c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.C_BLOCK_COMMENT_MODE],f.contains=[g,p,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const m={variants:[h,p,c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},v={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},y=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",k={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},m,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,v,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,v,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+y+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,v],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[m,l,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},k]}}const m2=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),b2=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],y2=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],v2=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],w2=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],k2=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function E2(n){const e=n.regex,t=m2(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+v2.join("|")+")"},{begin:":(:)?("+w2.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+k2.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:y2.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+b2.join("|")+")\\b"}]}}function x2(n){const e=n.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function C2(n){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"dm(n,e,t-1))}function M2(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+dm("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[u,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,Lf,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Lf,c]}}const Rf="[A-Za-z$_][0-9A-Za-z$_]*",A2=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],T2=["true","false","null","undefined","NaN","Infinity"],fm=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],pm=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hm=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],N2=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],O2=[].concat(hm,fm,pm);function L2(n){const e=n.regex,t=(_,{after:D})=>{const P="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,D)=>{const P=_[0].length+_.index,G=_.input[P];if(G==="<"||G===","){D.ignoreMatch();return}G===">"&&(t(_,{after:P})||D.ignoreMatch());let Q;const pe=_.input.substring(P);if(Q=pe.match(/^\s*=/)){D.ignoreMatch();return}if((Q=pe.match(/^\s+extends\s+/))&&Q.index===0){D.ignoreMatch();return}}},a={$pattern:Rf,keyword:A2,literal:T2,built_in:O2,"variable.language":N2},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},y={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},k=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,g,m,{match:/\$\d+/},d];f.contains=k.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(k)});const b=[].concat(y,f.contains),x=b.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...fm,...pm]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},L={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(_){return e.concat("(?!",_.join("|"),")")}const U={match:e.concat(/\b/,q([...hm,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},T={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,g,m,y,{match:/\$\d+/},d,A,{className:"attr",begin:r+e.lookahead(":"),relevance:0},E,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,n.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},L,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},T,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},U,z,S,H,{match:/\$[(.]/}]}}function R2(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Sr="[0-9](_*[0-9])*",gs=`\\.(${Sr})`,ms="[0-9a-fA-F](_*[0-9a-fA-F])*",D2={className:"number",variants:[{begin:`(\\b(${Sr})((${gs})|\\.)?|(${gs}))[eE][+-]?(${Sr})[fFdD]?\\b`},{begin:`\\b(${Sr})((${gs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${gs})[fFdD]?\\b`},{begin:`\\b(${Sr})[fFdD]\\b`},{begin:`\\b0[xX]((${ms})\\.?|(${ms})?\\.(${ms}))[pP][+-]?(${Sr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ms})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function I2(n){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},t={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[n.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+n.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[n.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+n.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+n.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[n.inherit(o,{className:"string"}),"self"]}]},c=D2,u=n.COMMENT("/\\*","\\*/",{contains:[n.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:n.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),n.C_LINE_COMMENT_MODE,u,t,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:n.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[n.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,n.C_LINE_COMMENT_MODE,u],relevance:0},n.C_LINE_COMMENT_MODE,u,a,l,o,n.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,n.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},n.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},c]}}const B2=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),H2=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],P2=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],gm=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],mm=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],$2=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),F2=gm.concat(mm);function z2(n){const e=B2(n),t=F2,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(k){return{className:"string",begin:"~?"+k+".*?"+k}},c=function(k,b,x){return{className:k,begin:b,relevance:x}},u={$pattern:/[a-z-]+/,keyword:r,attribute:P2.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=a.concat({begin:/\{/,end:/\}/,contains:o}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+$2.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},m={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},v={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+H2.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+gm.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+mm.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},y={begin:i+`:(:)?(${t.join("|")})`,returnBegin:!0,contains:[v]};return o.push(n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,g,m,y,h,v,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function V2(n){const e="\\[=*\\[",t="\\]=*\\]",r={begin:e,end:t,contains:["self"]},i=[n.COMMENT("--(?!"+e+")","$"),n.COMMENT("--"+e,t,{contains:[r],relevance:10})];return{name:"Lua",keywords:{$pattern:n.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[n.inherit(n.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},n.C_NUMBER_MODE,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{className:"string",begin:e,end:t,contains:[r],relevance:5}])}}function q2(n){const e={className:"variable",variants:[{begin:"\\$\\("+n.UNDERSCORE_IDENT_RE+"\\)",contains:[n.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=n.inherit(c,{contains:[]}),f=n.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let p=[t,l];return[c,u,d,f].forEach(m=>{m.contains=m.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},t,s,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,o]}}function K2(n){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},t=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"/,end:/$/,illegal:"\\n"},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[n.UNDERSCORE_TITLE_MODE]},{begin:"\\."+n.UNDERSCORE_IDENT_RE,relevance:0}]}}function W2(n){const e=n.regex,t=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:t.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@][^\s\w{]/,relevance:0}]},l=[n.BACKSLASH_ESCAPE,s,a],c=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],u=(p,h,g="\\1")=>{const m=g==="\\1"?g:e.concat(g,h);return e.concat(e.concat("(?:",p,")"),h,/(?:\\.|[^\\\/])*?/,m,/(?:\\.|[^\\\/])*?/,g,r)},d=(p,h,g)=>e.concat(e.concat("(?:",p,")"),h,/(?:\\.|[^\\\/])*?/,g,r),f=[a,n.HASH_COMMENT_MODE,n.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:l,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+n.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[n.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:u("s|tr|y",e.either(...c,{capture:!0}))},{begin:u("s|tr|y","\\(","\\)")},{begin:u("s|tr|y","\\[","\\]")},{begin:u("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",e.either(...c,{capture:!0}),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[n.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=f,o.contains=f,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:f}}function G2(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),s={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},a={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=n.inherit(n.APOS_STRING_MODE,{illegal:null}),c=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(a)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(a),"on:begin":(U,T)=>{T.data._beginMatch=U[1]||U[2]},"on:end":(U,T)=>{T.data._beginMatch!==U[1]&&T.ignoreMatch()}},d=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ -]`,p={scope:"string",variants:[c,l,u,d]},h={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],v=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],k={keyword:m,literal:(U=>{const T=[];return U.forEach(H=>{T.push(H),H.toLowerCase()===H?T.push(H.toUpperCase()):T.push(H.toLowerCase())}),T})(g),built_in:v},b=U=>U.map(T=>T.replace(/\|\d+$/,"")),x={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",b(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},w=e.concat(r,"\\b(?!\\()"),S={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),w],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[A,s,S,n.C_BLOCK_COMMENT_MODE,p,h,x]},L={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",b(m).join("\\b|"),"|",b(v).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(L);const z=[A,S,n.C_BLOCK_COMMENT_MODE,p,h,x],q={begin:e.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",match:i}]};return{case_insensitive:!1,keywords:k,contains:[q,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},s,L,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},x,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",s,S,n.C_BLOCK_COMMENT_MODE,p,h]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},p,h]}}function Z2(n){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},n.inherit(n.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),n.inherit(n.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function j2(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function J2(n){const e=n.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[n.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,u,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},m={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},v={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,d,n.HASH_COMMENT_MODE]}]};return c.contains=[d,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},d,m,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[v]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,v,d]}]}}function Y2(n){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function X2(n){const e=n.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:t,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[n.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),n.HASH_COMMENT_MODE,{scope:"string",contains:[n.BACKSLASH_ESCAPE],variants:[n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Q2(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[n.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.BACKSLASH_ESCAPE,u]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},w=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:t}],relevance:0},h,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=w,g.contains=w;const S="[>?]>",A="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",M="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",L=[{begin:/^\s*=>/,starts:{end:"$",contains:w}},{className:"meta.prompt",begin:"^("+S+"|"+A+"|"+M+")(?=[ ])",starts:{end:"$",keywords:o,contains:w}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(L).concat(c).concat(w)}}function eM(n){const e=n.regex,t={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,n.IDENT_RE,e.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",i=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"],s=["true","false","Some","None","Ok","Err"],o=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],a=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:n.IDENT_RE+"!?",type:a,keyword:i,literal:s,built_in:o},illegal:""},t]}}const tM=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),nM=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],rM=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],iM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],sM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],oM=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function aM(n){const e=tM(n),t=sM,r=iM,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+nM.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+t.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oM.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:rM.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function lM(n){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function cM(n){const e=n.regex,t=n.COMMENT("--","$"),r={className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},i={begin:/"/,end:/"/,contains:[{begin:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=u,h=[...c,...l].filter(k=>!u.includes(k)),g={className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},m={className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},v={begin:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function y(k,{exceptions:b,when:x}={}){const w=x;return b=b||[],k.map(S=>S.match(/\|\d+$/)||b.includes(S)?S:w(S)?`${S}|0`:S)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:y(h,{when:k=>k.length<3}),literal:s,type:a,built_in:d},contains:[{begin:e.either(...f),relevance:0,keywords:{$pattern:/[\w\.]+/,keyword:h.concat(f),literal:s,type:a}},{className:"type",begin:e.either(...o)},v,g,r,i,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,m]}}function bm(n){return n?typeof n=="string"?n:n.source:null}function bs(n){return xe("(?=",n,")")}function xe(...n){return n.map(t=>bm(t)).join("")}function uM(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function ot(...n){return"("+(uM(n).capture?"":"?:")+n.map(r=>bm(r)).join("|")+")"}const Fc=n=>xe(/\b/,n,/\w$/.test(n)?/\b/:/\B/),dM=["Protocol","Type"].map(Fc),Df=["init","self"].map(Fc),fM=["Any","Self"],Ba=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],If=["false","nil","true"],pM=["assignment","associativity","higherThan","left","lowerThan","none","right"],hM=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Bf=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],ym=ot(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),vm=ot(ym,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ha=xe(ym,vm,"*"),wm=ot(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),ho=ot(wm,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),nn=xe(wm,ho,"*"),Pa=xe(/[A-Z]/,ho,"*"),gM=["attached","autoclosure",xe(/convention\(/,ot("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",xe(/objc\(/,nn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],mM=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function bM(n){const e={match:/\s+/,relevance:0},t=n.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[n.C_LINE_COMMENT_MODE,t],i={match:[/\./,ot(...dM,...Df)],className:{2:"keyword"}},s={match:xe(/\./,ot(...Ba)),relevance:0},o=Ba.filter(ue=>typeof ue=="string").concat(["_|0"]),a=Ba.filter(ue=>typeof ue!="string").concat(fM).map(Fc),l={variants:[{className:"keyword",match:ot(...a,...Df)}]},c={$pattern:ot(/\b\w+/,/#\w+/),keyword:o.concat(hM),literal:If},u=[i,s,l],d={match:xe(/\./,ot(...Bf)),relevance:0},f={className:"built_in",match:xe(/\b/,ot(...Bf),/(?=\()/)},p=[d,f],h={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Ha},{match:`\\.(\\.|${vm})+`}]},m=[h,g],v="([0-9]_*)+",y="([0-9a-fA-F]_*)+",k={className:"number",relevance:0,variants:[{match:`\\b(${v})(\\.(${v}))?([eE][+-]?(${v}))?\\b`},{match:`\\b0x(${y})(\\.(${y}))?([pP][+-]?(${v}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},b=(ue="")=>({className:"subst",variants:[{match:xe(/\\/,ue,/[0\\tnr"']/)},{match:xe(/\\/,ue,/u\{[0-9a-fA-F]{1,8}\}/)}]}),x=(ue="")=>({className:"subst",match:xe(/\\/,ue,/[\t ]*(?:[\r\n]|\r\n)/)}),w=(ue="")=>({className:"subst",label:"interpol",begin:xe(/\\/,ue,/\(/),end:/\)/}),S=(ue="")=>({begin:xe(ue,/"""/),end:xe(/"""/,ue),contains:[b(ue),x(ue),w(ue)]}),A=(ue="")=>({begin:xe(ue,/"/),end:xe(/"/,ue),contains:[b(ue),w(ue)]}),M={className:"string",variants:[S(),S("#"),S("##"),S("###"),A(),A("#"),A("##"),A("###")]},L=[n.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[n.BACKSLASH_ESCAPE]}],z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:L},q=ue=>{const Me=xe(ue,/\//),Xe=xe(/\//,ue);return{begin:Me,end:Xe,contains:[...L,{scope:"comment",begin:`#(?!.*${Xe})`,end:/$/}]}},U={scope:"regexp",variants:[q("###"),q("##"),q("#"),z]},T={match:xe(/`/,nn,/`/)},H={className:"variable",match:/\$\d+/},C={className:"variable",match:`\\$${ho}+`},E=[T,H,C],_={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:mM,contains:[...m,k,M]}]}},D={scope:"keyword",match:xe(/@/,ot(...gM))},P={scope:"meta",match:xe(/@/,nn)},G=[_,D,P],Q={match:bs(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:xe(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,ho,"+")},{className:"type",match:Pa,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:xe(/\s+&\s+/,bs(Pa)),relevance:0}]},pe={begin://,keywords:c,contains:[...r,...u,...G,h,Q]};Q.contains.push(pe);const ve={match:xe(nn,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",ve,...r,U,...u,...p,...m,k,M,...E,...G,Q]},Se={begin://,keywords:"repeat each",contains:[...r,Q]},it={begin:ot(bs(xe(nn,/\s*:/)),bs(xe(nn,/\s+/,nn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:nn}]},Fe={begin:/\(/,end:/\)/,keywords:c,contains:[it,...r,...u,...m,k,M,...G,Q,ce],endsParent:!0,illegal:/["']/},dt={match:[/(func|macro)/,/\s+/,ot(T.match,nn,Ha)],className:{1:"keyword",3:"title.function"},contains:[Se,Fe,e],illegal:[/\[/,/%/]},st={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Se,Fe,e],illegal:/\[|%/},bt={match:[/operator/,/\s+/,Ha],className:{1:"keyword",3:"title"}},ft={begin:[/precedencegroup/,/\s+/,Pa],className:{1:"keyword",3:"title"},contains:[Q],keywords:[...pM,...If],end:/}/};for(const ue of M.variants){const Me=ue.contains.find(Ne=>Ne.label==="interpol");Me.keywords=c;const Xe=[...u,...p,...m,k,M,...E];Me.contains=[...Xe,{begin:/\(/,end:/\)/,contains:["self",...Xe]}]}return{name:"Swift",keywords:c,contains:[...r,dt,st,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:c,contains:[n.inherit(n.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...u]},bt,ft,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},U,...u,...p,...m,k,M,...E,...G,Q,ce]}}const go="[A-Za-z$_][0-9A-Za-z$_]*",km=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],Em=["true","false","null","undefined","NaN","Infinity"],xm=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Cm=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Sm=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],_m=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Mm=[].concat(Sm,xm,Cm);function yM(n){const e=n.regex,t=(_,{after:D})=>{const P="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(_,D)=>{const P=_[0].length+_.index,G=_.input[P];if(G==="<"||G===","){D.ignoreMatch();return}G===">"&&(t(_,{after:P})||D.ignoreMatch());let Q;const pe=_.input.substring(P);if(Q=pe.match(/^\s*=/)){D.ignoreMatch();return}if((Q=pe.match(/^\s+extends\s+/))&&Q.index===0){D.ignoreMatch();return}}},a={$pattern:go,keyword:km,literal:Em,built_in:Mm,"variable.language":_m},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},y={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},k=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,g,m,{match:/\$\d+/},d];f.contains=k.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(k)});const b=[].concat(y,f.contains),x=b.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...xm,...Cm]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},L={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(_){return e.concat("(?!",_.join("|"),")")}const U={match:e.concat(/\b/,q([...Sm,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},T={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},C="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(C)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:x,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,g,m,y,{match:/\$\d+/},d,A,{className:"attr",begin:r+e.lookahead(":"),relevance:0},E,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,n.REGEXP_MODE,{className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:x}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},L,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},T,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},U,z,S,H,{match:/\$[(.]/}]}}function vM(n){const e=yM(n),t=go,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[e.exports.CLASS_REFERENCE]},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[e.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"],l={$pattern:go,keyword:km.concat(a),literal:Em,built_in:Mm.concat(r),"variable.language":_m},c={className:"meta",begin:"@"+t},u=(f,p,h)=>{const g=f.contains.findIndex(m=>m.label===p);if(g===-1)throw new Error("can not find mode to replace");f.contains.splice(g,1,h)};Object.assign(e.keywords,l),e.exports.PARAMS_CONTAINS.push(c),e.contains=e.contains.concat([c,i,s]),u(e,"shebang",n.SHEBANG()),u(e,"use_strict",o);const d=e.contains.find(f=>f.label==="func.def");return d.relevance=0,Object.assign(e,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),e}function wM(n){const e=n.regex,t={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=n.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=n.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[t,r,l,c,u,d,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function kM(n){n.regex;const e=n.COMMENT(/\(;/,/;\)/);e.contains.push("self");const t=n.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[t,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,n.QUOTE_STRING_MODE,l,c,a]}}function EM(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),l=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,l,a]}]}]},n.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function xM(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ ]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ ]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ ]|$)"}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[n.BACKSLASH_ESCAPE,i]},o=n.inherit(s,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),a="[0-9]{4}(-[0-9][0-9]){0,2}",l="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",c="(\\.[0-9]*)?",u="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",d={className:"number",begin:"\\b"+a+l+c+u+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},h={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},d,{className:"number",begin:n.C_NUMBER_RE+"\\b",relevance:0},p,h,s],m=[...g];return m.pop(),m.push(o),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const CM={arduino:d2,bash:f2,c:p2,cpp:h2,csharp:g2,css:E2,diff:x2,go:C2,graphql:S2,ini:_2,java:M2,javascript:L2,json:R2,kotlin:I2,less:z2,lua:V2,makefile:q2,markdown:U2,objectivec:K2,perl:W2,php:G2,"php-template":Z2,plaintext:j2,python:J2,"python-repl":Y2,r:X2,ruby:Q2,rust:eM,scss:aM,shell:lM,sql:cM,swift:bM,typescript:vM,vbnet:wM,wasm:kM,xml:EM,yaml:xM};function Am(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(e=>{const t=n[e],r=typeof t;(r==="object"||r==="function")&&!Object.isFrozen(t)&&Am(t)}),n}class Hf{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Tm(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function xn(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const SM="
",Pf=n=>!!n.scope,_M=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class MM{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Tm(e)}openNode(e){if(!Pf(e))return;const t=_M(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){Pf(e)&&(this.buffer+=SM)}value(){return this.buffer}span(e){this.buffer+=``}}const $f=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class zc{constructor(){this.rootNode=$f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=$f({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{zc._collapse(t)}))}}class AM extends zc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const r=e.root;t&&(r.scope=`language:${t}`),this.add(r)}toHTML(){return new MM(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Pi(n){return n?typeof n=="string"?n:n.source:null}function Nm(n){return cr("(?=",n,")")}function TM(n){return cr("(?:",n,")*")}function NM(n){return cr("(?:",n,")?")}function cr(...n){return n.map(t=>Pi(t)).join("")}function OM(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Vc(...n){return"("+(OM(n).capture?"":"?:")+n.map(r=>Pi(r)).join("|")+")"}function Om(n){return new RegExp(n.toString()+"|").exec("").length-1}function LM(n,e){const t=n&&n.exec(e);return t&&t.index===0}const RM=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function qc(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=Pi(r),o="";for(;s.length>0;){const a=RM.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const DM=/\b\B/,Lm="[a-zA-Z]\\w*",Uc="[a-zA-Z_]\\w*",Rm="\\b\\d+(\\.\\d+)?",Dm="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Im="\\b(0b[01]+)",IM="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",BM=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=cr(e,/.*\b/,n.binary,/\b.*/)),xn({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},$i={begin:"\\\\[\\s\\S]",relevance:0},HM={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[$i]},PM={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[$i]},$M={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Fo=function(n,e,t={}){const r=xn({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Vc("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:cr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},FM=Fo("//","$"),zM=Fo("/\\*","\\*/"),VM=Fo("#","$"),qM={scope:"number",begin:Rm,relevance:0},UM={scope:"number",begin:Dm,relevance:0},KM={scope:"number",begin:Im,relevance:0},WM={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[$i,{begin:/\[/,end:/\]/,relevance:0,contains:[$i]}]},GM={scope:"title",begin:Lm,relevance:0},ZM={scope:"title",begin:Uc,relevance:0},jM={begin:"\\.\\s*"+Uc,relevance:0},JM=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var ys=Object.freeze({__proto__:null,APOS_STRING_MODE:HM,BACKSLASH_ESCAPE:$i,BINARY_NUMBER_MODE:KM,BINARY_NUMBER_RE:Im,COMMENT:Fo,C_BLOCK_COMMENT_MODE:zM,C_LINE_COMMENT_MODE:FM,C_NUMBER_MODE:UM,C_NUMBER_RE:Dm,END_SAME_AS_BEGIN:JM,HASH_COMMENT_MODE:VM,IDENT_RE:Lm,MATCH_NOTHING_RE:DM,METHOD_GUARD:jM,NUMBER_MODE:qM,NUMBER_RE:Rm,PHRASAL_WORDS_MODE:$M,QUOTE_STRING_MODE:PM,REGEXP_MODE:WM,RE_STARTERS_RE:IM,SHEBANG:BM,TITLE_MODE:GM,UNDERSCORE_IDENT_RE:Uc,UNDERSCORE_TITLE_MODE:ZM});function YM(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function XM(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function QM(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=YM,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function eA(n,e){Array.isArray(n.illegal)&&(n.illegal=Vc(...n.illegal))}function tA(n,e){if(n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function nA(n,e){n.relevance===void 0&&(n.relevance=1)}const rA=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=cr(t.beforeMatch,Nm(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},iA=["of","and","for","in","not","or","if","then","parent","list","value"],sA="keyword";function Bm(n,e,t=sA){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,Bm(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,oA(l[0],l[1])]})}}function oA(n,e){return e?Number(e):aA(n)?0:1}function aA(n){return iA.includes(n.toLowerCase())}const Ff={},Xn=n=>{console.error(n)},zf=(n,...e)=>{console.log(`WARN: ${n}`,...e)},yr=(n,e)=>{Ff[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),Ff[`${n}/${e}`]=!0)},mo=new Error;function Hm(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=Om(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function lA(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Xn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),mo;if(typeof n.beginScope!="object"||n.beginScope===null)throw Xn("beginScope must be object"),mo;Hm(n,n.begin,{key:"beginScope"}),n.begin=qc(n.begin,{joinWith:""})}}function cA(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Xn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),mo;if(typeof n.endScope!="object"||n.endScope===null)throw Xn("endScope must be object"),mo;Hm(n,n.end,{key:"endScope"}),n.end=qc(n.end,{joinWith:""})}}function uA(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function dA(n){uA(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),lA(n),cA(n)}function fA(n){function e(o,a){return new RegExp(Pi(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Om(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(qc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[XM,tA,dA,rA].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[QM,eA,nA].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Bm(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Pi(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return pA(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=xn(n.classNameAliases||{}),s(n)}function Pm(n){return n?n.endsWithParent||Pm(n.starts):!1}function pA(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return xn(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:Pm(n)?xn(n,{starts:n.starts?xn(n.starts):null}):Object.isFrozen(n)?xn(n):n}var hA="11.9.0";class gA extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const $a=Tm,Vf=xn,qf=Symbol("nomatch"),mA=7,$m=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:AM};function l(E){return a.noHighlightRe.test(E)}function c(E){let _=E.className+" ";_+=E.parentNode?E.parentNode.className:"";const D=a.languageDetectRe.exec(_);if(D){const P=M(D[1]);return P||(zf(s.replace("{}",D[1])),zf("Falling back to no-highlight mode for this block.",E)),P?D[1]:"no-highlight"}return _.split(/\s+/).find(P=>l(P)||M(P))}function u(E,_,D){let P="",G="";typeof _=="object"?(P=E,D=_.ignoreIllegals,G=_.language):(yr("10.7.0","highlight(lang, code, ...args) has been deprecated."),yr("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),G=E,P=_),D===void 0&&(D=!0);const Q={code:P,language:G};H("before:highlight",Q);const pe=Q.result?Q.result:d(Q.language,Q.code,D);return pe.code=Q.code,H("after:highlight",pe),pe}function d(E,_,D,P){const G=Object.create(null);function Q(O,I){return O.keywords[I]}function pe(){if(!V.keywords){me.addText(oe);return}let O=0;V.keywordPatternRe.lastIndex=0;let I=V.keywordPatternRe.exec(oe),j="";for(;I;){j+=oe.substring(O,I.index);const ie=Ne.case_insensitive?I[0].toLowerCase():I[0],Re=Q(V,ie);if(Re){const[pt,Jo]=Re;if(me.addText(j),j="",G[ie]=(G[ie]||0)+1,G[ie]<=mA&&(Ge+=Jo),pt.startsWith("_"))j+=I[0];else{const N=Ne.classNameAliases[pt]||pt;Se(I[0],N)}}else j+=I[0];O=V.keywordPatternRe.lastIndex,I=V.keywordPatternRe.exec(oe)}j+=oe.substring(O),me.addText(j)}function ve(){if(oe==="")return;let O=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){me.addText(oe);return}O=d(V.subLanguage,oe,!0,le[V.subLanguage]),le[V.subLanguage]=O._top}else O=p(oe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(Ge+=O.relevance),me.__addSublanguage(O._emitter,O.language)}function ce(){V.subLanguage!=null?ve():pe(),oe=""}function Se(O,I){O!==""&&(me.startScope(I),me.addText(O),me.endScope())}function it(O,I){let j=1;const ie=I.length-1;for(;j<=ie;){if(!O._emit[j]){j++;continue}const Re=Ne.classNameAliases[O[j]]||O[j],pt=I[j];Re?Se(pt,Re):(oe=pt,pe(),oe=""),j++}}function Fe(O,I){return O.scope&&typeof O.scope=="string"&&me.openNode(Ne.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(Se(oe,Ne.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),oe=""):O.beginScope._multi&&(it(O.beginScope,I),oe="")),V=Object.create(O,{parent:{value:V}}),V}function dt(O,I,j){let ie=LM(O.endRe,j);if(ie){if(O["on:end"]){const Re=new Hf(O);O["on:end"](I,Re),Re.isMatchIgnored&&(ie=!1)}if(ie){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return dt(O.parent,I,j)}function st(O){return V.matcher.regexIndex===0?(oe+=O[0],1):(K=!0,0)}function bt(O){const I=O[0],j=O.rule,ie=new Hf(j),Re=[j.__beforeBegin,j["on:begin"]];for(const pt of Re)if(pt&&(pt(O,ie),ie.isMatchIgnored))return st(I);return j.skip?oe+=I:(j.excludeBegin&&(oe+=I),ce(),!j.returnBegin&&!j.excludeBegin&&(oe=I)),Fe(j,O),j.returnBegin?0:I.length}function ft(O){const I=O[0],j=_.substring(O.index),ie=dt(V,O,j);if(!ie)return qf;const Re=V;V.endScope&&V.endScope._wrap?(ce(),Se(I,V.endScope._wrap)):V.endScope&&V.endScope._multi?(ce(),it(V.endScope,O)):Re.skip?oe+=I:(Re.returnEnd||Re.excludeEnd||(oe+=I),ce(),Re.excludeEnd&&(oe=I));do V.scope&&me.closeNode(),!V.skip&&!V.subLanguage&&(Ge+=V.relevance),V=V.parent;while(V!==ie.parent);return ie.starts&&Fe(ie.starts,O),Re.returnEnd?0:I.length}function ue(){const O=[];for(let I=V;I!==Ne;I=I.parent)I.scope&&O.unshift(I.scope);O.forEach(I=>me.openNode(I))}let Me={};function Xe(O,I){const j=I&&I[0];if(oe+=O,j==null)return ce(),0;if(Me.type==="begin"&&I.type==="end"&&Me.index===I.index&&j===""){if(oe+=_.slice(I.index,I.index+1),!i){const ie=new Error(`0 width match regex (${E})`);throw ie.languageName=E,ie.badRule=Me.rule,ie}return 1}if(Me=I,I.type==="begin")return bt(I);if(I.type==="illegal"&&!D){const ie=new Error('Illegal lexeme "'+j+'" for mode "'+(V.scope||"")+'"');throw ie.mode=V,ie}else if(I.type==="end"){const ie=ft(I);if(ie!==qf)return ie}if(I.type==="illegal"&&j==="")return 1;if($>1e5&&$>I.index*3)throw new Error("potential infinite loop, way more iterations than matches");return oe+=j,j.length}const Ne=M(E);if(!Ne)throw Xn(s.replace("{}",E)),new Error('Unknown language: "'+E+'"');const ee=fA(Ne);let At="",V=P||ee;const le={},me=new a.__emitter(a);ue();let oe="",Ge=0,ze=0,$=0,K=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(_,me);else{for(V.matcher.considerAll();;){$++,K?K=!1:V.matcher.considerAll(),V.matcher.lastIndex=ze;const O=V.matcher.exec(_);if(!O)break;const I=_.substring(ze,O.index),j=Xe(I,O);ze=O.index+j}Xe(_.substring(ze))}return me.finalize(),At=me.toHTML(),{language:E,value:At,relevance:Ge,illegal:!1,_emitter:me,_top:V}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:E,value:$a(_),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:ze,context:_.slice(ze-100,ze+100),mode:O.mode,resultSoFar:At},_emitter:me};if(i)return{language:E,value:$a(_),illegal:!1,relevance:0,errorRaised:O,_emitter:me,_top:V};throw O}}function f(E){const _={value:$a(E),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return _._emitter.addText(E),_}function p(E,_){_=_||a.languages||Object.keys(e);const D=f(E),P=_.filter(M).filter(z).map(ce=>d(ce,E,!1));P.unshift(D);const G=P.sort((ce,Se)=>{if(ce.relevance!==Se.relevance)return Se.relevance-ce.relevance;if(ce.language&&Se.language){if(M(ce.language).supersetOf===Se.language)return 1;if(M(Se.language).supersetOf===ce.language)return-1}return 0}),[Q,pe]=G,ve=Q;return ve.secondBest=pe,ve}function h(E,_,D){const P=_&&t[_]||D;E.classList.add("hljs"),E.classList.add(`language-${P}`)}function g(E){let _=null;const D=c(E);if(l(D))return;if(H("before:highlightElement",{el:E,language:D}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(E)),a.throwUnescapedHTML))throw new gA("One of your code blocks includes unescaped HTML.",E.innerHTML);_=E;const P=_.textContent,G=D?u(P,{language:D,ignoreIllegals:!0}):p(P);E.innerHTML=G.value,E.dataset.highlighted="yes",h(E,D,G.language),E.result={language:G.language,re:G.relevance,relevance:G.relevance},G.secondBest&&(E.secondBest={language:G.secondBest.language,relevance:G.secondBest.relevance}),H("after:highlightElement",{el:E,result:G,text:P})}function m(E){a=Vf(a,E)}const v=()=>{b(),yr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){b(),yr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function b(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function x(){k&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",x,!1);function w(E,_){let D=null;try{D=_(n)}catch(P){if(Xn("Language definition for '{}' could not be registered.".replace("{}",E)),i)Xn(P);else throw P;D=o}D.name||(D.name=E),e[E]=D,D.rawDefinition=_.bind(null,n),D.aliases&&L(D.aliases,{languageName:E})}function S(E){delete e[E];for(const _ of Object.keys(t))t[_]===E&&delete t[_]}function A(){return Object.keys(e)}function M(E){return E=(E||"").toLowerCase(),e[E]||e[t[E]]}function L(E,{languageName:_}){typeof E=="string"&&(E=[E]),E.forEach(D=>{t[D.toLowerCase()]=_})}function z(E){const _=M(E);return _&&!_.disableAutodetect}function q(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=_=>{E["before:highlightBlock"](Object.assign({block:_.el},_))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=_=>{E["after:highlightBlock"](Object.assign({block:_.el},_))})}function U(E){q(E),r.push(E)}function T(E){const _=r.indexOf(E);_!==-1&&r.splice(_,1)}function H(E,_){const D=E;r.forEach(function(P){P[D]&&P[D](_)})}function C(E){return yr("10.7.0","highlightBlock will be removed entirely in v12.0"),yr("10.7.0","Please use highlightElement now."),g(E)}Object.assign(n,{highlight:u,highlightAuto:p,highlightAll:b,highlightElement:g,highlightBlock:C,configure:m,initHighlighting:v,initHighlightingOnLoad:y,registerLanguage:w,unregisterLanguage:S,listLanguages:A,getLanguage:M,registerAliases:L,autoDetection:z,inherit:Vf,addPlugin:U,removePlugin:T}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=hA,n.regex={concat:cr,lookahead:Nm,either:Vc,optional:NM,anyNumberOfTimes:TM};for(const E in ys)typeof ys[E]=="object"&&Am(ys[E]);return Object.assign(n,ys),n},Wr=$m({});Wr.newInstance=()=>$m({});var bA=Wr;Wr.HighlightJS=Wr;Wr.default=Wr;const yA=jr(bA),Uf={},vA="hljs-";function wA(n){const e=yA.newInstance();return n&&s(n),{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,u){const d=u||Uf,f=typeof d.prefix=="string"?d.prefix:vA;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:kA,classPrefix:f});const p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const h=p._emitter.root,g=h.data;return g.language=p.language,g.relevance=p.relevance,h}function r(l,c){const d=(c||Uf).subset||i();let f=-1,p=0,h;for(;++fp&&(p=m.data.relevance,h=m)}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class kA{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const EA=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,Kf=new _e("aie-video-plugin"),si="video_action",xA=ae.create({name:"video",group:"block",addAttributes(){return{src:{default:null,parseHTML:n=>n.getAttribute("src"),renderHTML:n=>({src:n.src})},poster:{default:null,parseHTML:n=>n.getAttribute("poster"),renderHTML:n=>({poster:n.poster})},width:{default:350},controls:{default:!0}}},parseHTML(){return[{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),poster:n.getAttribute("poster")})}]},renderHTML({HTMLAttributes:n}){return["video",{controls:"true",...n,src:null},["source",{src:n.src}]]},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent(`",$f=n=>!!n.scope,AM=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class TM{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Om(e)}openNode(e){if(!$f(e))return;const t=AM(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){$f(e)&&(this.buffer+=MM)}value(){return this.buffer}span(e){this.buffer+=``}}const Ff=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class Uc{constructor(){this.rootNode=Ff(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=Ff({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{Uc._collapse(t)}))}}class NM extends Uc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const r=e.root;t&&(r.scope=`language:${t}`),this.add(r)}toHTML(){return new TM(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Pi(n){return n?typeof n=="string"?n:n.source:null}function Lm(n){return cr("(?=",n,")")}function OM(n){return cr("(?:",n,")*")}function LM(n){return cr("(?:",n,")?")}function cr(...n){return n.map(t=>Pi(t)).join("")}function RM(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Kc(...n){return"("+(RM(n).capture?"":"?:")+n.map(r=>Pi(r)).join("|")+")"}function Rm(n){return new RegExp(n.toString()+"|").exec("").length-1}function DM(n,e){const t=n&&n.exec(e);return t&&t.index===0}const IM=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Wc(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=Pi(r),o="";for(;s.length>0;){const a=IM.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const BM=/\b\B/,Dm="[a-zA-Z]\\w*",Zc="[a-zA-Z_]\\w*",Im="\\b\\d+(\\.\\d+)?",Bm="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Hm="\\b(0b[01]+)",HM="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",PM=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=cr(e,/.*\b/,n.binary,/\b.*/)),En({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},$i={begin:"\\\\[\\s\\S]",relevance:0},$M={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[$i]},FM={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[$i]},zM={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Vo=function(n,e,t={}){const r=En({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=Kc("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:cr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},VM=Vo("//","$"),qM=Vo("/\\*","\\*/"),UM=Vo("#","$"),KM={scope:"number",begin:Im,relevance:0},WM={scope:"number",begin:Bm,relevance:0},ZM={scope:"number",begin:Hm,relevance:0},GM={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[$i,{begin:/\[/,end:/\]/,relevance:0,contains:[$i]}]},jM={scope:"title",begin:Dm,relevance:0},JM={scope:"title",begin:Zc,relevance:0},YM={begin:"\\.\\s*"+Zc,relevance:0},XM=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var ys=Object.freeze({__proto__:null,APOS_STRING_MODE:$M,BACKSLASH_ESCAPE:$i,BINARY_NUMBER_MODE:ZM,BINARY_NUMBER_RE:Hm,COMMENT:Vo,C_BLOCK_COMMENT_MODE:qM,C_LINE_COMMENT_MODE:VM,C_NUMBER_MODE:WM,C_NUMBER_RE:Bm,END_SAME_AS_BEGIN:XM,HASH_COMMENT_MODE:UM,IDENT_RE:Dm,MATCH_NOTHING_RE:BM,METHOD_GUARD:YM,NUMBER_MODE:KM,NUMBER_RE:Im,PHRASAL_WORDS_MODE:zM,QUOTE_STRING_MODE:FM,REGEXP_MODE:GM,RE_STARTERS_RE:HM,SHEBANG:PM,TITLE_MODE:jM,UNDERSCORE_IDENT_RE:Zc,UNDERSCORE_TITLE_MODE:JM});function QM(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function eA(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function tA(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=QM,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function nA(n,e){Array.isArray(n.illegal)&&(n.illegal=Kc(...n.illegal))}function rA(n,e){if(n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function iA(n,e){n.relevance===void 0&&(n.relevance=1)}const sA=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=cr(t.beforeMatch,Lm(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},oA=["of","and","for","in","not","or","if","then","parent","list","value"],aA="keyword";function Pm(n,e,t=aA){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,Pm(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,lA(l[0],l[1])]})}}function lA(n,e){return e?Number(e):cA(n)?0:1}function cA(n){return oA.includes(n.toLowerCase())}const zf={},Xn=n=>{console.error(n)},Vf=(n,...e)=>{console.log(`WARN: ${n}`,...e)},yr=(n,e)=>{zf[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),zf[`${n}/${e}`]=!0)},bo=new Error;function $m(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=Rm(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function uA(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Xn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),bo;if(typeof n.beginScope!="object"||n.beginScope===null)throw Xn("beginScope must be object"),bo;$m(n,n.begin,{key:"beginScope"}),n.begin=Wc(n.begin,{joinWith:""})}}function dA(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Xn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),bo;if(typeof n.endScope!="object"||n.endScope===null)throw Xn("endScope must be object"),bo;$m(n,n.end,{key:"endScope"}),n.end=Wc(n.end,{joinWith:""})}}function fA(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function pA(n){fA(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),uA(n),dA(n)}function hA(n){function e(o,a){return new RegExp(Pi(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Rm(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(Wc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[eA,rA,pA,sA].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[tA,nA,iA].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Pm(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=Pi(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return gA(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=En(n.classNameAliases||{}),s(n)}function Fm(n){return n?n.endsWithParent||Fm(n.starts):!1}function gA(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return En(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:Fm(n)?En(n,{starts:n.starts?En(n.starts):null}):Object.isFrozen(n)?En(n):n}var mA="11.9.0";class bA extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const qa=Om,qf=En,Uf=Symbol("nomatch"),yA=7,zm=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:NM};function l(x){return a.noHighlightRe.test(x)}function c(x){let _=x.className+" ";_+=x.parentNode?x.parentNode.className:"";const D=a.languageDetectRe.exec(_);if(D){const P=M(D[1]);return P||(Vf(s.replace("{}",D[1])),Vf("Falling back to no-highlight mode for this block.",x)),P?D[1]:"no-highlight"}return _.split(/\s+/).find(P=>l(P)||M(P))}function u(x,_,D){let P="",Z="";typeof _=="object"?(P=x,D=_.ignoreIllegals,Z=_.language):(yr("10.7.0","highlight(lang, code, ...args) has been deprecated."),yr("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),Z=x,P=_),D===void 0&&(D=!0);const Q={code:P,language:Z};H("before:highlight",Q);const pe=Q.result?Q.result:d(Q.language,Q.code,D);return pe.code=Q.code,H("after:highlight",pe),pe}function d(x,_,D,P){const Z=Object.create(null);function Q(O,I){return O.keywords[I]}function pe(){if(!V.keywords){me.addText(oe);return}let O=0;V.keywordPatternRe.lastIndex=0;let I=V.keywordPatternRe.exec(oe),j="";for(;I;){j+=oe.substring(O,I.index);const se=Ne.case_insensitive?I[0].toLowerCase():I[0],Re=Q(V,se);if(Re){const[pt,ea]=Re;if(me.addText(j),j="",Z[se]=(Z[se]||0)+1,Z[se]<=yA&&(Ze+=ea),pt.startsWith("_"))j+=I[0];else{const N=Ne.classNameAliases[pt]||pt;Se(I[0],N)}}else j+=I[0];O=V.keywordPatternRe.lastIndex,I=V.keywordPatternRe.exec(oe)}j+=oe.substring(O),me.addText(j)}function ve(){if(oe==="")return;let O=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){me.addText(oe);return}O=d(V.subLanguage,oe,!0,le[V.subLanguage]),le[V.subLanguage]=O._top}else O=p(oe,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(Ze+=O.relevance),me.__addSublanguage(O._emitter,O.language)}function ce(){V.subLanguage!=null?ve():pe(),oe=""}function Se(O,I){O!==""&&(me.startScope(I),me.addText(O),me.endScope())}function it(O,I){let j=1;const se=I.length-1;for(;j<=se;){if(!O._emit[j]){j++;continue}const Re=Ne.classNameAliases[O[j]]||O[j],pt=I[j];Re?Se(pt,Re):(oe=pt,pe(),oe=""),j++}}function ze(O,I){return O.scope&&typeof O.scope=="string"&&me.openNode(Ne.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(Se(oe,Ne.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),oe=""):O.beginScope._multi&&(it(O.beginScope,I),oe="")),V=Object.create(O,{parent:{value:V}}),V}function dt(O,I,j){let se=DM(O.endRe,j);if(se){if(O["on:end"]){const Re=new Pf(O);O["on:end"](I,Re),Re.isMatchIgnored&&(se=!1)}if(se){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return dt(O.parent,I,j)}function st(O){return V.matcher.regexIndex===0?(oe+=O[0],1):(K=!0,0)}function bt(O){const I=O[0],j=O.rule,se=new Pf(j),Re=[j.__beforeBegin,j["on:begin"]];for(const pt of Re)if(pt&&(pt(O,se),se.isMatchIgnored))return st(I);return j.skip?oe+=I:(j.excludeBegin&&(oe+=I),ce(),!j.returnBegin&&!j.excludeBegin&&(oe=I)),ze(j,O),j.returnBegin?0:I.length}function ft(O){const I=O[0],j=_.substring(O.index),se=dt(V,O,j);if(!se)return Uf;const Re=V;V.endScope&&V.endScope._wrap?(ce(),Se(I,V.endScope._wrap)):V.endScope&&V.endScope._multi?(ce(),it(V.endScope,O)):Re.skip?oe+=I:(Re.returnEnd||Re.excludeEnd||(oe+=I),ce(),Re.excludeEnd&&(oe=I));do V.scope&&me.closeNode(),!V.skip&&!V.subLanguage&&(Ze+=V.relevance),V=V.parent;while(V!==se.parent);return se.starts&&ze(se.starts,O),Re.returnEnd?0:I.length}function ue(){const O=[];for(let I=V;I!==Ne;I=I.parent)I.scope&&O.unshift(I.scope);O.forEach(I=>me.openNode(I))}let Me={};function Xe(O,I){const j=I&&I[0];if(oe+=O,j==null)return ce(),0;if(Me.type==="begin"&&I.type==="end"&&Me.index===I.index&&j===""){if(oe+=_.slice(I.index,I.index+1),!i){const se=new Error(`0 width match regex (${x})`);throw se.languageName=x,se.badRule=Me.rule,se}return 1}if(Me=I,I.type==="begin")return bt(I);if(I.type==="illegal"&&!D){const se=new Error('Illegal lexeme "'+j+'" for mode "'+(V.scope||"")+'"');throw se.mode=V,se}else if(I.type==="end"){const se=ft(I);if(se!==Uf)return se}if(I.type==="illegal"&&j==="")return 1;if($>1e5&&$>I.index*3)throw new Error("potential infinite loop, way more iterations than matches");return oe+=j,j.length}const Ne=M(x);if(!Ne)throw Xn(s.replace("{}",x)),new Error('Unknown language: "'+x+'"');const ee=hA(Ne);let At="",V=P||ee;const le={},me=new a.__emitter(a);ue();let oe="",Ze=0,Ve=0,$=0,K=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(_,me);else{for(V.matcher.considerAll();;){$++,K?K=!1:V.matcher.considerAll(),V.matcher.lastIndex=Ve;const O=V.matcher.exec(_);if(!O)break;const I=_.substring(Ve,O.index),j=Xe(I,O);Ve=O.index+j}Xe(_.substring(Ve))}return me.finalize(),At=me.toHTML(),{language:x,value:At,relevance:Ze,illegal:!1,_emitter:me,_top:V}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:x,value:qa(_),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:Ve,context:_.slice(Ve-100,Ve+100),mode:O.mode,resultSoFar:At},_emitter:me};if(i)return{language:x,value:qa(_),illegal:!1,relevance:0,errorRaised:O,_emitter:me,_top:V};throw O}}function f(x){const _={value:qa(x),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return _._emitter.addText(x),_}function p(x,_){_=_||a.languages||Object.keys(e);const D=f(x),P=_.filter(M).filter(z).map(ce=>d(ce,x,!1));P.unshift(D);const Z=P.sort((ce,Se)=>{if(ce.relevance!==Se.relevance)return Se.relevance-ce.relevance;if(ce.language&&Se.language){if(M(ce.language).supersetOf===Se.language)return 1;if(M(Se.language).supersetOf===ce.language)return-1}return 0}),[Q,pe]=Z,ve=Q;return ve.secondBest=pe,ve}function h(x,_,D){const P=_&&t[_]||D;x.classList.add("hljs"),x.classList.add(`language-${P}`)}function g(x){let _=null;const D=c(x);if(l(D))return;if(H("before:highlightElement",{el:x,language:D}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new bA("One of your code blocks includes unescaped HTML.",x.innerHTML);_=x;const P=_.textContent,Z=D?u(P,{language:D,ignoreIllegals:!0}):p(P);x.innerHTML=Z.value,x.dataset.highlighted="yes",h(x,D,Z.language),x.result={language:Z.language,re:Z.relevance,relevance:Z.relevance},Z.secondBest&&(x.secondBest={language:Z.secondBest.language,relevance:Z.secondBest.relevance}),H("after:highlightElement",{el:x,result:Z,text:P})}function m(x){a=qf(a,x)}const v=()=>{b(),yr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){b(),yr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function b(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function E(){k&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",E,!1);function w(x,_){let D=null;try{D=_(n)}catch(P){if(Xn("Language definition for '{}' could not be registered.".replace("{}",x)),i)Xn(P);else throw P;D=o}D.name||(D.name=x),e[x]=D,D.rawDefinition=_.bind(null,n),D.aliases&&L(D.aliases,{languageName:x})}function S(x){delete e[x];for(const _ of Object.keys(t))t[_]===x&&delete t[_]}function A(){return Object.keys(e)}function M(x){return x=(x||"").toLowerCase(),e[x]||e[t[x]]}function L(x,{languageName:_}){typeof x=="string"&&(x=[x]),x.forEach(D=>{t[D.toLowerCase()]=_})}function z(x){const _=M(x);return _&&!_.disableAutodetect}function q(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=_=>{x["before:highlightBlock"](Object.assign({block:_.el},_))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=_=>{x["after:highlightBlock"](Object.assign({block:_.el},_))})}function U(x){q(x),r.push(x)}function T(x){const _=r.indexOf(x);_!==-1&&r.splice(_,1)}function H(x,_){const D=x;r.forEach(function(P){P[D]&&P[D](_)})}function C(x){return yr("10.7.0","highlightBlock will be removed entirely in v12.0"),yr("10.7.0","Please use highlightElement now."),g(x)}Object.assign(n,{highlight:u,highlightAuto:p,highlightAll:b,highlightElement:g,highlightBlock:C,configure:m,initHighlighting:v,initHighlightingOnLoad:y,registerLanguage:w,unregisterLanguage:S,listLanguages:A,getLanguage:M,registerAliases:L,autoDetection:z,inherit:qf,addPlugin:U,removePlugin:T}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=mA,n.regex={concat:cr,lookahead:Lm,either:Kc,optional:LM,anyNumberOfTimes:OM};for(const x in ys)typeof ys[x]=="object"&&Nm(ys[x]);return Object.assign(n,ys),n},Zr=zm({});Zr.newInstance=()=>zm({});var vA=Zr;Zr.HighlightJS=Zr;Zr.default=Zr;const wA=Jr(vA),Kf={},kA="hljs-";function xA(n){const e=wA.newInstance();return n&&s(n),{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,u){const d=u||Kf,f=typeof d.prefix=="string"?d.prefix:kA;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:EA,classPrefix:f});const p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const h=p._emitter.root,g=h.data;return g.language=p.language,g.relevance=p.relevance,h}function r(l,c){const d=(c||Kf).subset||i();let f=-1,p=0,h;for(;++fp&&(p=m.data.relevance,h=m)}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class EA{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const CA=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,Wf=new _e("aie-video-plugin"),oi="video_action",SA=ae.create({name:"video",group:"block",addAttributes(){return{src:{default:null,parseHTML:n=>n.getAttribute("src"),renderHTML:n=>({src:n.src})},poster:{default:null,parseHTML:n=>n.getAttribute("poster"),renderHTML:n=>({poster:n.poster})},width:{default:350},controls:{default:!0}}},parseHTML(){return[{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),poster:n.getAttribute("poster")})}]},renderHTML({HTMLAttributes:n}){return["video",{controls:"true",...n,src:null},["source",{src:n.src}]]},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent(`