@ones-editor/editor 0.0.3-beta.133 → 0.0.3-beta.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(`@keyframes ones-editor-blink{0%,to{background-color:transparent}50%{background-color:var(--primary-color)}}*{--link-color: #338fe5;--color-0: #e52727;--color-1: #eb6414;--color-2: #f0a100;--color-3: #24b47e;--color-4: #338fe5;--color-5: #9678d3;--color-6: #909090;--background-color-0: #fad4d4;--background-color-1: #fbe0d0;--background-color-2: #fceccc;--background-color-3: #d3f0e5;--background-color-4: #d6e9fa;--background-color-5: #eae4f6;--background-color-6: #dedede;--background-color-7: #e52727;--background-color-8: #eb6414;--background-color-9: #f0a100;--background-color-10: #24b47e;--background-color-11: #338fe5;--background-color-12: #9678d3;--background-color-13: #909090;--background-color-14: #e8e8e8;--font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif}div.editor-root{--text-color: #303030;--primary-color: #338fe5;--background-selection: #338fe533;--background-code: #cdcdcd40}div.editor-root{color:var(--text-color);position:relative;box-sizing:border-box;min-height:100%;width:100%;z-index:1}div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span.text.link{cursor:pointer}div.editor-root *{box-sizing:border-box;font-family:var(--font-family)}div.editor-root button{outline:none}div.editor-root.active div.editor-content .editor-cursor{opacity:1}div.editor-root .safari.mobile div.editor-content .editor-input{pointer-events:all;width:8px}div.editor-root div.editor-content{height:100%;width:100%;padding:0 30px 30px}div.editor-root div.editor-content .editor-cursor{position:absolute;background:var(--primary-color);width:2px;transition:top .1s ease-in,left .1s linear;animation:ones-editor-blink 1s ease-in-out infinite;opacity:0;pointer-events:none}div.editor-root div.editor-content .editor-input{position:absolute;opacity:0;pointer-events:none;width:16px;height:20px;font-size:16px}div.editor-root div.editor-content div[data-type=editor-container]{position:relative}div.editor-root div.editor-content div[data-type=editor-container].root{user-select:none;width:100%;cursor:text}div.editor-root div.editor-content div[data-type=editor-container].root>.container-blocks>*+*{margin-top:1em}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block]:not(:first-of-type){background-color:var(--background-selection)}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block]:not(:first-of-type) div[data-type=block-background]>.editor-selection-background{background-color:transparent!important}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block].embed-block>div[data-type=block-content]:before,div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block].embed-block .embed-selected-content:before{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]+div[data-type=editor-block][data-style-quoted]{margin-top:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block]{font-size:var(--font-size);line-height:var(--line-height);position:relative;--font-size: 15px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=center] div[data-type=block-content]{text-align:center}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=right] div[data-type=block-content]{text-align:end}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].block-hidden{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=text]{cursor:text}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]{word-break:break-word;position:relative}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span{cursor:text}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text{white-space:pre-wrap}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link{color:var(--link-color)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link:hover{text-decoration:underline}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link.style-strikethrough:hover{text-decoration:underline line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-bold{font-weight:700}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-italic{font-style:italic}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-underline{text-decoration:underline}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-strikethrough{text-decoration:line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-underline.style-strikethrough{text-decoration:underline line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-code{border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;background-color:var(--background-code);padding:4px;font:.8em Monaco,Consolas,"Andale Mono",DejaVu Sans Mono,monospace}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-sub{vertical-align:sub;font-size:70%}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-super{vertical-align:super;font-size:70%}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="0"]{color:var(--color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="1"]{color:var(--color-1)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="2"]{color:var(--color-2)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="3"]{color:var(--color-3)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="4"]{color:var(--color-4)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="5"]{color:var(--color-5)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="6"]{color:var(--color-6)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="0"]{background-color:var(--background-color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="1"]{background-color:var(--background-color-1)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="2"]{background-color:var(--background-color-2)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="3"]{background-color:var(--background-color-3)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="4"]{background-color:var(--background-color-4)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="5"]{background-color:var(--background-color-5)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="6"]{background-color:var(--background-color-6)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="7"]{background-color:var(--background-color-7)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="8"]{background-color:var(--background-color-8)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="9"]{background-color:var(--background-color-9)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="10"]{background-color:var(--background-color-10)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="11"]{background-color:var(--background-color-11)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="12"]{background-color:var(--background-color-12)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="13"]{background-color:var(--background-color-13)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="14"]{background-color:var(--background-color-14)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].inputting-insertion>span[data-type=insertion-content]{border-bottom:1px solid var(--primary-color)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion{width:0px;position:relative;display:inline-block;vertical-align:text-bottom;overflow:visible;height:1em}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content]{position:absolute;color:transparent;width:3px;left:-3px;border-right:var(--cursor-color) 1px solid;text-overflow:clip;display:inline-block;top:-5px;bottom:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content] span[data-cursor-name]{display:inline-block;width:8px;background-color:transparent;border:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content] span[data-cursor-name]:hover:before,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion.active>span[data-type=insertion-content] span[data-cursor-name]:before{content:attr(data-cursor-name);position:absolute;top:-12px;height:1.1em;background-color:var(--cursor-color);z-index:27;left:0px;color:#fff;white-space:nowrap;font-size:12px;display:flex;align-items:center;padding:1px 4px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=box-content]{border-radius:2px;margin-left:8px;margin-right:8px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=editor-box].br-box>span[data-type=box-content] img{vertical-align:middle;max-width:1em}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=editor-box][data-box-type=image].image-box span[data-type=box-content]{user-select:none;margin-left:0;margin-right:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-tools] .editor-block-anchor{position:absolute}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-background] .editor-selection-background{position:absolute;background-color:var(--background-selection);z-index:1;pointer-events:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block{cursor:default}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block.hover>div[data-type=block-content]{outline:1px solid #338fe5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block>div[data-type=block-content]{display:flex}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover .embed-hover-content{outline:1px solid #338fe5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content{position:relative}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected>div[data-type=block-content]:before,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content:before{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#338fe5;opacity:.1}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block{color:#909090;font-size:12px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block>div[data-type=block-content]{padding:5px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]{border-left:4px solid #e8e8e8;color:#909090}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]:not([data-list-level]){padding-left:8px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="1"]{--font-size: 28px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="2"]{--font-size: 26px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="3"]{--font-size: 24px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="4"]{--font-size: 22px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="5"]{--font-size: 20px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="6"]{--font-size: 18px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="7"]{--font-size: 16px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="8"]{--font-size: 14px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading]{font-size:var(--font-size);line-height:var(--line-height);font-weight:700}.editor-disable-scroll{position:fixed;left:0;top:0;width:100vw;height:100vh;z-index:9900;overflow:hidden}div:not(.comment-editor-root)>div.editor-root>div.editor-content>div[data-type=editor-container]>div.container-blocks>div[data-type=editor-block]:first-of-type{font-size:30px;line-height:1.3}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-anchor{position:absolute;pointer-events:none;z-index:-1}.editor-command-bar.toolbar .color-button{width:24px;height:24px;display:flex;padding:0;margin:0;align-items:center;justify-content:center;background-color:transparent;border:0;outline:0;border-radius:3px;cursor:pointer}.editor-command-bar.toolbar .color-button[data-color="0"]{color:var(--color-0)}.editor-command-bar.toolbar .color-button[data-color="1"]{color:var(--color-1)}.editor-command-bar.toolbar .color-button[data-color="2"]{color:var(--color-2)}.editor-command-bar.toolbar .color-button[data-color="3"]{color:var(--color-3)}.editor-command-bar.toolbar .color-button[data-color="4"]{color:var(--color-4)}.editor-command-bar.toolbar .color-button[data-color="5"]{color:var(--color-5)}.editor-command-bar.toolbar .color-button[data-color="6"]{color:var(--color-6)}.editor-command-bar.toolbar .color-button[data-background-color="0"]{background-color:var(--background-color-0)}.editor-command-bar.toolbar .color-button[data-background-color="1"]{background-color:var(--background-color-1)}.editor-command-bar.toolbar .color-button[data-background-color="2"]{background-color:var(--background-color-2)}.editor-command-bar.toolbar .color-button[data-background-color="3"]{background-color:var(--background-color-3)}.editor-command-bar.toolbar .color-button[data-background-color="4"]{background-color:var(--background-color-4)}.editor-command-bar.toolbar .color-button[data-background-color="5"]{background-color:var(--background-color-5)}.editor-command-bar.toolbar .color-button[data-background-color="6"]{background-color:var(--background-color-6)}.editor-command-bar.toolbar .color-button[data-background-color="7"]{background-color:var(--background-color-7)}.editor-command-bar.toolbar .color-button[data-background-color="8"]{background-color:var(--background-color-8)}.editor-command-bar.toolbar .color-button[data-background-color="9"]{background-color:var(--background-color-9)}.editor-command-bar.toolbar .color-button[data-background-color="10"]{background-color:var(--background-color-10)}.editor-command-bar.toolbar .color-button[data-background-color="11"]{background-color:var(--background-color-11)}.editor-command-bar.toolbar .color-button[data-background-color="12"]{background-color:var(--background-color-12)}.editor-command-bar.toolbar .color-button[data-background-color="13"]{background-color:var(--background-color-13)}.editor-command-bar.toolbar .color-button[data-background-color="14"]{background-color:var(--background-color-14)}.tippy-content{white-space:pre-line}.editor-button{min-height:26px;min-width:46px;font-size:12px;font-weight:500;outline:none;background-color:var(--editor-button-bg-color, #338fe5);color:var(--editor-button-color, #fff);border:0;padding:4px 8px;border-radius:4px;margin-right:8px;cursor:pointer}.editor-button:hover{background-color:#5ca5ea}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.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}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.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}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}[data-theme=dropdown-list]{border-radius:4px;background:white;position:relative;max-width:calc(100vw - 24px);box-shadow:#0f0f0f0d 0 0 0 1px,#0f0f0f1a 0 3px 6px,#0f0f0f33 0 9px 24px;overflow:hidden}[data-theme=dropdown-list] .tippy-content{padding:0;background:white;color:#303030}[data-theme=dropdown-list] .tippy-content .editor-command-bar{max-height:50vh}[data-theme=dropdown-list] .filterable-list{min-width:100px;max-width:300px;display:flex;flex-direction:column;max-height:100%}[data-theme=dropdown-list] .filterable-list .filter{padding:8px}[data-theme=dropdown-list] .filterable-list .filter .filter-container{width:100%;font-size:14px;line-height:20px;padding:3px 6px;position:relative;border-radius:3px;box-shadow:#0f0f0f1a 0 0 0 1px inset;background:rgba(242,241,238,.6);cursor:text;height:28px;box-sizing:border-box;display:flex;align-items:center}[data-theme=dropdown-list] .filterable-list .filter .filter-container input.filter-input{border:none;outline:none;flex-grow:1;background:transparent}[data-theme=dropdown-list] .filterable-list .list{max-height:60vh;overflow-y:auto;padding:8px 0}[data-theme=dropdown-list] .filterable-list .list .list-item{user-select:none;transition:background 20ms ease-in 0s;cursor:pointer;width:calc(100% - 8px);margin-left:4px;margin-right:4px;border-radius:3px;height:24px;padding:4px 8px;display:flex;align-items:center;box-sizing:border-box}[data-theme=dropdown-list] .filterable-list .list .list-item .list-text{white-space:nowrap}[data-theme=dropdown-list] .filterable-list .list .list-item.selected{background-color:#eee}[data-theme=dropdown-list] .filterable-list .list .list-item.disabled{color:#c1c1c1}::placeholder{color:#bbb}.toast{font-family:Avenir,Helvetica,Arial,sans-serif;visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:8px;position:fixed;z-index:1;left:50%;bottom:30px}.toast.show{visibility:visible;animation:toast_fade_in .5s,toast_fade_out .5s 2.5s}.toast.positioned.show{animation:toast_fade_in_positioned .5s,toast_fade_out_positioned .5s 2.5s}.toast.positioned{bottom:unset}@keyframes toast_fade_in{0%{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes toast_fade_out{0%{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes toast_fade_in_positioned{0%{opacity:0}to{opacity:1}}@keyframes toast_fade_out_positioned{0%{opacity:1}to{opacity:0}}div.tippy-box[data-theme=toolbar] .tippy-content,div.tippy-box[data-theme=menu] .tippy-content{padding:0}div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar.menu{min-width:180px}div.tippy-box button{outline:none}.editor-command-bar-root{display:flex;flex-direction:column;align-items:flex-start;padding:5px 0;background:#ffffff;box-shadow:0 0 1px #30303040,0 12px 24px #30303026;border-radius:2px;max-height:50vh;overflow:auto}.editor-command-bar{pointer-events:all;display:flex;box-sizing:border-box;--text-color: #606060;--primary-color: #338fe5;--selected-color: #f8f8f8;--separator-color: #dedede;--warn-color: #fdf4f4}.editor-command-bar.fixed.toolbar{box-shadow:none}.editor-command-bar.menu{flex:1;width:100%;display:flex;flex-direction:column;align-items:flex-start;padding:5px 0;overflow-y:scroll}.editor-command-bar.menu .command-item.standard{color:var(--text-color);user-select:none;transition:background 20ms ease-in 0s;cursor:pointer;width:100%;height:32px;padding:6px 10px;display:flex;align-items:center;box-sizing:border-box}.editor-command-bar.menu .command-item.standard .menu-item-icon{align-items:center;height:24px;width:24px;margin-right:5px;margin-top:-2px;display:flex;flex-direction:column;justify-content:center}.editor-command-bar.menu .command-item.standard .menu-item-name{white-space:nowrap;flex-grow:1;display:flex;align-items:center}.editor-command-bar.menu .command-item.standard .item-subtext{color:#b2bccd}.editor-command-bar.menu .command-item.standard .menu-item-sub-indicator{display:flex;align-items:center;justify-content:center}.editor-command-bar.menu .command-item.standard .menu-item-sub-indicator svg{width:16px;height:16px}.editor-command-bar.menu .command-item.standard.disabled{color:#c7c7c7;cursor:not-allowed}.editor-command-bar.menu .command-item.separator{height:1px;margin:4px 0;background-color:var(--separator-color);width:100%}.editor-command-bar.menu .command-item.section{font-size:.8em;color:#ccc;padding:5px 5px 5px 10px}.editor-command-bar.menu .command-item.selected{background-color:var(--selected-color)}.editor-command-bar.menu .command-item.selected[data-id=delete]{background-color:var(--warn-color)}.editor-command-bar.menu .command-item.selected.disabled{background-color:transparent}.editor-command-bar.menu .command-item.checked{color:var(--primary-color)}.editor-command-bar.menu .command-item.checked .menu-item-checked-icon{display:flex;align-items:center;justify-content:center;margin-left:10px}.editor-command-bar.menu .command-item.checked.disabled{color:#c7c7c7}.editor-command-bar.menu .command-item span.highlight{color:#e52727}.editor-command-bar.toolbar{display:flex;flex-direction:row;align-items:flex-start;padding:5px 10px;gap:5px;background:#ffffff;box-shadow:0 0 1px #30303033,0 8px 16px #30303026;border-radius:3px}.editor-command-bar.toolbar .command-item{background:transparent;border:none;display:flex;align-items:center;justify-content:center;color:var(--text-color);height:24px;padding:0;cursor:pointer;border-radius:3px;min-width:24px}.editor-command-bar.toolbar .command-item.selected:not(.disabled){background-color:var(--selected-color)}.editor-command-bar.toolbar .command-item.disabled{color:#c7c7c7}.editor-command-bar.toolbar .command-item.checked{color:var(--primary-color)}.editor-command-bar.toolbar .command-item.checked.disabled{color:#c7c7c7}.editor-command-bar.toolbar .command-item.separator{margin:auto 2px;height:20px;min-width:1px;width:1px;background-color:var(--separator-color);padding:0;pointer-events:none;cursor:default}.editor-command-bar.toolbar .command-item .toolbar-item-name-container,.editor-command-bar.toolbar .command-item .toolbar-item-icon-container{display:flex}.editor-command-bar.toolbar .command-item[data-dropdown=true]{padding-left:4px;padding-right:4px}.editor-command-bar.toolbar .command-item[data-dropdown=true] .toolbar-item-icon-container{width:24px;height:24px;align-items:center;justify-content:center}.editor-command-bar.toolbar .command-item .toolbar-item-dropdown-container{display:flex}.editor-command-bar.toolbar .command-item .toolbar-item-dropdown-container svg{transform:rotate(360deg);transition:transform .2s linear}.editor-command-bar.toolbar .command-item.active .toolbar-item-dropdown-container svg{transform:rotate(180deg)}.editor-command-bar.toolbar .editor-button+.editor-button{margin-left:5px}.editor-command-bar.footer{width:100%}.reference-hidden .tippy-box[data-reference-hidden]{opacity:0;pointer-events:none;transition:none}.tippy-box[data-theme~=light]{color:#26323d;box-shadow:0 0 20px 4px #9aa1b126,0 4px 80px -8px #24282f40,0 4px 4px -2px #5b5e6926;background-color:#fff}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}.editor-dropdown{display:flex;align-items:center;border:1px solid #f0f0f0;border-radius:3px;font-size:14px;width:200px;height:30px}.editor-dropdown *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.editor-dropdown .dropdown-text,.editor-dropdown .dropdown-input{flex-grow:1;padding:2px 8px;border:none;outline:none;background:transparent;font-size:14px;color:#333;min-width:0;flex-shrink:1}.editor-dropdown .dropdown-text{margin-right:4.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:100%;cursor:text;display:flex;align-items:center}.editor-dropdown:hover{border-color:#338fe5}.editor-dropdown.active{border-color:#338fe5;box-shadow:0 0 0 2px #338fe533}.editor-dropdown.active .dropdown-text{display:none}.editor-dropdown:not(.active) .dropdown-input{display:none}.editor-dropdown .dropdown-labels{display:flex;align-items:center;flex-shrink:0}.editor-dropdown .dropdown-labels .dropdown-label{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;border-radius:3px;display:flex;align-items:center}.editor-dropdown .dropdown-labels .dropdown-label+.dropdown-label{margin-left:5px}.editor-dropdown .dropdown-clear-icon,.editor-dropdown .dropdown-icon{flex-shrink:0;width:16px;height:16px;margin-left:4px;display:flex;align-items:center;justify-content:center;cursor:pointer}.editor-dropdown .dropdown-clear-icon{color:#909090}.editor-dropdown.empty .dropdown-clear-icon,.editor-dropdown:not(:hover) .dropdown-clear-icon{display:none}.editor-dropdown.empty .dropdown-text{color:#909090}.editor-dropdown .dropdown-icon{margin-right:4px}.scale-border:after,.color-palette .palette-container-row .background-color-button.selected:after,.color-palette .palette-container-row .background-color-button:hover:after{content:"";outline:1px solid #d6e9fa;border-radius:3px;position:absolute;left:0;right:0;top:0;bottom:0;transform:scale(1.1)}.color-palette{display:flex;flex-direction:column;align-items:center;padding-top:5px;background-color:#fff;--active-color: #2872b7}.color-palette .bar-desc{box-sizing:border-box;width:100%;height:24px;padding-left:10px;margin-bottom:10px;line-height:24px;font-size:12px;font-weight:500;background:#F8F8F8;color:#909090}.color-palette .palette-container{padding:0 10px}.color-palette .background-color .palette-container-row:first-child{margin-bottom:5px}.color-palette .palette-container-row{display:flex;flex-direction:row;margin-bottom:20px}.color-palette .palette-container-row .color-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;background-color:#fff;border:1px solid #f0f0f0;display:flex;margin:0;padding:0;align-items:center;justify-content:center}.color-palette .palette-container-row .color-button:hover{border:1px solid #d6e9fa}.color-palette .palette-container-row .color-button.selected{border:1px solid var(--primary-color)}.color-palette .palette-container-row .color-button[data-color-index="-1"]{color:var(--text-color)}.color-palette .palette-container-row .color-button[data-color-index="0"]{color:var(--color-0)}.color-palette .palette-container-row .color-button[data-color-index="1"]{color:var(--color-1)}.color-palette .palette-container-row .color-button[data-color-index="2"]{color:var(--color-2)}.color-palette .palette-container-row .color-button[data-color-index="3"]{color:var(--color-3)}.color-palette .palette-container-row .color-button[data-color-index="4"]{color:var(--color-4)}.color-palette .palette-container-row .color-button[data-color-index="5"]{color:var(--color-5)}.color-palette .palette-container-row .color-button[data-color-index="6"]{color:var(--color-6)}.color-palette .palette-container-row .background-color-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;position:relative}.color-palette .palette-container-row .background-color-button.selected:after{outline:1px solid var(--primary-color)}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]{position:relative;background-color:#fff;border:1px solid #e8e8e8}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]:after{transform:scale(1.2)}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]:before{content:"";position:absolute;width:1px;height:56px;top:2px;left:22px;background-color:#c7c7c7;transform:rotate(45deg) scale(.5);transform-origin:-1px -2px}.color-palette .palette-container-row .background-color-button[data-color-index="0"]{background-color:var(--background-color-0)}.color-palette .palette-container-row .background-color-button[data-color-index="1"]{background-color:var(--background-color-1)}.color-palette .palette-container-row .background-color-button[data-color-index="2"]{background-color:var(--background-color-2)}.color-palette .palette-container-row .background-color-button[data-color-index="3"]{background-color:var(--background-color-3)}.color-palette .palette-container-row .background-color-button[data-color-index="4"]{background-color:var(--background-color-4)}.color-palette .palette-container-row .background-color-button[data-color-index="5"]{background-color:var(--background-color-5)}.color-palette .palette-container-row .background-color-button[data-color-index="6"]{background-color:var(--background-color-6)}.color-palette .palette-container-row .background-color-button[data-color-index="7"]{background-color:var(--background-color-7)}.color-palette .palette-container-row .background-color-button[data-color-index="8"]{background-color:var(--background-color-8)}.color-palette .palette-container-row .background-color-button[data-color-index="9"]{background-color:var(--background-color-9)}.color-palette .palette-container-row .background-color-button[data-color-index="10"]{background-color:var(--background-color-10)}.color-palette .palette-container-row .background-color-button[data-color-index="11"]{background-color:var(--background-color-11)}.color-palette .palette-container-row .background-color-button[data-color-index="12"]{background-color:var(--background-color-12)}.color-palette .palette-container-row .background-color-button[data-color-index="13"]{background-color:var(--background-color-13)}.color-palette .palette-container-row .background-color-button[data-color-index="14"]{background-color:var(--background-color-14)}.color-palette .palette-container-row .color-button+.color-button{margin-left:5px}.color-palette .palette-container-row .background-color-button+.background-color-button{margin-left:5px}.color-palette .clear-button-container{box-sizing:border-box;width:100%;margin-bottom:5px;padding:0 10px}.color-palette .clear-button-container .clear-button{box-sizing:border-box;padding:3px 10px;width:100%;height:26px;background:#ffffff;color:#606060;border:1px solid #c7c7c7;border-radius:3px;cursor:pointer}.color-palette .clear-button-container .clear-button:hover{border-color:var(--primary-color);color:var(--primary-color)}.color-palette .clear-button-container .clear-button:active{border-color:var(--active-color);color:var(--active-color);background-color:#d6e9fa}.editor-input-wrap .editor-input-label{margin-top:8px;margin-bottom:8px;position:relative}.editor-input-wrap .editor-input-label.required:before{content:"*";color:#e82100;position:absolute;left:-8px;top:3px}.editor-input-wrap .editor-input-label .span{font-size:14px;line-height:1.4;font-weight:700;color:#303030}.editor-input-wrap .editor-input-container{display:flex;border:none;border-radius:4px;padding:4px;background-color:#fff}.editor-input-wrap .editor-input-container .editor-input{outline:none;border:1px solid #c7c7c7;border-radius:3px;padding:4px 10px;font-size:14px;line-height:1.4;color:#000;width:100%}.editor-input-wrap .editor-input-container .editor-input:focus{border-color:#338fe5;box-shadow:0 0 0 2px #338fe533}.editor-input-wrap.error .editor-input-container{border:1px solid #e82100}.editor-input-wrap.error .editor-input-container .editor-input{border:none;outline:none;box-shadow:unset}.editor-input-wrap.error .editor-input-error{margin-top:8px;color:red;display:block}.editor-input-wrap .editor-input-error{display:none}div.scroll-container-root{position:relative}div.scroll-container-root>div.scroll-container{position:relative;overflow-x:auto;overflow-y:hidden;box-sizing:border-box;line-height:0px}div.scroll-container-root>div.scroll-container>.scroll-area{position:relative;display:inline-block;overflow:hidden;line-height:normal}div.scroll-container-root>div.scroll-container{scrollbar-width:none}div.scroll-container-root>div.scroll-container::-webkit-scrollbar{height:0;opacity:0}div.scroll-container-root>div.container-scroll-tool .container-border-shadow{position:absolute;top:0;opacity:0;width:0;border:none;pointer-events:none;transition:opacity 50ms ease-in;z-index:1}div.scroll-container-root>div.container-scroll-tool .container-right-border-shadow{right:0;background:linear-gradient(90deg,rgba(31,35,41,0) 0,rgba(31,35,41,.1));border-right:0px solid #dee0e3}div.scroll-container-root>div.container-scroll-tool .container-left-border-shadow{left:0;background:linear-gradient(270deg,rgba(31,35,41,0) 0,rgba(31,35,41,.1));border-left:0px solid #dee0e3}div.scroll-container-root>div.container-scroll-tool .container-border-shadow.active{width:8px;opacity:1}div.scroll-container-root>div.container-scroll-tool .container-right-border-shadow.active{border-right-width:1px}div.scroll-container-root>div.container-scroll-tool .container-left-border-shadow.active{border-left-width:1px}div.scroll-container-root>div.container-scroll-tool .container-scrollbar{position:absolute;left:0;z-index:1000;visibility:visible;overflow-x:auto;overflow-y:hidden;cursor:auto}div.scroll-container-root>div.container-scroll-tool .container-scrollbar div{height:1px}div.scroll-container-root>div.container-scroll-tool div.container-scrollbar.fixed{position:fixed}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar{opacity:.6;transition:opacity .1s ease-in-out}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar{height:8px}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-track{background-color:transparent}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-thumb{background-color:#646a73cc;border-radius:8px}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-button{display:none}[data-tippy-root]{font-family:Avenir,Helvetica,Arial,sans-serif}[data-command-bar-id=editor-toolbar]{padding-top:10px;padding-bottom:5px}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text]{height:32px;width:unset}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text].selected:hover{background-color:transparent}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text] .link-href-button{max-width:275px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#303030;text-decoration:none}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text] .link-href-button:hover{text-decoration:underline}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link],[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link]{height:32px}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link] svg,[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link] svg{stroke-width:2}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link].selected:hover,[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link].selected:hover{background-color:transparent;color:#338fe5}[data-command-bar-id=quick-menu],[data-command-bar-id=empty-block-menu]{box-sizing:border-box;width:240px}[data-command-bar-id=quick-menu] .command-item.menu-item,[data-command-bar-id=empty-block-menu] .command-item.menu-item{width:100%;cursor:pointer}[data-command-bar-id=quick-menu] .command-item.menu-item.section,[data-command-bar-id=empty-block-menu] .command-item.menu-item.section{height:24px;padding:2px 10px;font-weight:500;font-size:12px;line-height:20px;color:#909090;background:#F8F8F8;min-height:initial;box-sizing:border-box;margin-bottom:5px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item{color:#303030;display:flex;width:100%;padding:6px 10px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container{display:flex;align-items:center;justify-content:center;padding-right:6px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container .quick-menu-item-icon,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container .quick-menu-item-icon{width:16px;height:16px;display:flex;align-items:center;justify-content:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content{flex-grow:1;display:flex;flex-direction:column;justify-content:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1{display:flex;align-items:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-name,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-name{flex-grow:1;font-size:14px;line-height:22px;color:#303030}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-subtext,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-subtext{color:#b2bccd}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .quick-menu-item-submenu-icon,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .quick-menu-item-submenu-icon{display:flex;align-items:center;margin-left:12px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2{margin-top:5px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2 .item-markdown,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2 .item-markdown{color:#b2bccd}[data-command-bar-id=quick-menu] .command-item.menu-item[data-id=placeholder] .quick-menu-item-icon-container,[data-command-bar-id=empty-block-menu] .command-item.menu-item[data-id=placeholder] .quick-menu-item-icon-container{display:none}[data-command-bar-id=quick-menu] .command-item.menu-item[data-id=placeholder] .item-name.text,[data-command-bar-id=empty-block-menu] .command-item.menu-item[data-id=placeholder] .item-name.text{color:#909090!important;padding:5px 0}[data-command-bar-id=block-menu]{width:240px}div.tippy-box[data-theme=editor-tooltip]{background-color:#303030;opacity:.8;font-size:12px;border-radius:3px}div.tippy-box[data-theme=editor-tooltip] .editor-tooltip-desc{display:block;margin-top:2px;color:#a8a9ab}div.tippy-box[data-theme=editor-tooltip]>.tippy-arrow:before{transform:scale(.8)}div.tippy-box[data-theme=editor-tooltip]>.tippy-content{padding:4px 10px;text-align:justify}.link-popup-content{padding:10px 7px}.link-popup-content .link-popup-gap{margin-top:16px}.link-popup-content .editor-input-container{padding:4px 0}.link-popup-content .editor-input-container .editor-input{width:330px;line-height:1.5}.link-popup-content .editor-input-wrap .editor-input-label{margin-bottom:4px}.link-popup-content .link-popup-footer{margin:10px 0 5px;text-align:right}.link-popup-content .link-popup-footer button{min-width:58px;min-height:30px;padding:0 10px;border-radius:3px;background-color:#eef3f8;font-size:14px;color:#fff;cursor:pointer;outline:none}.link-popup-content .link-popup-footer .cancel-button{margin:0 8px 0 0;background-color:transparent;border:1px solid #c7c7c7;color:#606060}.link-popup-content .link-popup-footer .cancel-button:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.link-popup-content .link-popup-footer .submit-button{outline:none;background-color:#338fe5;color:#fff;border:0}.link-popup-content .link-popup-footer .submit-button:disabled{color:#fff;background-color:#338fe580}.link-popup-content .link-popup-footer .submit-button:disabled:hover{background-color:#338fe580}.link-popup-content .link-popup-footer .submit-button:hover{background-color:#5ca5ea}:root{--mindmap-bg-color: #f0f2f4}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.focused [data-type=block-tools] .editor-mindmap-svg{border-radius:3px;outline:1px solid #338FE5}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.editor-in-mindmap-first{height:600px;min-width:150px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content]{margin-right:24px;transition:background-color .25s linear}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .editor-mindmap-svg{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2;font-size:14px;background-color:var(--mindmap-bg-color)}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar{position:absolute;top:8px;right:8px;height:24px;z-index:3}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar .editor-button.mindmap-button{background-color:transparent;outline:none;border:none;fill:none;color:#c1c1c1;cursor:pointer;min-width:initial;margin-right:0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar .editor-button.mindmap-button:hover{color:#5587f0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.to-mindmap-highlight [data-type=block-content],.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.to-mindmap-highlight:hover [data-type=block-content]{background-color:#eaf3fc}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-to-mindmap-wrap,.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .mention-button-wrap{position:absolute;right:0;top:2px;display:flex;align-items:center;height:calc(var(--font-size) * var(--line-height))}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-to-mindmap],.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=mention-button]{flex-grow:0;flex-shrink:0;width:24px;height:24px;min-width:24px;min-height:24px;padding:0;border:0;outline:0;display:flex;align-items:center;justify-content:end;background-color:transparent;color:#07142a}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-to-mindmap] svg,.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=mention-button] svg{width:16px;height:16px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-block-mention]:hover>svg{cursor:initial;background-color:#eee}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button+button[data-button-id=list-block-mention]{right:20px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="1"]{padding-left:24px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="1"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="2"]{padding-left:48px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="2"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="3"]{padding-left:72px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="3"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="4"]{padding-left:96px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="4"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="5"]{padding-left:120px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="5"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="6"]{padding-left:144px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="6"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="7"]{padding-left:168px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="7"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="8"]{padding-left:192px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="8"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="9"]{padding-left:216px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="9"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="10"]{padding-left:240px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="10"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="11"]{padding-left:264px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="11"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="12"]{padding-left:288px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="12"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=list][data-list-level="1"]{padding-left:0}div.editor-root div.editor-content div[data-block-type=list][data-list-level="2"]{padding-left:24px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="3"]{padding-left:48px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="4"]{padding-left:72px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="5"]{padding-left:96px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="6"]{padding-left:120px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="7"]{padding-left:144px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="8"]{padding-left:168px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="9"]{padding-left:192px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="10"]{padding-left:216px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="11"]{padding-left:240px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="12"]{padding-left:264px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block+div[data-type=editor-block].list-block{margin-top:0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block{display:flex;padding-bottom:2px;padding-top:2px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=text-only] .list-container{pointer-events:none}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=checked] div[data-type=block-content] span.text{color:#c7c7c7}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=unordered] .list-container .list-marker{font-family:PingFangSC-Regular,PingFang SC;justify-content:space-around}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content]{position:relative;flex-grow:1;padding-left:2px;margin-right:29px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-container{display:flex;min-width:24px;align-items:center;justify-content:center;flex-shrink:0;border-radius:3px;height:calc(var(--font-size) * var(--line-height))}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-container .list-marker{min-width:16px;border:none;background-color:transparent;outline:none;display:flex;align-items:center;justify-content:flex-end;padding:0;overflow:visible;color:var(--primary-color);font-size:var(--font-size)}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block div[data-type=block-tools] .block-helper{top:2px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=center]{justify-content:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=center]>div[data-type=block-content]{flex-grow:initial}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=right]{justify-content:flex-end}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=right]>div[data-type=block-content]{flex-grow:initial}.editor-root.readonly button[data-button-id=mindmap-close]{display:none}.editor-root:not(.readonly) div[data-type=editor-block].list-block.active,.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover{background-color:#f8f8f8}.editor-root:not(.readonly) div[data-type=editor-block].list-block.active .list-container,.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover .list-container{cursor:pointer}.editor-root:not(.readonly) div[data-type=editor-block].list-block .list-container:hover .list-marker{cursor:pointer}.editor-root:not(.readonly) div[data-type=editor-block].list-block:not([data-list-type=unchecked]):not([data-list-type=checked]):not([data-list-type=unordered]) .list-container:hover{background-color:var(--background-selection)}.editor-root:not(.readonly) div[data-type=editor-block].list-block[data-list-type=unordered] .list-container:hover .list-marker{cursor:initial}.editor-root:not(.readonly) div[data-type=editor-block].list-block[data-list-type=unchecked] .list-container:hover .list-marker svg>*{fill:var(--background-selection)}[data-tippy-root] .customize-start-panel{max-width:350px;padding:0 16px;color:#333;font-size:14px;line-height:21px;user-select:none;background-color:#fff!important}[data-tippy-root] .customize-start-panel-input{width:64px;margin:0 8px;border:1px solid #cfd6e1;height:24px;border-radius:3px;padding:1px 0 1px 8px;outline:none;color:inherit;background-color:#fff}[data-tippy-root] .customize-start-panel-button{min-width:40px;font-size:12px;min-height:30px;margin:0 8px 0 0;background-color:var(--primary-color);color:#fff;outline:none;border:none;padding:4px 8px;border-radius:4px;cursor:pointer}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block].list-block [data-type=block-content][data-content-placeholder]:before{left:2px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.math-box{display:inline-flex}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.math-box .mathjax-tex-text.mathjax-error{color:var(--color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax{max-width:100%}div.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=math]>div[data-type=block-content]{align-items:center;justify-content:center;min-height:40px}div.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=math]>div[data-type=block-content] img{margin:auto;padding:8px}.mathjax-editor-textarea{border:none;outline:none;width:400px;height:128px}.editor-text-button{border:0;color:var(--text-button-color, #c1c1c1);background-color:var(--text-button-bg-color, transparent);cursor:pointer;border-radius:var(--editor-border-radius, 3px);font-size:14px;padding:1px 6px;display:flex;align-items:center}.editor-text-button:hover{color:var(--text-button-color-hover, #5587F0);background-color:var(--text-button-bg-color-hover, transparent)}div[data-type=editor-block].table-block{--table-bar-width: 6px;--table-bar-left: -6px;--table-bar-top: -6px}div[data-type=editor-block].table-block>div[data-type=block-content]{position:relative;left:-26px}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content]:after{display:none}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content] div[data-type=table-content],div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content] div[data-type=table-content]{position:relative}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content] div[data-type=table-content]:after,div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content] div[data-type=table-content]:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#303030;opacity:.1}div[data-type=editor-block].table-block div[data-type=table-tools] .table-resize-gripper{position:absolute;background-color:transparent;cursor:col-resize;padding:0 2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-resize-gripper>.table-resize-gripper-indicator{pointer-events:none;background-color:var(--primary-color);width:100%;height:100%}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container{position:absolute;background-color:transparent;z-index:10}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container.top{left:var(--table-bar-left);top:var(--table-bar-top);right:0;height:var(--table-bar-width);flex-direction:row}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container.left{top:0;left:var(--table-bar-left);width:var(--table-bar-width);bottom:0;flex-direction:column}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar{position:absolute;left:0;top:0;right:0;bottom:0;cursor:pointer;display:flex}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar.left{flex-direction:column}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell{background-color:#e8e8e8;position:relative;flex-grow:0;flex-shrink:0}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.corner{width:var(--table-bar-width)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.top{height:100%}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell:hover{background-color:#dedede}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.selected{background-color:var(--primary-color)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.danger{background-color:#e52727}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root{position:relative}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.top{max-width:0;width:0;overflow:visible}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.top:last-child{margin-left:-2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.left{max-height:0;height:0;overflow:visible}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.left:last-child{margin-top:-2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container{position:absolute;width:26px;height:26px;display:flex;align-items:center;justify-content:center;z-index:1}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container.top{right:-14px;top:-22px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container.left{transform:rotate(270deg);left:-22px;bottom:-14px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .insert-indicator{position:absolute;width:3px;height:3px;background:#e8e8e8;border-radius:50%;margin-top:6px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-indicator{display:none}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-column-button{display:unset}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-column-button span.icon{margin-top:2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .drop-marker{opacity:1;transform:scale(.7)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker{width:26px;height:26px;border-radius:3px;background:var(--primary-color);cursor:pointer;opacity:0;transform:scale(.4);transition:transform .2s ease-in,opacity .2s ease-in}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker:after{content:"";display:block;width:10px;height:1px;background-color:#fff;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker:before{content:"";display:block;width:1px;height:10px;background-color:#fff;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}div[data-type=editor-block].table-block div[data-type=table-tools] .editor-table-chart{padding-top:16px}div[data-type=editor-block].table-block div[data-type=table-content]{position:relative}div[data-type=editor-block].table-block div[data-type=table-content]>.error{color:red;border:1px solid red;padding:8px}div[data-type=editor-block].table-block div[data-type=table-content]>table{border-collapse:collapse;width:max-content;border-spacing:0}div[data-type=editor-block].table-block div[data-type=table-content]>table colgroup col{min-width:40px}div[data-type=editor-block].table-block div[data-type=table-content]>table,div[data-type=editor-block].table-block div[data-type=table-content]>table td,div[data-type=editor-block].table-block div[data-type=table-content]>table th{border:1px solid #c7c7c7;background-color:transparent}div[data-type=editor-block].table-block div[data-type=table-content]>table tr td.danger{background-color:#fce9e9!important}div[data-type=editor-block].table-block div[data-type=table-content]>table td{min-width:40px;padding:0;position:relative}div[data-type=editor-block].table-block div[data-type=table-content]>table td .table-cell-menu-btn{display:none;position:absolute;right:2px;top:2px;padding:0;width:16px;height:16px;border:none;border-radius:3px;background:#eaf3fc;color:#338fe5;cursor:pointer;transform:rotate(0);transition:transform .2s}div[data-type=editor-block].table-block div[data-type=table-content]>table td .table-cell-menu-btn.active{transform:rotate(180deg)}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child{padding:8px}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child div[data-type=editor-block].table-block>div[data-type=block-content]{pointer-events:none}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child div[data-type=editor-block].table-block>div[data-type=block-content] div[data-type=table-content]{pointer-events:auto}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-0{background-color:var(--background-color-0)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-1{background-color:var(--background-color-1)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-2{background-color:var(--background-color-2)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-3{background-color:var(--background-color-3)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-4{background-color:var(--background-color-4)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-5{background-color:var(--background-color-5)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-6{background-color:var(--background-color-6)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-7{background-color:var(--background-color-7)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-8{background-color:var(--background-color-8)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-9{background-color:var(--background-color-9)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-10{background-color:var(--background-color-10)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-11{background-color:var(--background-color-11)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-12{background-color:var(--background-color-12)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-13{background-color:var(--background-color-13)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-14{background-color:var(--background-color-14)}div[data-type=editor-block].table-block div[data-type=table-content]>table.row-title>tbody>tr:first-child>td,div[data-type=editor-block].table-block div[data-type=table-content]>table.col-title td.col-title-item{background-color:#f8f8f8}div[data-type=editor-block].table-block div[data-type=table-content]>table.stripe:not(.row-title)>tbody>tr:nth-of-type(2n),div[data-type=editor-block].table-block div[data-type=table-content]>table.stripe.row-title>tbody>tr:nth-of-type(2n + 1){background-color:#f5f8fb}div[data-type=editor-block].table-block div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block div[data-type=table-content]>.no-border>tbody>tr>td{border:1px dashed;border-color:transparent}div[data-type=editor-block].table-block.focused div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block.focused div[data-type=table-content]>table.no-border>tbody>tr>td,div[data-type=editor-block].table-block.child-focused div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block.child-focused div[data-type=table-content]>table.no-border>tbody>tr>td{border-color:#b9bfc8}div[data-type=editor-block].table-block.full-selected>div[data-type=block-content]>.scroll-container-root>.scroll-container>.scroll-area>div[data-type=table-content]>table{background-color:var(--background-selection)}div[data-type=editor-block].table-block div[data-type=table-content]>table tbody tr td.selected,div[data-type=editor-block].table-block div[data-type=table-content]>table.row-title tbody tr td.selected,div[data-type=editor-block].table-block div[data-type=table-content]>table.col-title tbody tr td.selected{background-color:var(--background-selection)}div[data-type=editor-block].table-block div[data-type=table-content]>table td div[data-type=editor-block].table-block div[data-type=table-content]>table{max-width:100%}.command-item.menu-item .table-creator{background-color:#fff;padding:0 5px}.command-item.menu-item .table-creator .table-creator-row{display:flex}.command-item.menu-item .table-creator .table-creator-row .table-creator-cell{width:16px;height:16px;margin:3px;border:solid 1px #ddd}.command-item.menu-item .table-creator .table-creator-row .table-creator-cell.active{background-color:#99c7f2}div.editor-root div.editor-content div[data-type=editor-container].root div[data-type=editor-block].table-block{margin-top:0}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color]{width:100%}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .bar-desc{display:none}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item{box-sizing:border-box;width:100%;height:32px;padding:5px 10px;display:flex;align-items:center;justify-content:space-between;color:var(--text-color)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-sub-indicator{display:flex;align-items:center;margin-left:5px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-sub-indicator svg{height:16px;width:16px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;position:relative;margin-left:auto}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]{position:relative;background-color:#fff;border:1px solid #e8e8e8}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]:after{transform:scale(1.2)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]:before{content:"";position:absolute;width:1px;height:56px;top:2px;left:22px;background-color:#c7c7c7;transform:rotate(45deg) scale(.5);transform-origin:-1px -2px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="0"]{background-color:var(--background-color-0)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="1"]{background-color:var(--background-color-1)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="2"]{background-color:var(--background-color-2)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="3"]{background-color:var(--background-color-3)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="4"]{background-color:var(--background-color-4)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="5"]{background-color:var(--background-color-5)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="6"]{background-color:var(--background-color-6)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="7"]{background-color:var(--background-color-7)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="8"]{background-color:var(--background-color-8)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="9"]{background-color:var(--background-color-9)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="10"]{background-color:var(--background-color-10)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="11"]{background-color:var(--background-color-11)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="12"]{background-color:var(--background-color-12)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="13"]{background-color:var(--background-color-13)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="14"]{background-color:var(--background-color-14)}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table]{background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.row-title>tbody>tr:first-child>td,div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.col-title td.col-title-item{background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.stripe:not(.row-title)>tbody>tr:nth-of-type(2n),div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.stripe.row-title>tbody>tr:nth-of-type(2n + 1){background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment{box-shadow:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment table{box-shadow:0 2px #f8e6ab}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment table table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment table table{box-shadow:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active{outline:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active table{border-bottom:none;outline:4px solid #f8e6ab}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active table table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active table table{box-shadow:none;outline:none}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=center] [data-type=block-content][data-content-placeholder]:before{justify-content:center}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=right] [data-type=block-content][data-content-placeholder]:before{justify-content:right}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-title-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-title-placeholder);color:#c7c7c7}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-content-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-content-placeholder);color:#c7c7c7;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-tools] .block-placeholder-container{position:absolute;left:0;top:0;right:0}div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-title-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-title-placeholder-readonly);color:#c7c7c7}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block{min-width:360px;counter-reset:code-line}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.full-selected{background-color:var(--background-selection)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.editing-language div[data-type=block-tools] .code-block-header,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.child-focused div[data-type=block-tools] .code-block-header,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:hover div[data-type=block-tools] .code-block-header{opacity:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.wrap>div[data-type=block-tools] .code-block-header button[data-id=wrap] *{color:var(--primary-color)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child{overflow-x:auto}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]{word-break:keep-all;overflow:visible;white-space:pre}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]>span.text,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]>span.inputting-insertion{white-space:pre}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header{opacity:0;transition:opacity .3s ease-in 0s;position:absolute;top:0;display:flex;padding-left:16px;padding-right:4px;align-items:center;left:0;right:0;height:32px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .language-select{font-size:14px;color:#999;cursor:pointer;display:flex;align-items:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .language-select .arrow-icon{width:16px;height:16px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-spacer{flex-grow:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button{display:flex;justify-content:center;align-items:center;border:none;border-radius:2px;margin-left:4px;padding:0;background:none;outline:none;color:#c1c1c1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button:not(.disabled){cursor:pointer}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button:not(.disabled):hover{color:#5587f0}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button.disabled{cursor:not-allowed}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button[data-id=caption]{margin-right:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-icon{height:24px;display:flex;align-items:center;justify-content:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-icon>svg{width:24px;height:24px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-label{margin-left:4px;font-size:14px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.full-selected>div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:unset}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:var(--background-code)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container]{padding-left:32px;padding-top:32px;padding-bottom:24px;border-radius:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container].selected{background-color:var(--background-selection)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] *{font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:14px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block+div.text-block{margin-top:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block:before{content:counter(code-line);counter-increment:code-line;position:absolute;left:-48px;top:10px;z-index:1;margin-top:-4px;display:block;width:48px;padding-right:8px;text-align:right;color:#aaa;box-sizing:border-box;font-size:12px;font-weight:400;line-height:12px;letter-spacing:0;white-space:nowrap;opacity:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-comment,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-prolog,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-doctype,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-cdata{color:#708090}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-punctuation{color:#999}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-namespace{opacity:.7}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-property,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-tag,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-boolean,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-number,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-constant,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-symbol,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-deleted{color:#905}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-selector,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-attr-name,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-string,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-char,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-builtin,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-inserted{color:#690}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-operator,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-entity,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-url,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-string{color:#9a6e3a}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-atrule,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-attr-value,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-keyword{color:#07a}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-function,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-class-name{color:#dd4a68}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-regex,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-important,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-variable{color:#e90}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-important,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-bold{font-weight:700}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-italic{font-style:italic}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-entity{cursor:help}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-caption-root{padding:8px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-caption-root *{color:#aaa}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .code-header-button[data-id=wrap],div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .code-header-button[data-id=caption]{display:none}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .language-select{cursor:default!important}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .language-select .arrow-icon{display:none}div.editor-root div.editor-content div[data-type=editor-container].root.select-all div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:unset}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer{position:absolute;background-color:transparent;border:1px solid #338FE5;pointer-events:none;z-index:1;display:none}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active{display:block}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper{position:absolute;width:16px;height:16px;border:2px solid white;background-color:#338fe5;border-radius:50%;pointer-events:all}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom{left:calc(50% - 8px);bottom:-8px;cursor:ns-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left{left:-8px;top:-8px;cursor:nwse-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right{right:-8px;top:-8px;cursor:nesw-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left{left:-8px;bottom:-8px;cursor:nesw-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right{right:-8px;bottom:-8px;cursor:nwse-resize}div.editor-root.readonly div.editor-content div[data-type=editor-block]>[data-type=block-tools] .block-resizer{display:none}.before-content,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active:before,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected:not(.focused) [data-type=block-content] .images .image-container:before{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#338fe5;opacity:.1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image]{display:flex}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].block-hidden{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image][data-style-align=left]{justify-content:flex-start}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image][data-style-align=right]{justify-content:flex-end}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content]{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content] .images .image-container.empty:hover,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content] .images .image-container.error:hover{outline:1px solid #338FE5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content]:before{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content]{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active .image-warning{opacity:0;z-index:-1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].multi [data-type=block-tools] .block-resizer{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image]:not(.multi) [data-type=block-content] .images.empty{min-height:400px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content]{cursor:default}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images{width:100%;display:flex;align-items:flex-start}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter{width:10px;flex-grow:0;flex-shrink:0;padding:0 4px;cursor:col-resize;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter .image-splitter-indicator{width:100%;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter:active .image-splitter-indicator,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter:hover .image-splitter-indicator{background-color:#d9d9d9}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container{position:relative;flex:1;background-color:#f8f8f8;display:flex;min-height:inherit;overflow:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container img{max-width:100%;width:100%;height:auto}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty .upload-image-icon{display:flex;color:#c7c7c7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.error{height:100%;outline:1px solid #DEDEDE;border-radius:3px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.error img{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;z-index:1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-icon,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-icon{display:flex;color:#c7c7c7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message{display:flex;flex-direction:column;align-items:center;overflow:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-1,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-1{margin-top:10px;font-size:18px;font-weight:500;color:#303030;height:26px;vertical-align:middle;line-height:26px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex-shrink:0}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-2,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-3,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-2,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-3{font-size:14px;color:#606060;vertical-align:middle;height:22px;line-height:22px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex-shrink:0}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-2 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-3 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-2 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-3 a{text-decoration:none;color:#338fe5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .line-3 a{display:inline-flex;align-items:center;text-decoration:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .line-3 a:after{content:" ";display:inline-block;width:16px;height:16px;margin-left:5px;background-image:url("data:image/svg+xml,%3Csvg width='17' height='16' viewBox='0 0 17 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.5 2H3.5C2.94772 2 2.5 2.44772 2.5 3V13C2.5 13.5523 2.94772 14 3.5 14H13.5C14.0523 14 14.5 13.5523 14.5 13V10' stroke='%23338FE5'/%3E%3Cpath d='M14.5 2L9 7.5' stroke='%23338FE5'/%3E%3Cpath d='M8.5 2H14.5V8' stroke='%23338FE5'/%3E%3C/svg%3E%0A")}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#303030;opacity:.8;display:flex;align-items:center;justify-content:center}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask .uploading-progress-bar{width:75%;height:6px;border-radius:3px;display:flex;background-color:#fff}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value{background-color:#338fe5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .image-warning{position:absolute;right:5px;top:5px;color:#fff;background-color:#333;width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:3px;z-index:2;transition:opacity linear .2s;opacity:.7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty{display:flex;flex-direction:column;align-items:center;outline:1px solid #DEDEDE;border-radius:3px;justify-content:center;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty svg{width:48px;height:48px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-tools] .drag-container{display:flex;box-sizing:content-box;pointer-events:none;position:fixed;z-index:100;background-color:#fff;border:1px solid #338FE5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-tools] .drag-container .drag-target{width:100%}.editor-root[readonly=true] .image-splitter{visibility:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment{box-shadow:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment [data-type=block-content]{box-shadow:0 2px #f8e6ab}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment.active{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment.active [data-type=block-content]{box-shadow:none;outline:4px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block].dragging div[data-type=block-tools] .block-helper{opacity:0}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper{position:absolute;right:100%;top:0;padding-right:5px;display:flex;align-items:center}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .helper-sizer{width:0;opacity:0;pointer-events:none}div[data-type=editor-block].locked-by-self>[data-type=block-content],div[data-type=editor-block].locked-by-others>[data-type=block-content]{position:relative}div[data-type=editor-block].locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others>[data-type=block-content]:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;z-index:1;background-color:#303030;opacity:.1}div[data-type=editor-block].locked-by-self.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-self.locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.locked-by-self>[data-type=block-content]:after{pointer-events:none}div[data-type=editor-block].locked-by-self.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.text-block>[data-type=block-content]:after{outline:2px solid #303030}.editor-root{--selected-color: #e8e8e8}.editor-root .editor-content.dragging *{cursor:grabbing!important}.editor-root .editor-content.dragging div[data-type=editor-block] iframe{pointer-events:none}.editor-root .editor-content .editor-drop-indicator{position:absolute;background-color:var(--primary-color);pointer-events:none;transition:top .2s linear,left .2s linear,width .2s linear}.editor-root .editor-content div[data-type=editor-block].text-block.highlighted{outline:2px solid var(--background-selection);background-color:var(--background-selection)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button{width:24px;height:24px;cursor:grab;margin:0;padding:0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:3px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button:hover{background-color:var(--selected-color)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button svg{width:16px;height:16px;color:#909090}.drag-image-container{position:fixed;z-index:100;box-shadow:0 3px 20px #00000026;background-color:#fff;opacity:.4}.drag-image-container.drag-placeholder{width:500px;height:200px;border:1px solid #dedede;border-radius:3px;background:#e8e8e8}.drag-image-container .drag-image{width:100%;display:none}.drag-image-container[data-status=loaded] .drag-image{display:block}.drag-image-container[data-status=loaded] .drag-loading{display:none}.editor-command-bar-root .editor-command-bar .command-item.menu-item{display:flex;align-items:center;flex:none}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles{padding:5px 10px;background-color:#fff}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section+.text-style-section{margin-top:5px}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section{display:flex;flex-wrap:wrap}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon{width:24px;height:24px;padding:0;margin:0 5px 0 0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;outline:none;cursor:pointer;border-radius:3px;color:#606060}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon:hover{background-color:var(--selected-color)}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon.active{color:#338fe5}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-anchor[data-id=paste-special-button-anchor]{z-index:unset}[data-command-bar-id=paste-special-button] .editor-command-bar.toolbar{padding:0}[data-command-bar-id=paste-special-button] .editor-command-bar.toolbar .command-item[data-dropdown=true]{padding-left:5px;padding-right:5px}.editor-find-dialog{--popover-input-border: 1px solid #CFD6E1;--editor-find-dialog-input-container-border-color: #CFD6E1;--editor-find-dialog-input-container-bg-color: transparent;--editor-border-radius-big: 3px;--editor-color: #07142A;--button-black-text-color: #333;--editor-find-dialog-button-color: #333;--editor-find-dialog-icon-button-color: #333;--editor-find-dialog-button-border-bg-color: rgba(255, 255, 255, .56);--editor-find-dialog-input-placeholder-color: #b9bfc8;--editor-find-dialog-button-disabled-color: #ccc !important;--editor-find-dialog-button-hover-color: rgba(150, 150, 150, .2);--editor-find-dialog-button-border: solid 1px #ccc;box-sizing:border-box;width:400px;background-color:var(--editor-find-dialog-bg-color);border:var(--editor-find-dialog-border);border-radius:var(--editor-border-radius-big);display:flex;padding:8px 8px 0 16px;align-items:flex-start;font-size:14px;font-family:var(--editor-font-family)}.editor-find-dialog .editor-find-content{display:flex;flex-direction:column;flex-grow:1;font-family:inherit}.editor-find-dialog .editor-find-dialog-row{display:flex;margin-bottom:8px;align-items:center}.editor-find-dialog .editor-find-dialog-label{width:80px;flex-grow:0;flex-shrink:0;align-self:center}.editor-find-dialog .editor-find-dialog-input-container{border:var(--popover-input-border);border-color:var(--editor-find-dialog-input-container-border-color);background-color:var(--editor-find-dialog-input-container-bg-color);border-radius:var(--editor-border-radius-big);flex-grow:1;display:flex;padding:2px;align-items:center;height:32px;box-sizing:border-box}.editor-find-dialog .editor-find-dialog-input{border:none;flex-grow:1;width:80px;outline:none;background-color:transparent;color:var(--editor-color)}.editor-find-dialog .editor-find-dialog-input::placeholder{color:var(--editor-find-dialog-input-placeholder-color);opacity:1}.editor-find-dialog .editor-find-dialog-prev{width:24px}.editor-find-dialog .editor-find-dialog-curr{flex-grow:0;text-align:center;flex-shrink:1;display:flex;align-items:center;margin-bottom:2px}.editor-find-dialog .editor-find-dialog-next{width:24px}.editor-find-dialog .editor-find-dialog-icon-button{cursor:pointer;border-radius:4px;color:var(--editor-find-dialog-icon-button-color);background-color:var(--editor-find-dialog-button-border-bg-color);border:none;display:flex;padding:0}.editor-find-dialog .editor-find-dialog-button{padding:6px 16px;cursor:pointer;border-radius:4px;color:var(--editor-find-dialog-button-color);background-color:var(--editor-find-dialog-button-border-bg-color);margin:0 4px;border:none;font-family:inherit;line-height:21px}.editor-find-dialog .editor-find-dialog-button.icon-button{width:32px;height:32px}.editor-find-dialog .editor-find-dialog-button.active,.editor-find-dialog .editor-find-dialog-button:hover{background-color:var(--editor-find-dialog-button-hover-color)}.editor-find-dialog .editor-find-dialog-button:disabled{color:var(--editor-find-dialog-button-disabled-color);cursor:default}.editor-find-dialog .editor-find-dialog-button:disabled:hover{background-color:transparent}.editor-find-dialog .editor-find-dialog-button svg{fill:currentColor}.editor-find-dialog .editor-find-dialog-space{flex-grow:1}.editor-find-dialog .editor-find-dialog-icon-button-border{margin:0 0 0 8px;cursor:pointer;border-radius:4px;color:var(--button-black-text-color);border:var(--editor-find-dialog-button-border);background-color:var(--editor-find-dialog-button-border-bg-color);padding:0;width:32px;display:flex;justify-content:center;align-items:center}.editor-find-dialog .editor-find-dialog-button-close{margin:0 0 0 8px;cursor:pointer;border-radius:4px;color:var(--button-black-text-color);background-color:var(--editor-find-dialog-button-border-bg-color);border:none;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center}.editor-find-dialog .editor-find-dialog-icon-button-border svg,.editor-find-dialog .editor-find-dialog-button-close svg{fill:currentColor}.editor-find-dialog .editor-highlight{opacity:.6;pointer-events:none}.editor-find-dialog .editor-highlight .editor-highlight-child{position:absolute;background-color:bisque}.editor-find-dialog .editor-highlight.active .editor-highlight-child{position:absolute;background-color:tomato}.editor-find-dialog .editor-search-result-highlight{opacity:.6;pointer-events:none}.editor-find-dialog .editor-search-result-highlight .editor-highlight-child{position:absolute;background-color:#40e0d0}.editor-find-dialog .editor-find-dialog-status{display:flex}.editor-highlight{opacity:.6;pointer-events:none}.editor-highlight .editor-highlight-child{position:absolute;background-color:bisque}.editor-highlight.active .editor-highlight-child{position:absolute;background-color:tomato}.editor-search-result-highlight{opacity:.6;pointer-events:none}.editor-search-result-highlight .editor-highlight-child{position:absolute;background-color:#40e0d0}.editor-find-dialog-status{display:flex}.comment-editor{font-size:14px;border:1px solid #c7c7c7;border-radius:3px;padding:1px 10px;margin:6px 10px 0}.comment-editor:after{content:"";height:0;display:block;clear:both}.comment-editor-root{display:inline-block;min-width:calc(100% - 40px);padding-top:2px}.comment-editor-root .editor-root .editor-content{padding:0}.comment-editor-img{float:right;color:#c1c1c1;padding:0}.comment-editor-root:not(.comment-editor-readonly) .editor-root .editor-content [data-type=editor-block]:not([data-block-type=text]){width:248px}.comment-editor-editing{border:1px solid #338fe5}.comment-editor-readonly{border:none;padding-left:37px;margin:0}.comment-editor-readonly .comment-editor-img{display:none}.comment-item-root{position:relative;margin-top:10px}.comment-item-root:not(.last-comment-item):before{content:" ";display:block;position:absolute;left:20px;width:1px;background-color:var(--editor-border-color, #e8e8e8);overflow:hidden;opacity:.8;top:21px;bottom:-12px;transform:scaleX(.5)}.comment-item-root .item-head{padding:0 10px;position:relative;display:flex;align-items:center}.comment-item-root .item-head-avatar{margin-right:5px;width:var(--editor-comment-avatar-width, 21px);height:var(--editor-comment-avatar-width, 21px);border-radius:100%}.comment-item-root .item-head-username{font-size:var(--editor-comment-username-font-size, 12px);color:var(--editor-comment-username-color, #07142a);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.comment-item-root .item-head-modified{margin-left:8px;font-size:12px;color:var(--editor-comment-modified-color, #808080);flex-grow:1;white-space:nowrap}.comment-item-root .item-head-tools{display:flex;align-items:center;visibility:hidden}.comment-item-root .item-head-tools .editor-text-button svg{width:20px;height:20px}.comment-item-root .item-head-tools.active{visibility:visible}.comment-item-root .item-actions{margin-top:10px;display:flex;justify-content:flex-end}.comment-item-root .item-actions.hidden{display:none}.comment-item-root .item-actions .editor-button[data-button-id=comment-item-cancel]{color:#606060;background:transparent;border:1px solid #c7c7c7}.comment-item-root .item-actions .editor-button[data-button-id=comment-item-cancel]:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.comment-item-root .item-actions .editor-button.disabled[data-button-id=comment-item-ok]{color:#fff;background-color:#338fe580;cursor:default}.comment-item-root:hover:not(.comment-item-editing) .item-head-tools{visibility:visible}.comment-item-root.readonly .item-head-tools{display:none}.mobile-comment-item{margin-top:4px;background-color:var(--editor-comment-layer-bg-color);padding-bottom:20px;color:var(--editor-comment-username-color)}.mobile-comment-item .item-head{padding:12px;display:flex;align-items:center}.mobile-comment-item .item-head-avatar{width:var(--editor-comment-avatar-size);height:var(--editor-comment-avatar-size);flex-grow:0}.mobile-comment-item .item-head-username{margin-left:12px}.mobile-comment-item .item-head-modified{margin-left:12px;color:#999}.mobile-comment-item .item-editor .comment-editor-readonly{padding-left:18px}.mini-comment-item{position:relative;line-height:16px;width:20px;height:16px;text-align:center;font-size:12px;border-radius:1px;background-color:var(--editor-comment-active-color, #FFC328);color:var(--editor-comment-mini-text-color, #ffffff);cursor:pointer}.mini-comment-item:after{content:"";position:absolute;left:50%;bottom:-4px;width:6px;height:6px;background-color:var(--editor-comment-active-color, #FFC328);border-radius:1px;transform:matrix(.71,.61,.82,-.71,0,0) translate(-50%);z-index:-1}.comment-quick-reply .quick-reply-button{position:absolute;left:8px;bottom:3px;z-index:2;color:var(--editor-comment-quick-reply-color, #7084A4);font-size:12px}.comment-quick-reply .quick-reply-button.editor-text-button:hover{color:var(--text-button-color-hover, #5587F0);background-color:var(--text-button-bg-color-hover, transparent)}.comment-quick-reply .quick-reply-editor{display:none}.comment-quick-reply .quick-reply-editor .reply-editor-actions{display:flex;justify-content:flex-end;margin-top:10px}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button[data-button-id=quick-reply-cancel]{color:#606060;background:transparent;border:1px solid #c7c7c7}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button[data-button-id=quick-reply-cancel]:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button.disabled[data-button-id=quick-reply-ok]{color:#fff;background-color:#338fe580;cursor:default}.comment-quick-reply.hidden,.comment-quick-reply.reply-editor-editing .quick-reply-button{display:none}.comment-quick-reply.reply-editor-editing .quick-reply-editor{display:block}:root{--editor-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Robot, "Helvetica Neue", Helvetica, Arial, sans-serif;--editor-comment-layer-bg-color:#ffffff;--editor-comment-group-bg-color: #ffffff;--comment-root-border-color: #eaeaea;--editor-comment-layer-active-border-color: #cecece;--editor-box-shadow: 0px 3px 20px rgba(0, 0, 0, .15);--wiz-editor-z-comment-group-active-top-before: 29;--editor-comment-quote-color: #909090;--editor-comment-quote-before-bg-color: #909090;--editor-comment-switch-button-width: 12px;--editor-comment-active-color: #FFC328;--editor-bg-color: #ffffff;--wiz-editor-z-comment-head:11;--text-button-color-hover:#5587f0;--editor-comment-username-color:#07142A;--editor-comment-avatar-size: 32px}.disabled-scroll{overflow:hidden}.editor-root .editor-content div[data-type=editor-block].text-block.comment{box-shadow:none}.editor-root .editor-content div[data-type=editor-block].text-block.comment>div[data-type=block-content]>span{border-bottom:2px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block].text-block.comment.active{box-shadow:none;outline:none}.editor-root .editor-content div[data-type=editor-block].text-block.comment.active>div[data-type=block-content] span{background-color:#f8e6ab}.editor-root .editor-content div[data-type=editor-block] span.text.comment{border-bottom:2px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block] span.text.comment.active{background-color:#faf1d1}.editor-root .editor-content div[data-type=editor-block].comment{box-shadow:0 2px #f8e6ab}.editor-root .editor-content div[data-type=editor-block].comment.active{box-shadow:none;outline:4px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-comment-button{all:unset;position:absolute;right:-28px;top:0;width:24px;height:24px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:3px;color:#07142a;cursor:pointer}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-comment-button:hover{background:#eaeaea}.editor-web-comment-root{position:absolute;right:0;width:300px;top:0;bottom:0;transition:width .16s ease-in;will-change:width;font-family:var(--editor-font-family)}.editor-web-comment-root .comment-groups-container .comment-group-item-root{position:absolute;left:50%;right:0;width:290px;transform:translate(-50%);background-color:var(--editor-comment-group-bg-color);border-radius:2px;border-color:var(--editor-comment-layer-active-border-color);box-shadow:var(--editor-box-shadow);padding-bottom:18px}.editor-web-comment-root .comment-groups-container .comment-group-item-root:not(.no-animation){transition:top .2s ease-in,opacity .35s ease-in}.editor-web-comment-root .comment-groups-container .comment-group-item-root:before{content:"";position:absolute;left:0;right:0;height:6px;background-color:#fff;border-radius:2px 2px 0 0;z-index:var(--wiz-editor-z-comment-group-active-top-before)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head{display:flex;align-items:center}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-quote{box-sizing:content-box;font-size:12px;line-height:12px;height:12px;color:var(--editor-comment-quote-color);padding:18px 12px 10px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:100%;max-width:calc(100% - 80px)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-quote:before{content:"";display:block;width:2px;height:100%;background-color:var(--editor-comment-quote-before-bg-color);margin-right:6px;float:left;border-radius:10px}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch{display:flex;align-items:center;height:22px;padding-top:6px;visibility:hidden}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button{padding:0;width:var(--editor-comment-switch-button-width);margin:3px 0;color:#606060}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-up]{margin-right:16px}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button:not(.disabled):hover{color:var(--text-button-color-hover)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button.disabled{color:#60606080;cursor:not-allowed}.editor-web-comment-root .comment-groups-container .comment-group-item-root.active:before{background-color:var(--editor-comment-active-color)}.editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch{visibility:visible}.editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply{display:none}.editor-mobile-comments-root{position:fixed;left:0;right:0;bottom:0;top:0;overflow:hidden;z-index:11}.editor-mobile-comments-root .mobile-comment-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:#00000073}.editor-mobile-comments-root .mobile-comment-groups-container{position:absolute;width:100%;height:100vh;z-index:1;overflow:hidden}.editor-mobile-comments-root .mobile-comment-groups-container .mobile-comment-groups-scroll-container{padding:0 12px}.editor-mobile-comments-root .mobile-comment-pull-info-container{position:absolute;right:0;left:0;bottom:100px;z-index:2;text-align:center;display:none}.editor-mobile-comments-root .mobile-comment-pull-info-container .mobile-comment-pull-info{display:inline-block;padding:12px;border-radius:36px;margin:0 auto;background-color:#000c;color:#fff;font-size:12px;opacity:0;transition:opacity .25s cubic-bezier(.65,.05,.36,1)}.editor-mobile-comments-root .mobile-comment-pull-info-container.active{display:block}.editor-mobile-comments-root .mobile-comment-pull-info-container.active .mobile-comment-pull-info{opacity:1}.editor-mobile-comments-root .mobile-group-item-root{margin:0 auto;width:100%;height:100vh;overflow:hidden}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item{min-height:calc(100vh + 1px);padding-bottom:50px}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item-space{height:50vh}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item-abstract{background-color:var(--editor-comment-layer-bg-color);padding:12px;color:#999;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.editor-mini-comment-root{position:absolute;right:0;top:0;bottom:0;width:48px;border-left:1px solid #f0f0f0;transition:width .16s ease-in;will-change:width;font-family:var(--editor-font-family);border:none;background-color:transparent;z-index:11}.editor-mini-comment-root .comment-groups-container{width:100%;height:100%}.editor-mini-comment-root .comment-groups-container .mini-group-item{position:absolute;top:0;left:50%;margin-left:-10px;transition:top .2s cubic-bezier(.65,.05,.36,1)}:is(.editor-web-comment-root,.editor-mobile-comments-root,.editor-mini-comment-root).hidden{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content]{margin:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content] span.file-icon{display:inline-flex;vertical-align:text-bottom}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content] .file-name{color:var(--primary-color);padding:0;border-radius:12px;margin-right:4px;white-space:wrap;word-break:break-all;cursor:pointer}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office]{justify-content:start}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office].hover [data-type=block-content]{border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content]{max-width:360px;min-width:360px;height:48px;cursor:pointer}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root{display:flex;align-items:center;min-width:360px;max-width:100%;background-color:#f5f6f7;border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root:before{border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details{display:flex;flex-direction:column;justify-content:center;font-size:14px;flex-grow:1}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-name{color:#1f2329;max-width:185px;display:flex;flex-direction:row;align-items:center;white-space:nowrap}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-size{color:#646a73;font-size:12px;margin-top:2px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-name-pre{text-overflow:ellipsis;overflow:hidden}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-actions button{width:34px;height:34px;background-color:#fff;border:1px solid #dee0e3;border-radius:50%;margin:0 8px;padding:0;background-repeat:no-repeat;background-position:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-actions button svg{width:16px;height:16px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-icon{display:flex;width:36px;height:36px;margin:6px 6px 6px 12px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-icon>svg{width:100%;height:100%}div[data-type=editor-block].block-exclusive:after{content:attr(data-exclusive-tips);position:absolute;top:0px;left:0px;width:100%;background:#f8f8f8;border-radius:var(--editor-border-radius);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:14px;line-height:22px;color:#909090;text-align:center;padding:9px 0}:root{--editor-version-button-border: black;--editor-bg-color: #ffffff;--editor-version-list-bg-color: white;--editor-version-select-bg-color: #F8F8F8}.version-dialog{display:flex;background-color:var(--editor-bg-color);width:100%;height:100%;color:var(--editor-color)}.version-dialog *{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;box-sizing:border-box}.version-dialog .version-viewer{flex:1;display:flex;flex-direction:column;width:0;padding:0}.version-dialog .version-viewer .version-dialog-editor{flex-grow:1;overflow-y:auto}.version-dialog .version-viewer .version-info-container{height:50px;border-bottom:#E8E8E8 1px solid;display:flex;align-items:center;flex-shrink:0;padding-left:20px;font-size:14px;color:#303030}.version-dialog .version-viewer .version-info-container .version-info-left .text-1{color:#909090}.version-dialog .version-viewer .version-info-container .version-info-left .name{font-weight:500}.version-dialog .version-viewer .version-info-container .editor-dropdown{margin-left:10px;margin-right:10px}.version-dialog .version-viewer .version-info-container .command-item[data-id=current-version]{min-width:200px;border:1px solid #f0f0f0}.version-dialog .version-viewer .version-info-container .command-item[data-id=current-version] .toolbar-item-name-container{flex-grow:1}.version-dialog .version-viewer .dialog-button-text{margin-top:1px;margin-left:-4px}.version-dialog .version-viewer .dialog-text-button{outline:none;background:transparent;border:none;display:flex;align-items:center;color:var(--editor-color);font-size:16px;font-weight:500;padding:4px 0;cursor:pointer}.version-dialog .version-viewer .dialog-text-button .dialog-button-icon{margin-right:0;width:24px;height:24px}.version-dialog .version-viewer .dialog-text-button .dialog-button-icon svg{fill:currentColor}.editor-root.history .root-container .editor-block .text-element .inline-plugin.editor-box-loading{display:none}.editor-root.history .editor-content{padding:30px 75px}.editor-root.history .history-inserted-block[data-type=editor-block] [data-type=block-content]{border:4px solid var(--op-selected-color)}.editor-root.history .history-inserted-block[data-type=editor-block]{position:relative}.editor-root.history .history-inserted-block[data-type=editor-block]:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-inserted-block[data-type=editor-block].table-block table{border:4px solid var(--op-selected-color)}.editor-root.history .history-inserted-block[data-type=editor-block].table-block table .child{pointer-events:none}.editor-root.history .history-inserted-block[data-type=editor-block].table-block{position:relative}.editor-root.history .history-inserted-block[data-type=editor-block].table-block:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-inserted-block[data-type=editor-block].table-block:hover:after{top:0}.editor-root.history .history-deleted-block [data-type=block-content]{border:4px solid var(--op-selected-color)}.editor-root.history .history-deleted-block [data-type=block-content]{position:relative}.editor-root.history .history-deleted-block [data-type=block-content]:after,.editor-root.history .history-deleted-block [data-type=block-content]:before{content:" ";position:absolute;display:flex;z-index:var(--wiz-editor-z-history-delete-marker);color:var(--op-color);justify-items:center;align-items:center;justify-content:center;align-content:center;pointer-events:none;overflow:visible;max-width:100%;max-height:100%;left:calc(50% - 16px);top:calc(50% - 2px);width:32px;height:4px;background-color:var(--op-color);transform:rotate(45deg);opacity:1}.editor-root.history .history-deleted-block [data-type=block-content]:before{transform:rotate(135deg)}.editor-root.history .history-deleted-block{position:relative}.editor-root.history .history-deleted-block:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-deleted-block .history-deleted-box{background-color:unset!important;text-decoration:unset!important}.editor-root.history .history-deleted-block .history-deleted-box:hover:after{opacity:0}.editor-root.history .history-inserted-text{line-height:revert!important;background-color:var(--op-selected-color)}.editor-root.history .history-inserted-text{position:relative}.editor-root.history .history-inserted-text:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-deleted-box{background-color:var(--op-selected-color);text-decoration:line-through}.editor-root.history .history-deleted-box{position:relative}.editor-root.history .history-deleted-box:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history [data-box-type=history-deleted-box]>span[data-type=box-content]{border:none!important;margin:0!important}.editor-root.history [data-type=editor-block].table-block div[data-type=block-content]{overflow-x:revert}.editor-dialog-root{position:absolute;left:0;top:0;bottom:0;right:0;background-color:#639;z-index:100}.size-limit-textarea{display:inline-block;position:relative}.size-limit-textarea .size-limit-textarea-input{width:100%;resize:none;overflow:hidden;color:#303030;outline:none;border:1px solid #f0f0f0;border-radius:3px}.size-limit-textarea .size-limit-textarea-input:focus,.size-limit-textarea .size-limit-textarea-input:hover{border-color:#338fe5}.size-limit-textarea .size-limit-textarea-input:focus{box-shadow:0 0 0 2px #338fe533}.size-limit-textarea .size-limit-textarea-warning{position:absolute;right:0;bottom:10px;color:#909090;z-index:1;font-size:12px;pointer-events:none}.version-list-root{width:320px;background:var(--editor-version-list-bg-color);overflow-y:auto;padding:0;border-left:#E8E8E8 1px solid;display:flex;flex-direction:column}.version-list-root .version-list-header{padding:0 20px;font-size:14px;display:flex;align-items:center;margin-top:8px;margin-bottom:8px;flex-shrink:0;color:#909090}.version-list-root .version-list-header .version-count{flex-grow:1}.version-list-root .version-list-empty{height:100%;display:flex;align-items:center;justify-content:center;font-size:14px;color:#909090}.version-list-root .version-list-content{flex-grow:1;overflow-y:auto}.version-list-root .version-list-content .version-item{padding:15px 10px;cursor:pointer}.version-list-root .version-list-content .version-item.child{padding-left:32px}.version-list-root .version-list-content .version-item:not(.active):hover{background:rgba(112,132,164,.1)}.version-list-root .version-list-content .version-item.active{background-color:var(--editor-version-select-bg-color)}.version-list-root .version-list-content .version-item.active .version-item-title .version-actions{display:flex}.version-list-root .version-list-content .version-item.editing .version-item-memo{display:none}.version-list-root .version-list-content .version-item.active .version-item-memo{cursor:text}.version-list-root .version-list-content .version-item.active .version-item-memo:hover{outline:1px solid #338FE5}.version-list-root .version-list-content .version-item .version-item-restore-from{color:#909090;font-size:12px;line-height:1.5em;height:20px;padding:0 10px 10px}.version-list-root .version-list-content .version-item .version-item-restore-from:empty{display:none}.version-list-root .version-list-content .version-item .memo-input.size-limit-textarea{width:100%;min-height:60px}.version-list-root .version-list-content .version-item .memo-input.size-limit-textarea textarea{padding:5px 10px 10px;box-sizing:border-box;font-size:14px}.version-list-root .version-list-content .version-item .version-item-title{display:flex;align-items:center;padding-bottom:10px;padding-left:10px;padding-right:10px;height:24px}.version-list-root .version-list-content .version-item .version-item-title .version-item-date{font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.version-list-root .version-list-content .version-item .version-item-title .spacer{flex-grow:1}.version-list-root .version-list-content .version-item .version-item-title .version-actions{display:none}.version-list-root .version-list-content .version-item .version-item-title .version-actions button{display:flex;align-items:center;justify-content:center;height:16px;cursor:pointer;border:none;outline:none;background:transparent;padding:0 0 0 5px;color:#909090}.version-list-root .version-list-content .version-item .version-item-title .version-actions button:hover{color:#338fe5}.version-list-root .version-list-content .version-item .version-item-title .version-actions button.disabled,.version-list-root .version-list-content .version-item .version-item-title .version-actions button.disabled:hover{color:#c7c7c7}.version-list-root .version-list-content .version-item .version-item-title .version-actions .revert-button{border-left:1px solid #E8E8E8;margin-left:5px}.version-list-root .version-list-content .version-item .version-item-latest{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;border-radius:3px;display:flex;align-items:center;font-size:12px;margin-left:10px}.version-list-root .version-list-content .version-item .version-item-authors{list-style:none;margin:0;font-size:12px;padding-left:10px}.version-list-root .version-list-content .version-item .version-item-author{display:flex;align-items:center;margin-top:10px;color:#606060}.version-list-root .version-list-content .version-item .version-item-author-mark{width:6px;height:6px;border-radius:3px;margin-right:5px}.version-list-root .version-list-content .version-item .version-item-memo{font-size:14px;color:#303030;padding:5px 10px 10px;border-radius:3px}.version-list-root .version-list-content .version-item .version-item-memo:empty{display:none}.versions-dropdown-header{color:var(--text-color);height:44px;display:flex;align-items:center;padding-left:10px;border-bottom:1px solid #f0f0f0}.versions-dropdown-header .versions-dropdown-header-info{height:16px;color:#909090}.versions-dropdown-header .versions-dropdown-header-icon{height:16px;padding-left:5px;cursor:pointer}.editor-command-bar.menu .command-item.standard[data-id=prev-version]{height:44px}[data-command-bar-id=versions-dropdown-popup]{width:320px}[data-command-bar-id=versions-dropdown-popup] .tippy-box{color:var(--text-color)}[data-command-bar-id=versions-dropdown-popup] *{box-sizing:border-box}[data-command-bar-id=versions-dropdown-popup] .editor-command-bar-header{width:100%;margin-bottom:5px}[data-command-bar-id=versions-dropdown-popup] .command-item{width:100%;cursor:pointer}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container{padding:6px 10px;width:100%}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-memo{font-size:12px;color:#909090;line-height:20px}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-line1{line-height:22px;display:flex;align-items:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-line1 .version-item-latest{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;margin-left:10px;border-radius:3px}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=no-versions]{height:34px;color:#909090;padding-left:10px;justify-content:center}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator]{width:100%;box-sizing:border-box}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item{width:100%}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-info{height:24px;color:#909090;display:flex;align-items:center;padding-left:10px;background-color:#f8f8f8;width:100%;box-sizing:border-box;margin:5px 0}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container{height:44px;display:flex;align-items:center;padding-left:10px;color:#303030}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container .filter-item-input{cursor:pointer;accent-color:#338FE5}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container .filter-item-label{user-select:none;cursor:pointer;line-height:1em}.editor-root.readonly .editor-content div[data-type=editor-block].focused div[data-type=block-tools] .block-helper .heading-marker,.editor-root.readonly .editor-content div[data-type=editor-block].highlighted div[data-type=block-tools] .block-helper .heading-marker{display:flex}.editor-root .editor-content div[data-type=editor-block].heading-collapsed div[data-type=block-tools] .block-helper .heading-collapse-button svg{transform:rotate(270deg)}.editor-root .editor-content div[data-type=editor-block].focused div[data-type=block-tools] .block-helper .heading-marker,.editor-root .editor-content div[data-type=editor-block].highlighted div[data-type=block-tools] .block-helper .heading-marker{display:none}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button{width:24px;height:24px;cursor:grab;margin:0;padding:0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:3px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker:hover,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button:hover{background-color:var(--selected-color)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker svg,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button svg{transform:rotate(360deg);transition:transform .2s linear}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker svg,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button svg{width:16px;height:16px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker:hover{background-color:transparent}.embed-block div[data-type=block-content] .editor-toc-container{display:block;width:100%;background-color:#f0f0f0;padding:20px}.embed-block div[data-type=block-content] .editor-toc-container.loading{margin:0;min-height:100px}.embed-block div[data-type=block-content] .editor-toc-container .toc-node+.toc-node{margin-top:10px}.embed-block div[data-type=block-content] .editor-toc-container .toc-node .toc-text{cursor:pointer;color:var(--primary-color)}.embed-block div[data-type=block-content] .editor-toc-container .toc-node .toc-children{margin-top:10px;padding-left:20px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=mention] span[data-type=box-content]{margin:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=mention] span[data-type=box-content] .mention-name{color:var(--primary-color);padding:0;border-radius:12px;margin-left:4px;margin-right:4px;white-space:wrap;word-break:break-all;cursor:pointer}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-icon{width:20px;height:20px;border-radius:50%;overflow:hidden}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-icon img{width:100%;height:100%}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-name{flex-grow:0;margin-right:5px}.editor-root .editor-templates{position:fixed;bottom:26px;height:256px;width:auto;max-width:100%;padding-left:30px;padding-right:44px;overflow:hidden}.editor-root .editor-templates .editor-templates-title{color:#909090;font-size:14px;margin-left:0;margin-bottom:20px;line-height:19.6px}.editor-root .editor-templates .editor-templates-cards{display:flex;margin-left:0}.editor-root .editor-templates .editor-templates-cards .editor-template-card{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;cursor:pointer;flex-shrink:0;height:192px;width:188px;background:none;border:1px solid #e8e8e8;border-radius:3px;margin:0 0 0 15px;padding:0;align-items:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card:first-child{margin-left:0}.editor-root .editor-templates .editor-templates-cards .editor-template-card:hover{box-shadow:0 0 1px #30303033,0 8px 16px #30303026}.editor-root .editor-templates .editor-templates-cards .editor-template-card:hover>.editor-template-name{color:#338fe5}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-name{display:flex;align-items:center;height:40px;width:100%;border-top:1px solid #dedede;padding-left:20px;padding-right:20px;flex:0 0 50px;font-size:14px;font-weight:500;line-height:22px;color:#303030}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-name span{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-name{border-top:none}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-name span{padding-left:0;text-align:center}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-thumb-container{display:flex;align-items:center;justify-content:center;padding:16px 39px 14px}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-thumb-container>img{width:110px;height:112px;max-width:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-thumb-container{flex:1;position:relative;padding:10px 5px 0;height:142px;margin:0;overflow:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-thumb-container>img{max-width:100%}.editor-dialog-container{min-width:500px;position:relative;left:-9px}.editor-dialog-container .dialog-header{display:flex;justify-content:space-between;align-items:center;padding:0 20px;border-bottom:1px solid #e8e8e8}.editor-dialog-container .dialog-header .close-icon{cursor:pointer}.editor-dialog-container .dialog-header .dialog-header-title{padding:8px 0 11px;font-size:18px;font-weight:700;flex-grow:1}.editor-dialog-container .dialog-content{padding:20px;border-bottom:1px solid #e8e8e8}.editor-dialog-container .dialog-footer{margin:10px 0 5px;padding:0 20px;text-align:right}.editor-dialog-container .dialog-footer button{min-width:58px;min-height:30px;padding:0 10px;border-radius:3px;background-color:#eef3f8;font-size:14px;color:#fff;cursor:pointer}.editor-dialog-container .dialog-footer .cancel-button{margin:0 8px 0 0;background-color:transparent;border:1px solid #c7c7c7;color:#606060}.editor-dialog-container .dialog-footer .cancel-button:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.editor-dialog-container .dialog-footer .submit-button{outline:none;background-color:#338fe5;color:#fff;border:0}.editor-dialog-container .dialog-footer .submit-button:hover{background-color:#5ca5ea}.embed-block[data-embed-type=webpage]{height:400px;min-height:100px;max-height:1000px}.embed-block[data-embed-type=webpage] .webpage-mask{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1;background-color:transparent}.embed-block[data-embed-type=webpage].resizing [data-type=block-tools] .block-resizer{pointer-events:all!important}.embed-block[data-embed-type=webpage].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=webpage].selected>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=webpage]>div[data-type=block-content]{justify-content:center;height:100%}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed{width:100%}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed .editor-preview-iframe{width:100%;max-height:500px;height:100%;border:none;position:relative}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed .editor-preview-iframe-loading{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:center;align-items:center;background-color:#fff}.webpage-content .help-container{color:#303030;border:1px solid #dedede;padding:10px;border-radius:4px;border-left:4px solid #338fe5;margin-top:16px;margin-bottom:16px}.webpage-content .help-container .help-content{display:flex;align-items:center}.webpage-content .help-container .help-content .help-icon{display:flex;align-items:center;height:20px;color:#338fe5;margin-right:12px}.webpage-content .help-link-container{margin-top:8px;display:flex;align-items:center}.webpage-content .help-link-container .help-link-content{display:flex;align-items:center;color:#338fe5;text-decoration:none}.webpage-content .help-link-container .help-link-content .help-link-icon{width:16px;height:16px;margin-left:8px}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-embed-type=webpage]>div[data-type=block-content]:before{display:block}:root{--editor-quoted-color: #7084a4;--editor-drawio-empty-svg: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC43MjAzIDI4LjcwOTdIMjUuOTIzM0MyNS4yMTY1IDI4LjcwOTcgMjQuNjQzNSAyOC4xNDgxIDI0LjY0MzUgMjcuNDU1MlYyNS43MzMzSDIwLjUyODNDMjAuNDk4NiAyNS43Njk2IDIwLjQ2NjkgMjUuODA0MiAyMC40MzMzIDI1LjgzN0wxNS45MTkyIDMwLjI2MjFWMzQuNzU1NkgyNC42NDM1VjMzLjcyNzZDMjQuNjQzNSAzMy4wMzQ4IDI1LjIxNjUgMzIuNDczMiAyNS45MjMzIDMyLjQ3MzJIMzguNzIwM0MzOS40MjcgMzIuNDczMiA0MCAzMy4wMzQ4IDQwIDMzLjcyNzZWMzguNzQ1NUM0MCAzOS40MzgzIDM5LjQyNyA0MCAzOC43MjAzIDQwSDI1LjkyMzNDMjUuMjE2NSA0MCAyNC42NDM1IDM5LjQzODMgMjQuNjQzNSAzOC43NDU1VjM3LjMzMzNIMTQuNjI2M0MxMy45MTIyIDM3LjMzMzMgMTMuMzMzMyAzNi43NTYyIDEzLjMzMzMgMzYuMDQ0NFYzMC42OTQxTDguMzc4NTIgMjUuODM3QzguMTM2MjYgMjUuNjAxNCA4IDI1LjI4MDggOCAyNC45NDYzQzggMjQuNjExOCA4LjEzNjI2IDI0LjI5MTEgOC4zNzg1MiAyNC4wNTU2TDEzLjMzMzMgMTkuMTk4NVYxNS43NzJDMTEuNzc5OCAxNS4yMjI5IDEwLjY2NjcgMTMuNzQxNiAxMC42NjY3IDEyQzEwLjY2NjcgOS43OTA4NSAxMi40NTc1IDggMTQuNjY2NyA4QzE2Ljg3NTggOCAxOC42NjY2IDkuNzkwODUgMTguNjY2NiAxMkMxOC42NjY2IDEzLjcyNjUgMTcuNTU4OCAxNS4yNTgxIDE1LjkxOTEgMTUuNzk4OFYxOS4yODg4QzE1LjkxOTEgMTkuMzkxOCAxNS45MDY4IDE5LjQ5NDMgMTUuODgyMyAxOS41OTQzTDE5LjUxNTEgMjMuMTU1NUgyNC42NDM1VjIyLjQzNzNDMjQuNjQzNSAyMS43NDQ1IDI1LjIxNjUgMjEuMTgyOSAyNS45MjMzIDIxLjE4MjlIMzguNzIwM0MzOS40MjcgMjEuMTgyOSA0MCAyMS43NDQ1IDQwIDIyLjQzNzNWMjcuNDU1MkM0MCAyOC4xNDgxIDM5LjQyNyAyOC43MDk3IDM4LjcyMDMgMjguNzA5N1pNMjcuMjAzIDM3LjQ5MUgzNy40NDA2VjM0Ljk4MjFIMjcuMjAzVjM3LjQ5MVpNMTQuNDA1OSAyOC4xOTU0TDExLjA5MTUgMjQuOTQ2M0wxNC40MDU5IDIxLjY5NzJMMTcuNzIwNCAyNC45NDYzTDE0LjQwNTkgMjguMTk1NFpNMjcuMjAzIDI2LjIwMDhIMzcuNDQwNlYyMy42OTE4SDI3LjIwM1YyNi4yMDA4WiIgZmlsbD0iIzA3MTQyQSIvPgo8L3N2Zz4K)}.flex-center,.editor-drawio-iframe-container.loading:before,.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:after,.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:before{display:flex;align-items:center;justify-content:center}.full-screen,.editor-drawio-iframe-container.loading:before,.drawio-iframe-element,.editor-drawio-iframe-container{width:100%;height:100%}.editor-drawio-iframe-container{position:fixed;top:0;left:0;z-index:1000}div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content]{outline:1px solid #DEDEDE}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content]{justify-content:center;border-radius:3px;padding:10px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content] .editor-drawio-content{text-align:center}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed{width:240px;height:80px;display:inline-block;text-align:center}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:before{background-image:var(--editor-drawio-empty-svg);position:absolute;content:" ";color:var(--editor-quoted-color);top:8px;left:calc(50% - 24px);width:48px;height:48px}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:after{position:absolute;content:attr(data-empty-drawio-content);color:var(--editor-quoted-color);bottom:0;left:0;width:100%;height:32px;top:50%}div.editor-root div.editor-content div[data-type=editor-container] div[data-embed-type=drawio].embed-block>div[data-type=block-content] img{max-width:100%;max-height:100%;width:100%;height:100%}.editor-drawio-iframe-container.loading:before{content:attr(data-placeholder);position:absolute;top:0;left:0;background-color:#f7f6f3;z-index:2}.editor-content .editing{background-color:#cdcdcd40}.editor-content div[data-type=block-tools] .embed-code-editor-container{position:absolute;top:0;left:0px;right:0px;bottom:0;background-color:#cdcdcd40;z-index:var(--wiz-editor-z-embed-code-editor-mask);padding:8px}.editor-content div[data-type=block-tools] .embed-code-editor-container textarea{width:100%;height:100%;resize:none;outline:none;padding:12px;border:1px solid #b9bfc8;border-radius:4px;background-color:#fff;color:#333}.flex-row-center,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=mermaid] div[data-type=block-content] .graph-embed,div[data-embed-type=flowchart] div[data-type=block-content] .graph-embed,div[data-embed-type=plantuml] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed:after,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed:after,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed:after,.embed-block,div[data-embed-type=mermaid],div[data-embed-type=flowchart],div[data-embed-type=plantuml]{display:flex;flex-direction:row;align-items:center;justify-content:center}.embed-block div[data-type=block-content],div[data-embed-type=mermaid] div[data-type=block-content],.embed-block div[data-type=block-content],div[data-embed-type=flowchart] div[data-type=block-content],.embed-block div[data-type=block-content],div[data-embed-type=plantuml] div[data-type=block-content]{width:100%;position:relative}.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed,.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed,.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed{width:100%;min-height:106px;background-color:#cdcdcd40}.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed:after,.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed:after,.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed:after{content:attr(data-empty-tips);position:absolute;top:0;right:0;width:100%;height:100%;color:#07142a;white-space:nowrap}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed){width:100%;height:100px}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed) img,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed) img,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed) img{display:none}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed):after,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed):after,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed):after{content:attr(data-invalid-text);position:absolute;top:0;right:0;width:100%;height:100%;outline:1px solid red;display:flex;flex-direction:row;align-items:center;justify-content:center;color:red}.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=mermaid] div[data-type=block-content] .embed-img-content,.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=flowchart] div[data-type=block-content] .embed-img-content,.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=plantuml] div[data-type=block-content] .embed-img-content{width:100%;text-align:center}.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=mermaid] div[data-type=block-content] .mermaid-embed-img,.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=flowchart] div[data-type=block-content] .mermaid-embed-img,.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=plantuml] div[data-type=block-content] .mermaid-embed-img{max-width:100%;min-width:200px}.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=mermaid] div[data-type=block-content] .editor-plantuml-img,.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=flowchart] div[data-type=block-content] .editor-plantuml-img,.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=plantuml] div[data-type=block-content] .editor-plantuml-img{max-width:100%}.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=mermaid] div[data-type=block-content] .embed-graph-img-content,.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=flowchart] div[data-type=block-content] .embed-graph-img-content,.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=plantuml] div[data-type=block-content] .embed-graph-img-content{width:100%;text-align:center;padding:10px}.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=mermaid] div[data-type=block-content] .embed-graph-img-content img,.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=flowchart] div[data-type=block-content] .embed-graph-img-content img,.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=plantuml] div[data-type=block-content] .embed-graph-img-content img{max-width:100%}.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=mermaid] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=flowchart] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=plantuml] div[data-type=block-content] .graph-embed{width:100%}.hr-transition,.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container .editor-embed-hr{transition:border-top ease-in-out .4s}.embed-block[data-type=editor-block][data-embed-type=hr].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-type=editor-block][data-embed-type=hr].selected>div[data-type=block-content]{outline:none!important}.embed-block[data-type=editor-block][data-embed-type=hr]:is(.focused) div[data-type=block-content] .editor-embed-container .editor-embed-hr{caret-color:transparent}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container{display:flex;align-items:center;width:100%;height:24px}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container .editor-embed-hr{display:block;width:100%;border:none;margin:0;border-top:2px dashed #cccccc;cursor:pointer}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-tools]>div.block-helper{height:100%}:root{--hover-color: #40a9ff}.flex-column-center,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{display:flex;justify-content:center;align-items:center;flex-flow:column}.common{width:400px;height:180px;background-color:#fafafa;border:1px dashed #d9d9d9;border-radius:2px;transition:border-color .3s}.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{height:200px}.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty .media-error-icon,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .media-error-icon{display:flex}.editor-root .editor-content div[data-type=editor-block].embed-block.media-block-uploading div[data-type=block-tools] .block-helper{display:none}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error{height:400px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty .media-error-icon,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .media-error-icon{display:flex}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content]:after,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content]:after,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content]:after,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content]:after{display:none}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content] .media,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content] .media,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content] .media,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content] .media{position:relative}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content] .media:after,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content] .media:after,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content] .media:after,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content] .media:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#303030;opacity:.1}.embed-block[data-embed-type=video].hover>div[data-type=block-content],.embed-block[data-embed-type=audio].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=video].selected>div[data-type=block-content]:before,.embed-block[data-embed-type=audio].selected>div[data-type=block-content]:before{display:none}.embed-block[data-embed-type=video]>div[data-type=block-content],.embed-block[data-embed-type=audio]>div[data-type=block-content]{justify-content:center;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media.full-screen,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media.full-screen{width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media{display:flex;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress{position:relative;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress audio,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress audio{display:block;width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress video,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress video{display:block;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#303030;opacity:.8;display:flex;align-items:center;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar{width:75%;height:6px;border-radius:3px;display:flex;background-color:#fff;overflow:hidden}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value{background-color:#338fe5}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{width:100%;background:#F8F8F8;outline:1px solid #DEDEDE;border-radius:3px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error-icon svg,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error-icon svg{width:48px;height:48px;color:#c7c7c7}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .line-1,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .line-1{margin-top:10px;font-size:18px;text-align:center;color:#303030}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .line-2,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .line-2{margin-top:5px;font-size:14px;text-align:center;color:#606060}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .retry-upload,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .retry-upload{margin-left:4px;color:#338fe5;cursor:pointer;text-decoration:none}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty{width:100%;background:#FFFFFF;outline:1px solid #DEDEDE;border-radius:3px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty svg,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty svg{width:48px;height:48px;color:#c7c7c7}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element{width:100%;display:flex;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .video-container video,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .video-container video{display:block;min-width:50px;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .audio-container,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .audio-container{width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .audio-container audio,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .audio-container audio{display:block;width:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment{box-shadow:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment .media,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment .media{box-shadow:0 2px #f8e6ab}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment.active,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment.active{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment.active .media,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment.active .media{box-shadow:none;outline:4px solid #f8e6ab}`)),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
1
+ (function(){"use strict";try{if(typeof document!="undefined"){var t=document.createElement("style");t.appendChild(document.createTextNode(`@keyframes ones-editor-blink{0%,to{background-color:transparent}50%{background-color:var(--primary-color)}}*{--link-color: #338fe5;--color-0: #e52727;--color-1: #eb6414;--color-2: #f0a100;--color-3: #24b47e;--color-4: #338fe5;--color-5: #9678d3;--color-6: #909090;--background-color-0: #fad4d4;--background-color-1: #fbe0d0;--background-color-2: #fceccc;--background-color-3: #d3f0e5;--background-color-4: #d6e9fa;--background-color-5: #eae4f6;--background-color-6: #dedede;--background-color-7: #e52727;--background-color-8: #eb6414;--background-color-9: #f0a100;--background-color-10: #24b47e;--background-color-11: #338fe5;--background-color-12: #9678d3;--background-color-13: #909090;--background-color-14: #e8e8e8;--font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif}div.editor-root{--text-color: #303030;--primary-color: #338fe5;--background-selection: #338fe533;--background-code: #cdcdcd40}div.editor-root{color:var(--text-color);position:relative;box-sizing:border-box;min-height:100%;width:100%;z-index:1}div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span.text.link{cursor:pointer}div.editor-root *{box-sizing:border-box;font-family:var(--font-family)}div.editor-root button{outline:none}div.editor-root.active div.editor-content .editor-cursor{opacity:1}div.editor-root .safari.mobile div.editor-content .editor-input{pointer-events:all;width:8px}div.editor-root div.editor-content{height:100%;width:100%;padding:0 30px 30px}div.editor-root div.editor-content .editor-cursor{position:absolute;background:var(--primary-color);width:2px;transition:top .1s ease-in,left .1s linear;animation:ones-editor-blink 1s ease-in-out infinite;opacity:0;pointer-events:none}div.editor-root div.editor-content .editor-input{position:absolute;opacity:0;pointer-events:none;width:16px;height:20px;font-size:16px}div.editor-root div.editor-content div[data-type=editor-container]{position:relative}div.editor-root div.editor-content div[data-type=editor-container].root{user-select:none;width:100%;cursor:text}div.editor-root div.editor-content div[data-type=editor-container].root>.container-blocks>*+*{margin-top:1em}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block]:not(:first-of-type){background-color:var(--background-selection)}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block]:not(:first-of-type) div[data-type=block-background]>.editor-selection-background{background-color:transparent!important}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block].embed-block>div[data-type=block-content]:before,div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block].embed-block .embed-selected-content:before{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]+div[data-type=editor-block][data-style-quoted]{margin-top:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block]{font-size:var(--font-size);line-height:var(--line-height);position:relative;--font-size: 15px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=center] div[data-type=block-content]{text-align:center}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=right] div[data-type=block-content]{text-align:end}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].block-hidden{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=text]{cursor:text}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]{word-break:break-word;position:relative}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span{cursor:text}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text{white-space:pre-wrap}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link{color:var(--link-color)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link:hover{text-decoration:underline}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.link.style-strikethrough:hover{text-decoration:underline line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-bold{font-weight:700}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-italic{font-style:italic}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-underline{text-decoration:underline}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-strikethrough{text-decoration:line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-underline.style-strikethrough{text-decoration:underline line-through}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-code{border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;background-color:var(--background-code);padding:4px;font:.8em Monaco,Consolas,"Andale Mono",DejaVu Sans Mono,monospace}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-sub{vertical-align:sub;font-size:70%}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text.style-super{vertical-align:super;font-size:70%}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="0"]{color:var(--color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="1"]{color:var(--color-1)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="2"]{color:var(--color-2)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="3"]{color:var(--color-3)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="4"]{color:var(--color-4)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="5"]{color:var(--color-5)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-color="6"]{color:var(--color-6)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="0"]{background-color:var(--background-color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="1"]{background-color:var(--background-color-1)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="2"]{background-color:var(--background-color-2)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="3"]{background-color:var(--background-color-3)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="4"]{background-color:var(--background-color-4)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="5"]{background-color:var(--background-color-5)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="6"]{background-color:var(--background-color-6)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="7"]{background-color:var(--background-color-7)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="8"]{background-color:var(--background-color-8)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="9"]{background-color:var(--background-color-9)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="10"]{background-color:var(--background-color-10)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="11"]{background-color:var(--background-color-11)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="12"]{background-color:var(--background-color-12)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="13"]{background-color:var(--background-color-13)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.text[data-style-bg-color="14"]{background-color:var(--background-color-14)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].inputting-insertion>span[data-type=insertion-content]{border-bottom:1px solid var(--primary-color)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion{width:0px;position:relative;display:inline-block;vertical-align:text-bottom;overflow:visible;height:1em}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content]{position:absolute;color:transparent;width:3px;left:-3px;border-right:var(--cursor-color) 1px solid;text-overflow:clip;display:inline-block;top:-5px;bottom:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content] span[data-cursor-name]{display:inline-block;width:8px;background-color:transparent;border:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion>span[data-type=insertion-content] span[data-cursor-name]:hover:before,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span[data-type=editor-insertion].remote-cursor-insertion.active>span[data-type=insertion-content] span[data-cursor-name]:before{content:attr(data-cursor-name);position:absolute;top:-12px;height:1.1em;background-color:var(--cursor-color);z-index:27;left:0px;color:#fff;white-space:nowrap;font-size:12px;display:flex;align-items:center;padding:1px 4px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=box-content]{border-radius:2px;margin-left:8px;margin-right:8px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=editor-box].br-box>span[data-type=box-content] img{vertical-align:middle;max-width:1em}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] span[data-type=editor-box][data-box-type=image].image-box span[data-type=box-content]{user-select:none;margin-left:0;margin-right:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-tools] .editor-block-anchor{position:absolute}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-background] .editor-selection-background{position:absolute;background-color:var(--background-selection);z-index:1;pointer-events:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block{cursor:default}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block.hover>div[data-type=block-content]{outline:1px solid #338fe5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block>div[data-type=block-content]{display:flex}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover .embed-hover-content{outline:1px solid #338fe5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected>div[data-type=block-content],div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content{position:relative}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected>div[data-type=block-content]:before,div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content:before{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#338fe5;opacity:.1}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block{color:#909090;font-size:12px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].unknown-block>div[data-type=block-content]{padding:5px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]{border-left:4px solid #e8e8e8;color:#909090}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]:not([data-list-level]){padding-left:8px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="1"]{--font-size: 28px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="2"]{--font-size: 26px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="3"]{--font-size: 24px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="4"]{--font-size: 22px;--line-height: 1.5}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="5"]{--font-size: 20px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="6"]{--font-size: 18px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="7"]{--font-size: 16px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="8"]{--font-size: 14px;--line-height: 1.6}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading]{font-size:var(--font-size);line-height:var(--line-height);font-weight:700}.editor-disable-scroll{position:fixed;left:0;top:0;width:100vw;height:100vh;z-index:9900;overflow:hidden}div:not(.comment-editor-root)>div.editor-root>div.editor-content>div[data-type=editor-container]>div.container-blocks>div[data-type=editor-block]:first-of-type{font-size:30px;line-height:1.3}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-anchor{position:absolute;pointer-events:none;z-index:-1}.editor-command-bar.toolbar .color-button{width:24px;height:24px;display:flex;padding:0;margin:0;align-items:center;justify-content:center;background-color:transparent;border:0;outline:0;border-radius:3px;cursor:pointer}.editor-command-bar.toolbar .color-button[data-color="0"]{color:var(--color-0)}.editor-command-bar.toolbar .color-button[data-color="1"]{color:var(--color-1)}.editor-command-bar.toolbar .color-button[data-color="2"]{color:var(--color-2)}.editor-command-bar.toolbar .color-button[data-color="3"]{color:var(--color-3)}.editor-command-bar.toolbar .color-button[data-color="4"]{color:var(--color-4)}.editor-command-bar.toolbar .color-button[data-color="5"]{color:var(--color-5)}.editor-command-bar.toolbar .color-button[data-color="6"]{color:var(--color-6)}.editor-command-bar.toolbar .color-button[data-background-color="0"]{background-color:var(--background-color-0)}.editor-command-bar.toolbar .color-button[data-background-color="1"]{background-color:var(--background-color-1)}.editor-command-bar.toolbar .color-button[data-background-color="2"]{background-color:var(--background-color-2)}.editor-command-bar.toolbar .color-button[data-background-color="3"]{background-color:var(--background-color-3)}.editor-command-bar.toolbar .color-button[data-background-color="4"]{background-color:var(--background-color-4)}.editor-command-bar.toolbar .color-button[data-background-color="5"]{background-color:var(--background-color-5)}.editor-command-bar.toolbar .color-button[data-background-color="6"]{background-color:var(--background-color-6)}.editor-command-bar.toolbar .color-button[data-background-color="7"]{background-color:var(--background-color-7)}.editor-command-bar.toolbar .color-button[data-background-color="8"]{background-color:var(--background-color-8)}.editor-command-bar.toolbar .color-button[data-background-color="9"]{background-color:var(--background-color-9)}.editor-command-bar.toolbar .color-button[data-background-color="10"]{background-color:var(--background-color-10)}.editor-command-bar.toolbar .color-button[data-background-color="11"]{background-color:var(--background-color-11)}.editor-command-bar.toolbar .color-button[data-background-color="12"]{background-color:var(--background-color-12)}.editor-command-bar.toolbar .color-button[data-background-color="13"]{background-color:var(--background-color-13)}.editor-command-bar.toolbar .color-button[data-background-color="14"]{background-color:var(--background-color-14)}.tippy-content{white-space:pre-line}.editor-button{min-height:26px;min-width:46px;font-size:12px;font-weight:500;outline:none;background-color:var(--editor-button-bg-color, #338fe5);color:var(--editor-button-color, #fff);border:0;padding:4px 8px;border-radius:4px;margin-right:8px;cursor:pointer}.editor-button:hover{background-color:#5ca5ea}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.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}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.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}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}[data-theme=dropdown-list]{border-radius:4px;background:white;position:relative;max-width:calc(100vw - 24px);box-shadow:#0f0f0f0d 0 0 0 1px,#0f0f0f1a 0 3px 6px,#0f0f0f33 0 9px 24px;overflow:hidden}[data-theme=dropdown-list] .tippy-content{padding:0;background:white;color:#303030}[data-theme=dropdown-list] .tippy-content .editor-command-bar{max-height:50vh}[data-theme=dropdown-list] .filterable-list{min-width:100px;max-width:300px;display:flex;flex-direction:column;max-height:100%}[data-theme=dropdown-list] .filterable-list .filter{padding:8px}[data-theme=dropdown-list] .filterable-list .filter .filter-container{width:100%;font-size:14px;line-height:20px;padding:3px 6px;position:relative;border-radius:3px;box-shadow:#0f0f0f1a 0 0 0 1px inset;background:rgba(242,241,238,.6);cursor:text;height:28px;box-sizing:border-box;display:flex;align-items:center}[data-theme=dropdown-list] .filterable-list .filter .filter-container input.filter-input{border:none;outline:none;flex-grow:1;background:transparent}[data-theme=dropdown-list] .filterable-list .list{max-height:60vh;overflow-y:auto;padding:8px 0}[data-theme=dropdown-list] .filterable-list .list .list-item{user-select:none;transition:background 20ms ease-in 0s;cursor:pointer;width:calc(100% - 8px);margin-left:4px;margin-right:4px;border-radius:3px;height:24px;padding:4px 8px;display:flex;align-items:center;box-sizing:border-box}[data-theme=dropdown-list] .filterable-list .list .list-item .list-text{white-space:nowrap}[data-theme=dropdown-list] .filterable-list .list .list-item.selected{background-color:#eee}[data-theme=dropdown-list] .filterable-list .list .list-item.disabled{color:#c1c1c1}::placeholder{color:#bbb}.toast{font-family:Avenir,Helvetica,Arial,sans-serif;visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:8px;position:fixed;z-index:1;left:50%;bottom:30px}.toast.show{visibility:visible;animation:toast_fade_in .5s,toast_fade_out .5s 2.5s}.toast.positioned.show{animation:toast_fade_in_positioned .5s,toast_fade_out_positioned .5s 2.5s}.toast.positioned{bottom:unset}@keyframes toast_fade_in{0%{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes toast_fade_out{0%{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes toast_fade_in_positioned{0%{opacity:0}to{opacity:1}}@keyframes toast_fade_out_positioned{0%{opacity:1}to{opacity:0}}div.tippy-box[data-theme=toolbar] .tippy-content,div.tippy-box[data-theme=menu] .tippy-content{padding:0}div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar.menu{min-width:180px}div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar-root,div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root{box-shadow:0 0 1px #30303040,0 12px 24px #30303026}div.tippy-box button{outline:none}.editor-command-bar-root{display:flex;flex-direction:column;align-items:flex-start;background:#ffffff;border-radius:2px;max-height:50vh;overflow:auto}.editor-command-bar-root.scrollable-bar>.editor-command-bar.menu{overflow-y:scroll}.editor-command-bar{pointer-events:all;display:flex;box-sizing:border-box;--text-color: #606060;--primary-color: #338fe5;--selected-color: #f8f8f8;--separator-color: #dedede;--warn-color: #fdf4f4}.editor-command-bar.fixed.toolbar{box-shadow:none}.editor-command-bar.menu{flex:1;width:100%;display:flex;flex-direction:column;align-items:flex-start;padding:5px 0}.editor-command-bar.menu .command-item.standard{color:var(--text-color);user-select:none;transition:background 20ms ease-in 0s;cursor:pointer;width:100%;height:32px;padding:6px 10px;display:flex;align-items:center;box-sizing:border-box}.editor-command-bar.menu .command-item.standard .menu-item-icon{align-items:center;height:24px;width:24px;margin-right:5px;margin-top:-2px;display:flex;flex-direction:column;justify-content:center}.editor-command-bar.menu .command-item.standard .menu-item-name{white-space:nowrap;flex-grow:1;display:flex;align-items:center}.editor-command-bar.menu .command-item.standard .item-subtext{color:#b2bccd}.editor-command-bar.menu .command-item.standard .menu-item-sub-indicator{display:flex;align-items:center;justify-content:center}.editor-command-bar.menu .command-item.standard .menu-item-sub-indicator svg{width:16px;height:16px}.editor-command-bar.menu .command-item.standard.disabled{color:#c7c7c7;cursor:not-allowed}.editor-command-bar.menu .command-item.separator{height:1px;margin:4px 0;background-color:var(--separator-color);width:100%}.editor-command-bar.menu .command-item.section{font-size:.8em;color:#ccc;padding:5px 5px 5px 10px}.editor-command-bar.menu .command-item.selected{background-color:var(--selected-color)}.editor-command-bar.menu .command-item.selected[data-id=delete]{background-color:var(--warn-color)}.editor-command-bar.menu .command-item.selected.disabled{background-color:transparent}.editor-command-bar.menu .command-item.checked{color:var(--primary-color)}.editor-command-bar.menu .command-item.checked .menu-item-checked-icon{display:flex;align-items:center;justify-content:center;margin-left:10px}.editor-command-bar.menu .command-item.checked.disabled{color:#c7c7c7}.editor-command-bar.menu .command-item span.highlight{color:#e52727}.editor-command-bar.toolbar{display:flex;flex-direction:row;align-items:flex-start;padding:5px 10px;gap:5px;background:#ffffff;box-shadow:0 0 1px #30303033,0 8px 16px #30303026;border-radius:3px}.editor-command-bar.toolbar .command-item{background:transparent;border:none;display:flex;align-items:center;justify-content:center;color:var(--text-color);height:24px;padding:0;cursor:pointer;border-radius:3px;min-width:24px}.editor-command-bar.toolbar .command-item.selected:not(.disabled){background-color:var(--selected-color)}.editor-command-bar.toolbar .command-item.disabled{color:#c7c7c7}.editor-command-bar.toolbar .command-item.checked{color:var(--primary-color)}.editor-command-bar.toolbar .command-item.checked.disabled{color:#c7c7c7}.editor-command-bar.toolbar .command-item.separator{margin:auto 2px;height:20px;min-width:1px;width:1px;background-color:var(--separator-color);padding:0;pointer-events:none;cursor:default}.editor-command-bar.toolbar .command-item .toolbar-item-name-container,.editor-command-bar.toolbar .command-item .toolbar-item-icon-container{display:flex}.editor-command-bar.toolbar .command-item[data-dropdown=true]{padding-left:4px;padding-right:4px}.editor-command-bar.toolbar .command-item[data-dropdown=true] .toolbar-item-icon-container{width:24px;height:24px;align-items:center;justify-content:center}.editor-command-bar.toolbar .command-item .toolbar-item-dropdown-container{display:flex}.editor-command-bar.toolbar .command-item .toolbar-item-dropdown-container svg{transform:rotate(360deg);transition:transform .2s linear}.editor-command-bar.toolbar .command-item.active .toolbar-item-dropdown-container svg{transform:rotate(180deg)}.editor-command-bar.toolbar .editor-button+.editor-button{margin-left:5px}.editor-command-bar.footer{width:100%}.reference-hidden .tippy-box[data-reference-hidden]{opacity:0;pointer-events:none;transition:none}.tippy-box[data-theme~=light]{color:#26323d;box-shadow:0 0 20px 4px #9aa1b126,0 4px 80px -8px #24282f40,0 4px 4px -2px #5b5e6926;background-color:#fff}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}.editor-dropdown{display:flex;align-items:center;border:1px solid #f0f0f0;border-radius:3px;font-size:14px;width:200px;height:30px}.editor-dropdown *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.editor-dropdown .dropdown-text,.editor-dropdown .dropdown-input{flex-grow:1;padding:2px 8px;border:none;outline:none;background:transparent;font-size:14px;color:#333;min-width:0;flex-shrink:1}.editor-dropdown .dropdown-text{margin-right:4.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:100%;cursor:text;display:flex;align-items:center}.editor-dropdown:hover{border-color:#338fe5}.editor-dropdown.active{border-color:#338fe5;box-shadow:0 0 0 2px #338fe533}.editor-dropdown.active .dropdown-text{display:none}.editor-dropdown:not(.active) .dropdown-input{display:none}.editor-dropdown .dropdown-labels{display:flex;align-items:center;flex-shrink:0}.editor-dropdown .dropdown-labels .dropdown-label{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;border-radius:3px;display:flex;align-items:center}.editor-dropdown .dropdown-labels .dropdown-label+.dropdown-label{margin-left:5px}.editor-dropdown .dropdown-clear-icon,.editor-dropdown .dropdown-icon{flex-shrink:0;width:16px;height:16px;margin-left:4px;display:flex;align-items:center;justify-content:center;cursor:pointer}.editor-dropdown .dropdown-clear-icon{color:#909090}.editor-dropdown.empty .dropdown-clear-icon,.editor-dropdown:not(:hover) .dropdown-clear-icon{display:none}.editor-dropdown.empty .dropdown-text{color:#909090}.editor-dropdown .dropdown-icon{margin-right:4px}.scale-border:after,.color-palette .palette-container-row .background-color-button.selected:after,.color-palette .palette-container-row .background-color-button:hover:after{content:"";outline:1px solid #d6e9fa;border-radius:3px;position:absolute;left:0;right:0;top:0;bottom:0;transform:scale(1.1)}.color-palette{display:flex;flex-direction:column;align-items:center;padding-top:5px;background-color:#fff;--active-color: #2872b7}.color-palette .bar-desc{box-sizing:border-box;width:100%;height:24px;padding-left:10px;margin-bottom:10px;line-height:24px;font-size:12px;font-weight:500;background:#F8F8F8;color:#909090}.color-palette .palette-container{padding:0 10px}.color-palette .background-color .palette-container-row:first-child{margin-bottom:5px}.color-palette .palette-container-row{display:flex;flex-direction:row;margin-bottom:20px}.color-palette .palette-container-row .color-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;background-color:#fff;border:1px solid #f0f0f0;display:flex;margin:0;padding:0;align-items:center;justify-content:center}.color-palette .palette-container-row .color-button:hover{border:1px solid #d6e9fa}.color-palette .palette-container-row .color-button.selected{border:1px solid var(--primary-color)}.color-palette .palette-container-row .color-button[data-color-index="-1"]{color:var(--text-color)}.color-palette .palette-container-row .color-button[data-color-index="0"]{color:var(--color-0)}.color-palette .palette-container-row .color-button[data-color-index="1"]{color:var(--color-1)}.color-palette .palette-container-row .color-button[data-color-index="2"]{color:var(--color-2)}.color-palette .palette-container-row .color-button[data-color-index="3"]{color:var(--color-3)}.color-palette .palette-container-row .color-button[data-color-index="4"]{color:var(--color-4)}.color-palette .palette-container-row .color-button[data-color-index="5"]{color:var(--color-5)}.color-palette .palette-container-row .color-button[data-color-index="6"]{color:var(--color-6)}.color-palette .palette-container-row .background-color-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;position:relative}.color-palette .palette-container-row .background-color-button.selected:after{outline:1px solid var(--primary-color)}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]{position:relative;background-color:#fff;border:1px solid #e8e8e8}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]:after{transform:scale(1.2)}.color-palette .palette-container-row .background-color-button[data-color-index="-1"]:before{content:"";position:absolute;width:1px;height:56px;top:2px;left:22px;background-color:#c7c7c7;transform:rotate(45deg) scale(.5);transform-origin:-1px -2px}.color-palette .palette-container-row .background-color-button[data-color-index="0"]{background-color:var(--background-color-0)}.color-palette .palette-container-row .background-color-button[data-color-index="1"]{background-color:var(--background-color-1)}.color-palette .palette-container-row .background-color-button[data-color-index="2"]{background-color:var(--background-color-2)}.color-palette .palette-container-row .background-color-button[data-color-index="3"]{background-color:var(--background-color-3)}.color-palette .palette-container-row .background-color-button[data-color-index="4"]{background-color:var(--background-color-4)}.color-palette .palette-container-row .background-color-button[data-color-index="5"]{background-color:var(--background-color-5)}.color-palette .palette-container-row .background-color-button[data-color-index="6"]{background-color:var(--background-color-6)}.color-palette .palette-container-row .background-color-button[data-color-index="7"]{background-color:var(--background-color-7)}.color-palette .palette-container-row .background-color-button[data-color-index="8"]{background-color:var(--background-color-8)}.color-palette .palette-container-row .background-color-button[data-color-index="9"]{background-color:var(--background-color-9)}.color-palette .palette-container-row .background-color-button[data-color-index="10"]{background-color:var(--background-color-10)}.color-palette .palette-container-row .background-color-button[data-color-index="11"]{background-color:var(--background-color-11)}.color-palette .palette-container-row .background-color-button[data-color-index="12"]{background-color:var(--background-color-12)}.color-palette .palette-container-row .background-color-button[data-color-index="13"]{background-color:var(--background-color-13)}.color-palette .palette-container-row .background-color-button[data-color-index="14"]{background-color:var(--background-color-14)}.color-palette .palette-container-row .color-button+.color-button{margin-left:5px}.color-palette .palette-container-row .background-color-button+.background-color-button{margin-left:5px}.color-palette .clear-button-container{box-sizing:border-box;width:100%;margin-bottom:5px;padding:0 10px}.color-palette .clear-button-container .clear-button{box-sizing:border-box;padding:3px 10px;width:100%;height:26px;background:#ffffff;color:#606060;border:1px solid #c7c7c7;border-radius:3px;cursor:pointer}.color-palette .clear-button-container .clear-button:hover{border-color:var(--primary-color);color:var(--primary-color)}.color-palette .clear-button-container .clear-button:active{border-color:var(--active-color);color:var(--active-color);background-color:#d6e9fa}.editor-input-wrap .editor-input-label{margin-top:8px;margin-bottom:8px;position:relative}.editor-input-wrap .editor-input-label.required:before{content:"*";color:#e82100;position:absolute;left:-8px;top:3px}.editor-input-wrap .editor-input-label .span{font-size:14px;line-height:1.4;font-weight:700;color:#303030}.editor-input-wrap .editor-input-container{display:flex;border:none;border-radius:4px;padding:4px;background-color:#fff}.editor-input-wrap .editor-input-container .editor-input{outline:none;border:1px solid #c7c7c7;border-radius:3px;padding:4px 10px;font-size:14px;line-height:1.4;color:#000;width:100%}.editor-input-wrap .editor-input-container .editor-input:focus{border-color:#338fe5;box-shadow:0 0 0 2px #338fe533}.editor-input-wrap.error .editor-input-container{border:1px solid #e82100}.editor-input-wrap.error .editor-input-container .editor-input{border:none;outline:none;box-shadow:unset}.editor-input-wrap.error .editor-input-error{margin-top:8px;color:red;display:block}.editor-input-wrap .editor-input-error{display:none}div.scroll-container-root{position:relative}div.scroll-container-root>div.scroll-container{position:relative;overflow-x:auto;overflow-y:hidden;box-sizing:border-box;line-height:0px}div.scroll-container-root>div.scroll-container>.scroll-area{position:relative;display:inline-block;overflow:hidden;line-height:normal}div.scroll-container-root>div.scroll-container{scrollbar-width:none}div.scroll-container-root>div.scroll-container::-webkit-scrollbar{height:0;opacity:0}div.scroll-container-root>div.container-scroll-tool .container-border-shadow{position:absolute;top:0;opacity:0;width:0;border:none;pointer-events:none;transition:opacity 50ms ease-in;z-index:1}div.scroll-container-root>div.container-scroll-tool .container-right-border-shadow{right:0;background:linear-gradient(90deg,rgba(31,35,41,0) 0,rgba(31,35,41,.1));border-right:0px solid #dee0e3}div.scroll-container-root>div.container-scroll-tool .container-left-border-shadow{left:0;background:linear-gradient(270deg,rgba(31,35,41,0) 0,rgba(31,35,41,.1));border-left:0px solid #dee0e3}div.scroll-container-root>div.container-scroll-tool .container-border-shadow.active{width:8px;opacity:1}div.scroll-container-root>div.container-scroll-tool .container-right-border-shadow.active{border-right-width:1px}div.scroll-container-root>div.container-scroll-tool .container-left-border-shadow.active{border-left-width:1px}div.scroll-container-root>div.container-scroll-tool .container-scrollbar{position:absolute;left:0;z-index:1000;visibility:visible;overflow-x:auto;overflow-y:hidden;cursor:auto}div.scroll-container-root>div.container-scroll-tool .container-scrollbar div{height:1px}div.scroll-container-root>div.container-scroll-tool div.container-scrollbar.fixed{position:fixed}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar{opacity:.6;transition:opacity .1s ease-in-out}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar{height:8px}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-track{background-color:transparent}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-thumb{background-color:#646a73cc;border-radius:8px}div.scroll-container-root.mac>div.container-scroll-tool .container-scrollbar::-webkit-scrollbar-button{display:none}[data-tippy-root]{font-family:Avenir,Helvetica,Arial,sans-serif}[data-command-bar-id=editor-toolbar]{padding-top:10px;padding-bottom:5px}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text]{height:32px;width:unset}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text].selected:hover{background-color:transparent}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text] .link-href-button{max-width:275px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#303030;text-decoration:none}[data-command-bar-id=editor-toolbar] .command-item[data-id=link-text] .link-href-button:hover{text-decoration:underline}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link],[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link]{height:32px}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link] svg,[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link] svg{stroke-width:2}[data-command-bar-id=editor-toolbar] .command-item[data-id=edit-link].selected:hover,[data-command-bar-id=editor-toolbar] .command-item[data-id=remove-link].selected:hover{background-color:transparent;color:#338fe5}[data-command-bar-id=quick-menu],[data-command-bar-id=empty-block-menu]{box-sizing:border-box;width:240px}[data-command-bar-id=quick-menu] .command-item.menu-item,[data-command-bar-id=empty-block-menu] .command-item.menu-item{width:100%;cursor:pointer}[data-command-bar-id=quick-menu] .command-item.menu-item.section,[data-command-bar-id=empty-block-menu] .command-item.menu-item.section{height:24px;padding:2px 10px;font-weight:500;font-size:12px;line-height:20px;color:#909090;background:#F8F8F8;min-height:initial;box-sizing:border-box;margin-bottom:5px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item{color:#303030;display:flex;width:100%;padding:6px 10px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container{display:flex;align-items:center;justify-content:center;padding-right:6px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container .quick-menu-item-icon,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-icon-container .quick-menu-item-icon{width:16px;height:16px;display:flex;align-items:center;justify-content:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content{flex-grow:1;display:flex;flex-direction:column;justify-content:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1{display:flex;align-items:center}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-name,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-name{flex-grow:1;font-size:14px;line-height:22px;color:#303030}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-subtext,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .item-subtext{color:#b2bccd}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .quick-menu-item-submenu-icon,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-1 .quick-menu-item-submenu-icon{display:flex;align-items:center;margin-left:12px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2{margin-top:5px}[data-command-bar-id=quick-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2 .item-markdown,[data-command-bar-id=empty-block-menu] .command-item.menu-item .quick-menu-item .quick-menu-item-content .item-line-2 .item-markdown{color:#b2bccd}[data-command-bar-id=quick-menu] .command-item.menu-item[data-id=placeholder] .quick-menu-item-icon-container,[data-command-bar-id=empty-block-menu] .command-item.menu-item[data-id=placeholder] .quick-menu-item-icon-container{display:none}[data-command-bar-id=quick-menu] .command-item.menu-item[data-id=placeholder] .item-name.text,[data-command-bar-id=empty-block-menu] .command-item.menu-item[data-id=placeholder] .item-name.text{color:#909090!important;padding:5px 0}[data-command-bar-id=block-menu]{width:240px}div.tippy-box[data-theme=editor-tooltip]{background-color:#303030;opacity:.8;font-size:12px;border-radius:3px}div.tippy-box[data-theme=editor-tooltip] .editor-tooltip-desc{display:block;margin-top:2px;color:#a8a9ab}div.tippy-box[data-theme=editor-tooltip]>.tippy-arrow:before{transform:scale(.8)}div.tippy-box[data-theme=editor-tooltip]>.tippy-content{padding:4px 10px;text-align:justify}.link-popup-content{padding:10px 7px}.link-popup-content .link-popup-gap{margin-top:16px}.link-popup-content .editor-input-container{padding:4px 0}.link-popup-content .editor-input-container .editor-input{width:330px;line-height:1.5}.link-popup-content .editor-input-wrap .editor-input-label{margin-bottom:4px}.link-popup-content .link-popup-footer{margin:10px 0 5px;text-align:right}.link-popup-content .link-popup-footer button{min-width:58px;min-height:30px;padding:0 10px;border-radius:3px;background-color:#eef3f8;font-size:14px;color:#fff;cursor:pointer;outline:none}.link-popup-content .link-popup-footer .cancel-button{margin:0 8px 0 0;background-color:transparent;border:1px solid #c7c7c7;color:#606060}.link-popup-content .link-popup-footer .cancel-button:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.link-popup-content .link-popup-footer .submit-button{outline:none;background-color:#338fe5;color:#fff;border:0}.link-popup-content .link-popup-footer .submit-button:disabled{color:#fff;background-color:#338fe580}.link-popup-content .link-popup-footer .submit-button:disabled:hover{background-color:#338fe580}.link-popup-content .link-popup-footer .submit-button:hover{background-color:#5ca5ea}:root{--mindmap-bg-color: #f0f2f4}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.focused [data-type=block-tools] .editor-mindmap-svg{border-radius:3px;outline:1px solid #338FE5}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.editor-in-mindmap-first{height:600px;min-width:150px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content]{margin-right:24px;transition:background-color .25s linear}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .editor-mindmap-svg{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2;font-size:14px;background-color:var(--mindmap-bg-color)}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar{position:absolute;top:8px;right:8px;height:24px;z-index:3}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar .editor-button.mindmap-button{background-color:transparent;outline:none;border:none;fill:none;color:#c1c1c1;cursor:pointer;min-width:initial;margin-right:0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .mindmap-toolbar .editor-button.mindmap-button:hover{color:#5587f0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.to-mindmap-highlight [data-type=block-content],.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block.to-mindmap-highlight:hover [data-type=block-content]{background-color:#eaf3fc}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-to-mindmap-wrap,.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .mention-button-wrap{position:absolute;right:0;top:2px;display:flex;align-items:center;height:calc(var(--font-size) * var(--line-height))}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-to-mindmap],.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=mention-button]{flex-grow:0;flex-shrink:0;width:24px;height:24px;min-width:24px;min-height:24px;padding:0;border:0;outline:0;display:flex;align-items:center;justify-content:end;background-color:transparent;color:#07142a}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-to-mindmap] svg,.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=mention-button] svg{width:16px;height:16px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button[data-button-id=list-block-mention]:hover>svg{cursor:initial;background-color:#eee}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block button+button[data-button-id=list-block-mention]{right:20px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="1"]{padding-left:24px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="1"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="2"]{padding-left:48px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="2"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="3"]{padding-left:72px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="3"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="4"]{padding-left:96px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="4"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="5"]{padding-left:120px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="5"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="6"]{padding-left:144px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="6"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="7"]{padding-left:168px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="7"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="8"]{padding-left:192px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="8"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="9"]{padding-left:216px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="9"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="10"]{padding-left:240px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="10"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="11"]{padding-left:264px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="11"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="12"]{padding-left:288px}div.editor-root div.editor-content div[data-block-type=text][block-padding-level="12"]>div[data-type=block-content]{position:relative}div.editor-root div.editor-content div[data-block-type=list][data-list-level="1"]{padding-left:0}div.editor-root div.editor-content div[data-block-type=list][data-list-level="2"]{padding-left:24px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="3"]{padding-left:48px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="4"]{padding-left:72px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="5"]{padding-left:96px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="6"]{padding-left:120px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="7"]{padding-left:144px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="8"]{padding-left:168px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="9"]{padding-left:192px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="10"]{padding-left:216px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="11"]{padding-left:240px}div.editor-root div.editor-content div[data-block-type=list][data-list-level="12"]{padding-left:264px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block+div[data-type=editor-block].list-block{margin-top:0}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block{display:flex;padding-bottom:2px;padding-top:2px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=text-only] .list-container{pointer-events:none}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=checked] div[data-type=block-content] span.text{color:#c7c7c7}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-list-type=unordered] .list-container .list-marker{font-family:PingFangSC-Regular,PingFang SC;justify-content:space-around}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content]{position:relative;flex-grow:1;padding-left:2px;margin-right:29px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-container{display:flex;min-width:24px;align-items:center;justify-content:center;flex-shrink:0;border-radius:3px;height:calc(var(--font-size) * var(--line-height))}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block .list-container .list-marker{min-width:16px;border:none;background-color:transparent;outline:none;display:flex;align-items:center;justify-content:flex-end;padding:0;overflow:visible;color:var(--primary-color);font-size:var(--font-size)}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block div[data-type=block-tools] .block-helper{top:2px}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=center]{justify-content:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=center]>div[data-type=block-content]{flex-grow:initial}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=right]{justify-content:flex-end}.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block[data-style-align=right]>div[data-type=block-content]{flex-grow:initial}.editor-root.readonly button[data-button-id=mindmap-close]{display:none}.editor-root:not(.readonly) div[data-type=editor-block].list-block.active,.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover{background-color:#f8f8f8}.editor-root:not(.readonly) div[data-type=editor-block].list-block.active .list-container,.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover .list-container{cursor:pointer}.editor-root:not(.readonly) div[data-type=editor-block].list-block .list-container:hover .list-marker{cursor:pointer}.editor-root:not(.readonly) div[data-type=editor-block].list-block:not([data-list-type=unchecked]):not([data-list-type=checked]):not([data-list-type=unordered]) .list-container:hover{background-color:var(--background-selection)}.editor-root:not(.readonly) div[data-type=editor-block].list-block[data-list-type=unordered] .list-container:hover .list-marker{cursor:initial}.editor-root:not(.readonly) div[data-type=editor-block].list-block[data-list-type=unchecked] .list-container:hover .list-marker svg>*{fill:var(--background-selection)}[data-tippy-root] .customize-start-panel{max-width:350px;padding:0 16px;color:#333;font-size:14px;line-height:21px;user-select:none;background-color:#fff!important}[data-tippy-root] .customize-start-panel-input{width:64px;margin:0 8px;border:1px solid #cfd6e1;height:24px;border-radius:3px;padding:1px 0 1px 8px;outline:none;color:inherit;background-color:#fff}[data-tippy-root] .customize-start-panel-button{min-width:40px;font-size:12px;min-height:30px;margin:0 8px 0 0;background-color:var(--primary-color);color:#fff;outline:none;border:none;padding:4px 8px;border-radius:4px;cursor:pointer}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block].list-block [data-type=block-content][data-content-placeholder]:before{left:2px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.math-box{display:inline-flex}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content]>span.math-box .mathjax-tex-text.mathjax-error{color:var(--color-0)}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax{max-width:100%}div.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=math]>div[data-type=block-content]{align-items:center;justify-content:center;min-height:40px}div.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=math]>div[data-type=block-content] img{margin:auto;padding:8px}.mathjax-editor-textarea{border:none;outline:none;width:400px;height:128px}.editor-text-button{border:0;color:var(--text-button-color, #c1c1c1);background-color:var(--text-button-bg-color, transparent);cursor:pointer;border-radius:var(--editor-border-radius, 3px);font-size:14px;padding:1px 6px;display:flex;align-items:center}.editor-text-button:hover{color:var(--text-button-color-hover, #5587F0);background-color:var(--text-button-bg-color-hover, transparent)}div[data-type=editor-block].table-block{--table-bar-width: 6px;--table-bar-left: -6px;--table-bar-top: -6px}div[data-type=editor-block].table-block>div[data-type=block-content]{position:relative;left:-26px}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content]:after{display:none}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content] div[data-type=table-content],div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content] div[data-type=table-content]{position:relative}div[data-type=editor-block].table-block.locked-by-self>[data-type=block-content] div[data-type=table-content]:after,div[data-type=editor-block].table-block.locked-by-others>[data-type=block-content] div[data-type=table-content]:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#303030;opacity:.1}div[data-type=editor-block].table-block div[data-type=table-tools] .table-resize-gripper{position:absolute;background-color:transparent;cursor:col-resize;padding:0 2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-resize-gripper>.table-resize-gripper-indicator{pointer-events:none;background-color:var(--primary-color);width:100%;height:100%}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container{position:absolute;background-color:transparent;z-index:10}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container.top{left:var(--table-bar-left);top:var(--table-bar-top);right:0;height:var(--table-bar-width);flex-direction:row}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container.left{top:0;left:var(--table-bar-left);width:var(--table-bar-width);bottom:0;flex-direction:column}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar{position:absolute;left:0;top:0;right:0;bottom:0;cursor:pointer;display:flex}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar.left{flex-direction:column}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell{background-color:#e8e8e8;position:relative;flex-grow:0;flex-shrink:0}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.corner{width:var(--table-bar-width)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.top{height:100%}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell:hover{background-color:#dedede}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.selected{background-color:var(--primary-color)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .table-border-bar-cell.danger{background-color:#e52727}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root{position:relative}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.top{max-width:0;width:0;overflow:visible}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.top:last-child{margin-left:-2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.left{max-height:0;height:0;overflow:visible}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root.left:last-child{margin-top:-2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container{position:absolute;width:26px;height:26px;display:flex;align-items:center;justify-content:center;z-index:1}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container.top{right:-14px;top:-22px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container.left{transform:rotate(270deg);left:-22px;bottom:-14px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .insert-indicator{position:absolute;width:3px;height:3px;background:#e8e8e8;border-radius:50%;margin-top:6px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-indicator{display:none}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-column-button{display:unset}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .insert-column-button span.icon{margin-top:2px}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container:hover .drop-marker{opacity:1;transform:scale(.7)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker{width:26px;height:26px;border-radius:3px;background:var(--primary-color);cursor:pointer;opacity:0;transform:scale(.4);transition:transform .2s ease-in,opacity .2s ease-in}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker:after{content:"";display:block;width:10px;height:1px;background-color:#fff;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}div[data-type=editor-block].table-block div[data-type=table-tools] .table-border-bar-container .table-border-bar .button-root .button-container .drop-marker:before{content:"";display:block;width:1px;height:10px;background-color:#fff;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}div[data-type=editor-block].table-block div[data-type=table-tools] .editor-table-chart{padding-top:16px}div[data-type=editor-block].table-block div[data-type=table-content]{position:relative}div[data-type=editor-block].table-block div[data-type=table-content]>.error{color:red;border:1px solid red;padding:8px}div[data-type=editor-block].table-block div[data-type=table-content]>table{border-collapse:collapse;width:max-content;border-spacing:0}div[data-type=editor-block].table-block div[data-type=table-content]>table colgroup col{min-width:40px}div[data-type=editor-block].table-block div[data-type=table-content]>table,div[data-type=editor-block].table-block div[data-type=table-content]>table td,div[data-type=editor-block].table-block div[data-type=table-content]>table th{border:1px solid #c7c7c7;background-color:transparent}div[data-type=editor-block].table-block div[data-type=table-content]>table tr td.danger{background-color:#fce9e9!important}div[data-type=editor-block].table-block div[data-type=table-content]>table td{min-width:40px;padding:0;position:relative}div[data-type=editor-block].table-block div[data-type=table-content]>table td .table-cell-menu-btn{display:none;position:absolute;right:2px;top:2px;padding:0;width:16px;height:16px;border:none;border-radius:3px;background:#eaf3fc;color:#338fe5;cursor:pointer;transform:rotate(0);transition:transform .2s}div[data-type=editor-block].table-block div[data-type=table-content]>table td .table-cell-menu-btn.active{transform:rotate(180deg)}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child{padding:8px}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child div[data-type=editor-block].table-block>div[data-type=block-content]{pointer-events:none}div[data-type=editor-block].table-block div[data-type=table-content]>table td>div[data-type=editor-container].child div[data-type=editor-block].table-block>div[data-type=block-content] div[data-type=table-content]{pointer-events:auto}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-0{background-color:var(--background-color-0)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-1{background-color:var(--background-color-1)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-2{background-color:var(--background-color-2)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-3{background-color:var(--background-color-3)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-4{background-color:var(--background-color-4)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-5{background-color:var(--background-color-5)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-6{background-color:var(--background-color-6)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-7{background-color:var(--background-color-7)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-8{background-color:var(--background-color-8)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-9{background-color:var(--background-color-9)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-10{background-color:var(--background-color-10)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-11{background-color:var(--background-color-11)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-12{background-color:var(--background-color-12)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-13{background-color:var(--background-color-13)}div[data-type=editor-block].table-block div[data-type=table-content]>table td.style-bg-color-14{background-color:var(--background-color-14)}div[data-type=editor-block].table-block div[data-type=table-content]>table.row-title>tbody>tr:first-child>td,div[data-type=editor-block].table-block div[data-type=table-content]>table.col-title td.col-title-item{background-color:#f8f8f8}div[data-type=editor-block].table-block div[data-type=table-content]>table.stripe:not(.row-title)>tbody>tr:nth-of-type(2n),div[data-type=editor-block].table-block div[data-type=table-content]>table.stripe.row-title>tbody>tr:nth-of-type(2n + 1){background-color:#f5f8fb}div[data-type=editor-block].table-block div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block div[data-type=table-content]>.no-border>tbody>tr>td{border:1px dashed;border-color:transparent}div[data-type=editor-block].table-block.focused div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block.focused div[data-type=table-content]>table.no-border>tbody>tr>td,div[data-type=editor-block].table-block.child-focused div[data-type=table-content]>table.no-border,div[data-type=editor-block].table-block.child-focused div[data-type=table-content]>table.no-border>tbody>tr>td{border-color:#b9bfc8}div[data-type=editor-block].table-block.full-selected>div[data-type=block-content]>.scroll-container-root>.scroll-container>.scroll-area>div[data-type=table-content]>table{background-color:var(--background-selection)}div[data-type=editor-block].table-block div[data-type=table-content]>table tbody tr td.selected,div[data-type=editor-block].table-block div[data-type=table-content]>table.row-title tbody tr td.selected,div[data-type=editor-block].table-block div[data-type=table-content]>table.col-title tbody tr td.selected{background-color:var(--background-selection)}div[data-type=editor-block].table-block div[data-type=table-content]>table td div[data-type=editor-block].table-block div[data-type=table-content]>table{max-width:100%}.command-item.menu-item .table-creator{background-color:#fff;padding:0 5px}.command-item.menu-item .table-creator .table-creator-row{display:flex}.command-item.menu-item .table-creator .table-creator-row .table-creator-cell{width:16px;height:16px;margin:3px;border:solid 1px #ddd}.command-item.menu-item .table-creator .table-creator-row .table-creator-cell.active{background-color:#99c7f2}div.editor-root div.editor-content div[data-type=editor-container].root div[data-type=editor-block].table-block{margin-top:0}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color]{width:100%}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .bar-desc{display:none}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item{box-sizing:border-box;width:100%;height:32px;padding:5px 10px;display:flex;align-items:center;justify-content:space-between;color:var(--text-color)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-sub-indicator{display:flex;align-items:center;margin-left:5px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-sub-indicator svg{height:16px;width:16px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button{width:24px;height:24px;border:none;outline:none;cursor:pointer;border-radius:3px;position:relative;margin-left:auto}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]{position:relative;background-color:#fff;border:1px solid #e8e8e8}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]:after{transform:scale(1.2)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="-1"]:before{content:"";position:absolute;width:1px;height:56px;top:2px;left:22px;background-color:#c7c7c7;transform:rotate(45deg) scale(.5);transform-origin:-1px -2px}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="0"]{background-color:var(--background-color-0)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="1"]{background-color:var(--background-color-1)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="2"]{background-color:var(--background-color-2)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="3"]{background-color:var(--background-color-3)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="4"]{background-color:var(--background-color-4)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="5"]{background-color:var(--background-color-5)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="6"]{background-color:var(--background-color-6)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="7"]{background-color:var(--background-color-7)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="8"]{background-color:var(--background-color-8)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="9"]{background-color:var(--background-color-9)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="10"]{background-color:var(--background-color-10)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="11"]{background-color:var(--background-color-11)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="12"]{background-color:var(--background-color-12)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="13"]{background-color:var(--background-color-13)}div.tippy-box[data-theme=menu] .tippy-content div[data-id=cell-background-color] .cell-background-color-item .item-button[data-color-index="14"]{background-color:var(--background-color-14)}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table]{background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.row-title>tbody>tr:first-child>td,div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.col-title td.col-title-item{background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.stripe:not(.row-title)>tbody>tr:nth-of-type(2n),div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-block-type=table] table.stripe.row-title>tbody>tr:nth-of-type(2n + 1){background-color:transparent}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment{box-shadow:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment table{box-shadow:0 2px #f8e6ab}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment table table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment table table{box-shadow:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active{outline:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active table{border-bottom:none;outline:4px solid #f8e6ab}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-block-type=table].comment.active table table,div.editor-root div.editor-content div[data-type=editor-container].child div[data-type=editor-block][data-block-type=table].comment.active table table{box-shadow:none;outline:none}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=center] [data-type=block-content][data-content-placeholder]:before{justify-content:center}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=right] [data-type=block-content][data-content-placeholder]:before{justify-content:right}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-title-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-title-placeholder);color:#c7c7c7}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-content-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-content-placeholder);color:#c7c7c7;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:flex;align-items:center}div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-tools] .block-placeholder-container{position:absolute;left:0;top:0;right:0}div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-title-placeholder]:before{position:absolute;left:0;top:0;right:0;bottom:0;content:attr(data-title-placeholder-readonly);color:#c7c7c7}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block{min-width:360px;counter-reset:code-line}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.full-selected{background-color:var(--background-selection)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.editing-language div[data-type=block-tools] .code-block-header,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.child-focused div[data-type=block-tools] .code-block-header,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:hover div[data-type=block-tools] .code-block-header{opacity:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.wrap>div[data-type=block-tools] .code-block-header button[data-id=wrap] *{color:var(--primary-color)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child{overflow-x:auto}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]{word-break:keep-all;overflow:visible;white-space:pre}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]>span.text,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block:not(.wrap)>div[data-type=block-content] div[data-type=editor-container].child div[data-type=block-content]>span.inputting-insertion{white-space:pre}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header{opacity:0;transition:opacity .3s ease-in 0s;position:absolute;top:0;display:flex;padding-left:16px;padding-right:4px;align-items:center;left:0;right:0;height:32px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .language-select{font-size:14px;color:#999;cursor:pointer;display:flex;align-items:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .language-select .arrow-icon{width:16px;height:16px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-spacer{flex-grow:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button{display:flex;justify-content:center;align-items:center;border:none;border-radius:2px;margin-left:4px;padding:0;background:none;outline:none;color:#c1c1c1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button:not(.disabled){cursor:pointer}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button:not(.disabled):hover{color:#5587f0}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button.disabled{cursor:not-allowed}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button[data-id=caption]{margin-right:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-icon{height:24px;display:flex;align-items:center;justify-content:center}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-icon>svg{width:24px;height:24px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-tools] .code-block-header .code-header-button .button-label{margin-left:4px;font-size:14px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block.full-selected>div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:unset}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:var(--background-code)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container]{padding-left:32px;padding-top:32px;padding-bottom:24px;border-radius:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container].selected{background-color:var(--background-selection)}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] *{font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:14px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block+div.text-block{margin-top:4px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block:before{content:counter(code-line);counter-increment:code-line;position:absolute;left:-48px;top:10px;z-index:1;margin-top:-4px;display:block;width:48px;padding-right:8px;text-align:right;color:#aaa;box-sizing:border-box;font-size:12px;font-weight:400;line-height:12px;letter-spacing:0;white-space:nowrap;opacity:1}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-comment,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-prolog,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-doctype,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-cdata{color:#708090}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-punctuation{color:#999}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-namespace{opacity:.7}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-property,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-tag,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-boolean,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-number,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-constant,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-symbol,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-deleted{color:#905}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-selector,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-attr-name,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-string,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-char,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-builtin,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-inserted{color:#690}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-operator,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-entity,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-url,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-string{color:#9a6e3a}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-atrule,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-attr-value,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-keyword{color:#07a}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-function,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-class-name{color:#dd4a68}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-regex,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-important,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-variable{color:#e90}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-important,.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-bold{font-weight:700}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-italic{font-style:italic}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-text-root>div.child[data-type=editor-container] div.text-block>div[data-type=block-content] span.style-code-entity{cursor:help}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-caption-root{padding:8px}.editor-root [data-type=editor-container].root div[data-type=editor-block].code-block>div[data-type=block-content]>div.editor-code-root>div.code-caption-root *{color:#aaa}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .code-header-button[data-id=wrap],div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .code-header-button[data-id=caption]{display:none}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .language-select{cursor:default!important}div.editor-root.readonly .container-blocks div[data-block-type=code] div[data-type=block-tools] .code-block-header .language-select .arrow-icon{display:none}div.editor-root div.editor-content div[data-type=editor-container].root.select-all div[data-type=block-content]>div.editor-code-root>div.code-text-root{background-color:unset}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer{position:absolute;background-color:transparent;border:1px solid #338FE5;pointer-events:none;z-index:1;display:none}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active{display:block}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper{position:absolute;width:16px;height:16px;border:2px solid white;background-color:#338fe5;border-radius:50%;pointer-events:all}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom{left:calc(50% - 8px);bottom:-8px;cursor:ns-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left{left:-8px;top:-8px;cursor:nwse-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right{right:-8px;top:-8px;cursor:nesw-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left{left:-8px;bottom:-8px;cursor:nesw-resize}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right{right:-8px;bottom:-8px;cursor:nwse-resize}div.editor-root.readonly div.editor-content div[data-type=editor-block]>[data-type=block-tools] .block-resizer{display:none}.before-content,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active:before,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected:not(.focused) [data-type=block-content] .images .image-container:before{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#338fe5;opacity:.1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image]{display:flex}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].block-hidden{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image][data-style-align=left]{justify-content:flex-start}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image][data-style-align=right]{justify-content:flex-end}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content]{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content] .images .image-container.empty:hover,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content] .images .image-container.error:hover{outline:1px solid #338FE5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content]:before{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content]{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active .image-warning{opacity:0;z-index:-1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].multi [data-type=block-tools] .block-resizer{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image]:not(.multi) [data-type=block-content] .images.empty{min-height:400px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content]{cursor:default}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images{width:100%;display:flex;align-items:flex-start}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter{width:10px;flex-grow:0;flex-shrink:0;padding:0 4px;cursor:col-resize;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter .image-splitter-indicator{width:100%;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter:active .image-splitter-indicator,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter:hover .image-splitter-indicator{background-color:#d9d9d9}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container{position:relative;flex:1;background-color:#f8f8f8;display:flex;min-height:inherit;overflow:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container img{max-width:100%;width:100%;height:auto}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty .upload-image-icon{display:flex;color:#c7c7c7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.error{height:100%;outline:1px solid #DEDEDE;border-radius:3px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.error img{display:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center;z-index:1}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-icon,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-icon{display:flex;color:#c7c7c7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message{display:flex;flex-direction:column;align-items:center;overflow:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-1,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-1{margin-top:10px;font-size:18px;font-weight:500;color:#303030;height:26px;vertical-align:middle;line-height:26px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex-shrink:0}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-2,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-3,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-2,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-3{font-size:14px;color:#606060;vertical-align:middle;height:22px;line-height:22px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex-shrink:0}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-2 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .error-message .line-3 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-2 a,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .upload-error .error-message .line-3 a{text-decoration:none;color:#338fe5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .line-3 a{display:inline-flex;align-items:center;text-decoration:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .load-error .line-3 a:after{content:" ";display:inline-block;width:16px;height:16px;margin-left:5px;background-image:url("data:image/svg+xml,%3Csvg width='17' height='16' viewBox='0 0 17 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.5 2H3.5C2.94772 2 2.5 2.44772 2.5 3V13C2.5 13.5523 2.94772 14 3.5 14H13.5C14.0523 14 14.5 13.5523 14.5 13V10' stroke='%23338FE5'/%3E%3Cpath d='M14.5 2L9 7.5' stroke='%23338FE5'/%3E%3Cpath d='M8.5 2H14.5V8' stroke='%23338FE5'/%3E%3C/svg%3E%0A")}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#303030;opacity:.8;display:flex;align-items:center;justify-content:center}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask .uploading-progress-bar{width:75%;height:6px;border-radius:3px;display:flex;background-color:#fff}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value{background-color:#338fe5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container .image-warning{position:absolute;right:5px;top:5px;color:#fff;background-color:#333;width:24px;height:24px;display:flex;align-items:center;justify-content:center;border-radius:3px;z-index:2;transition:opacity linear .2s;opacity:.7}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty{display:flex;flex-direction:column;align-items:center;outline:1px solid #DEDEDE;border-radius:3px;justify-content:center;height:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-container.empty svg{width:48px;height:48px}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-tools] .drag-container{display:flex;box-sizing:content-box;pointer-events:none;position:fixed;z-index:100;background-color:#fff;border:1px solid #338FE5}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-tools] .drag-container .drag-target{width:100%}.editor-root[readonly=true] .image-splitter{visibility:hidden}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment{box-shadow:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment [data-type=block-content]{box-shadow:0 2px #f8e6ab}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment.active{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].comment.active [data-type=block-content]{box-shadow:none;outline:4px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block].dragging div[data-type=block-tools] .block-helper{opacity:0}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper{position:absolute;right:100%;top:0;padding-right:5px;display:flex;align-items:center}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .helper-sizer{width:0;opacity:0;pointer-events:none}div[data-type=editor-block].locked-by-self>[data-type=block-content],div[data-type=editor-block].locked-by-others>[data-type=block-content]{position:relative}div[data-type=editor-block].locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others>[data-type=block-content]:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;z-index:1;background-color:#303030;opacity:.1}div[data-type=editor-block].locked-by-self.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-self.locked-by-self>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.locked-by-self>[data-type=block-content]:after{pointer-events:none}div[data-type=editor-block].locked-by-self.text-block>[data-type=block-content]:after,div[data-type=editor-block].locked-by-others.text-block>[data-type=block-content]:after{outline:2px solid #303030}.editor-root{--selected-color: #e8e8e8}.editor-root .editor-content.dragging *{cursor:grabbing!important}.editor-root .editor-content.dragging div[data-type=editor-block] iframe{pointer-events:none}.editor-root .editor-content .editor-drop-indicator{position:absolute;background-color:var(--primary-color);pointer-events:none;transition:top .2s linear,left .2s linear,width .2s linear}.editor-root .editor-content div[data-type=editor-block].text-block.highlighted{outline:2px solid var(--background-selection);background-color:var(--background-selection)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button{width:24px;height:24px;cursor:grab;margin:0;padding:0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:3px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button:hover{background-color:var(--selected-color)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .block-button svg{width:16px;height:16px;color:#909090}.drag-image-container{position:fixed;z-index:100;box-shadow:0 3px 20px #00000026;background-color:#fff;opacity:.4}.drag-image-container.drag-placeholder{width:500px;height:200px;border:1px solid #dedede;border-radius:3px;background:#e8e8e8}.drag-image-container .drag-image{width:100%;display:none}.drag-image-container[data-status=loaded] .drag-image{display:block}.drag-image-container[data-status=loaded] .drag-loading{display:none}.editor-command-bar-root .editor-command-bar .command-item.menu-item{display:flex;align-items:center;flex:none}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles{padding:5px 10px;background-color:#fff}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section+.text-style-section{margin-top:5px}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section{display:flex;flex-wrap:wrap}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon{width:24px;height:24px;padding:0;margin:0 5px 0 0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;outline:none;cursor:pointer;border-radius:3px;color:#606060}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon:hover{background-color:var(--selected-color)}.editor-command-bar-root .editor-command-bar .command-item.menu-item .text-styles .text-style-section .style-icon.active{color:#338fe5}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-anchor[data-id=paste-special-button-anchor]{z-index:unset}[data-command-bar-id=paste-special-button] .editor-command-bar.toolbar{padding:0}[data-command-bar-id=paste-special-button] .editor-command-bar.toolbar .command-item[data-dropdown=true]{padding-left:5px;padding-right:5px}.editor-find-dialog{--popover-input-border: 1px solid #CFD6E1;--editor-find-dialog-input-container-border-color: #CFD6E1;--editor-find-dialog-input-container-bg-color: transparent;--editor-border-radius-big: 3px;--editor-color: #07142A;--button-black-text-color: #333;--editor-find-dialog-button-color: #333;--editor-find-dialog-icon-button-color: #333;--editor-find-dialog-button-border-bg-color: rgba(255, 255, 255, .56);--editor-find-dialog-input-placeholder-color: #b9bfc8;--editor-find-dialog-button-disabled-color: #ccc !important;--editor-find-dialog-button-hover-color: rgba(150, 150, 150, .2);--editor-find-dialog-button-border: solid 1px #ccc;box-sizing:border-box;width:400px;background-color:var(--editor-find-dialog-bg-color);border:var(--editor-find-dialog-border);border-radius:var(--editor-border-radius-big);display:flex;padding:8px 8px 0 16px;align-items:flex-start;font-size:14px;font-family:var(--editor-font-family)}.editor-find-dialog .editor-find-content{display:flex;flex-direction:column;flex-grow:1;font-family:inherit}.editor-find-dialog .editor-find-dialog-row{display:flex;margin-bottom:8px;align-items:center}.editor-find-dialog .editor-find-dialog-label{width:80px;flex-grow:0;flex-shrink:0;align-self:center}.editor-find-dialog .editor-find-dialog-input-container{border:var(--popover-input-border);border-color:var(--editor-find-dialog-input-container-border-color);background-color:var(--editor-find-dialog-input-container-bg-color);border-radius:var(--editor-border-radius-big);flex-grow:1;display:flex;padding:2px;align-items:center;height:32px;box-sizing:border-box}.editor-find-dialog .editor-find-dialog-input{border:none;flex-grow:1;width:80px;outline:none;background-color:transparent;color:var(--editor-color)}.editor-find-dialog .editor-find-dialog-input::placeholder{color:var(--editor-find-dialog-input-placeholder-color);opacity:1}.editor-find-dialog .editor-find-dialog-prev{width:24px}.editor-find-dialog .editor-find-dialog-curr{flex-grow:0;text-align:center;flex-shrink:1;display:flex;align-items:center;margin-bottom:2px}.editor-find-dialog .editor-find-dialog-next{width:24px}.editor-find-dialog .editor-find-dialog-icon-button{cursor:pointer;border-radius:4px;color:var(--editor-find-dialog-icon-button-color);background-color:var(--editor-find-dialog-button-border-bg-color);border:none;display:flex;padding:0}.editor-find-dialog .editor-find-dialog-button{padding:6px 16px;cursor:pointer;border-radius:4px;color:var(--editor-find-dialog-button-color);background-color:var(--editor-find-dialog-button-border-bg-color);margin:0 4px;border:none;font-family:inherit;line-height:21px}.editor-find-dialog .editor-find-dialog-button.icon-button{width:32px;height:32px}.editor-find-dialog .editor-find-dialog-button.active,.editor-find-dialog .editor-find-dialog-button:hover{background-color:var(--editor-find-dialog-button-hover-color)}.editor-find-dialog .editor-find-dialog-button:disabled{color:var(--editor-find-dialog-button-disabled-color);cursor:default}.editor-find-dialog .editor-find-dialog-button:disabled:hover{background-color:transparent}.editor-find-dialog .editor-find-dialog-button svg{fill:currentColor}.editor-find-dialog .editor-find-dialog-space{flex-grow:1}.editor-find-dialog .editor-find-dialog-icon-button-border{margin:0 0 0 8px;cursor:pointer;border-radius:4px;color:var(--button-black-text-color);border:var(--editor-find-dialog-button-border);background-color:var(--editor-find-dialog-button-border-bg-color);padding:0;width:32px;display:flex;justify-content:center;align-items:center}.editor-find-dialog .editor-find-dialog-button-close{margin:0 0 0 8px;cursor:pointer;border-radius:4px;color:var(--button-black-text-color);background-color:var(--editor-find-dialog-button-border-bg-color);border:none;padding:0;width:32px;height:32px;display:flex;justify-content:center;align-items:center}.editor-find-dialog .editor-find-dialog-icon-button-border svg,.editor-find-dialog .editor-find-dialog-button-close svg{fill:currentColor}.editor-find-dialog .editor-highlight{opacity:.6;pointer-events:none}.editor-find-dialog .editor-highlight .editor-highlight-child{position:absolute;background-color:bisque}.editor-find-dialog .editor-highlight.active .editor-highlight-child{position:absolute;background-color:tomato}.editor-find-dialog .editor-search-result-highlight{opacity:.6;pointer-events:none}.editor-find-dialog .editor-search-result-highlight .editor-highlight-child{position:absolute;background-color:#40e0d0}.editor-find-dialog .editor-find-dialog-status{display:flex}.editor-highlight{opacity:.6;pointer-events:none}.editor-highlight .editor-highlight-child{position:absolute;background-color:bisque}.editor-highlight.active .editor-highlight-child{position:absolute;background-color:tomato}.editor-search-result-highlight{opacity:.6;pointer-events:none}.editor-search-result-highlight .editor-highlight-child{position:absolute;background-color:#40e0d0}.editor-find-dialog-status{display:flex}.comment-editor{font-size:14px;border:1px solid #c7c7c7;border-radius:3px;padding:1px 10px;margin:6px 10px 0}.comment-editor:after{content:"";height:0;display:block;clear:both}.comment-editor-root{display:inline-block;min-width:calc(100% - 40px);padding-top:2px}.comment-editor-root .editor-root .editor-content{padding:0}.comment-editor-img{float:right;color:#c1c1c1;padding:0}.comment-editor-root:not(.comment-editor-readonly) .editor-root .editor-content [data-type=editor-block]:not([data-block-type=text]){width:248px}.comment-editor-editing{border:1px solid #338fe5}.comment-editor-readonly{border:none;padding-left:37px;margin:0}.comment-editor-readonly .comment-editor-img{display:none}.comment-item-root{position:relative;margin-top:10px}.comment-item-root:not(.last-comment-item):before{content:" ";display:block;position:absolute;left:20px;width:1px;background-color:var(--editor-border-color, #e8e8e8);overflow:hidden;opacity:.8;top:21px;bottom:-12px;transform:scaleX(.5)}.comment-item-root .item-head{padding:0 10px;position:relative;display:flex;align-items:center}.comment-item-root .item-head-avatar{margin-right:5px;width:var(--editor-comment-avatar-width, 21px);height:var(--editor-comment-avatar-width, 21px);border-radius:100%}.comment-item-root .item-head-username{font-size:var(--editor-comment-username-font-size, 12px);color:var(--editor-comment-username-color, #07142a);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.comment-item-root .item-head-modified{margin-left:8px;font-size:12px;color:var(--editor-comment-modified-color, #808080);flex-grow:1;white-space:nowrap}.comment-item-root .item-head-tools{display:flex;align-items:center;visibility:hidden}.comment-item-root .item-head-tools .editor-text-button svg{width:20px;height:20px}.comment-item-root .item-head-tools.active{visibility:visible}.comment-item-root .item-actions{margin-top:10px;display:flex;justify-content:flex-end}.comment-item-root .item-actions.hidden{display:none}.comment-item-root .item-actions .editor-button[data-button-id=comment-item-cancel]{color:#606060;background:transparent;border:1px solid #c7c7c7}.comment-item-root .item-actions .editor-button[data-button-id=comment-item-cancel]:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.comment-item-root .item-actions .editor-button.disabled[data-button-id=comment-item-ok]{color:#fff;background-color:#338fe580;cursor:default}.comment-item-root:hover:not(.comment-item-editing) .item-head-tools{visibility:visible}.comment-item-root.readonly .item-head-tools{display:none}.mobile-comment-item{margin-top:4px;background-color:var(--editor-comment-layer-bg-color);padding-bottom:20px;color:var(--editor-comment-username-color)}.mobile-comment-item .item-head{padding:12px;display:flex;align-items:center}.mobile-comment-item .item-head-avatar{width:var(--editor-comment-avatar-size);height:var(--editor-comment-avatar-size);flex-grow:0}.mobile-comment-item .item-head-username{margin-left:12px}.mobile-comment-item .item-head-modified{margin-left:12px;color:#999}.mobile-comment-item .item-editor .comment-editor-readonly{padding-left:18px}.mini-comment-item{position:relative;line-height:16px;width:20px;height:16px;text-align:center;font-size:12px;border-radius:1px;background-color:var(--editor-comment-active-color, #FFC328);color:var(--editor-comment-mini-text-color, #ffffff);cursor:pointer}.mini-comment-item:after{content:"";position:absolute;left:50%;bottom:-4px;width:6px;height:6px;background-color:var(--editor-comment-active-color, #FFC328);border-radius:1px;transform:matrix(.71,.61,.82,-.71,0,0) translate(-50%);z-index:-1}.comment-quick-reply .quick-reply-button{position:absolute;left:8px;bottom:3px;z-index:2;color:var(--editor-comment-quick-reply-color, #7084A4);font-size:12px}.comment-quick-reply .quick-reply-button.editor-text-button:hover{color:var(--text-button-color-hover, #5587F0);background-color:var(--text-button-bg-color-hover, transparent)}.comment-quick-reply .quick-reply-editor{display:none}.comment-quick-reply .quick-reply-editor .reply-editor-actions{display:flex;justify-content:flex-end;margin-top:10px}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button[data-button-id=quick-reply-cancel]{color:#606060;background:transparent;border:1px solid #c7c7c7}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button[data-button-id=quick-reply-cancel]:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.comment-quick-reply .quick-reply-editor .reply-editor-actions .editor-button.disabled[data-button-id=quick-reply-ok]{color:#fff;background-color:#338fe580;cursor:default}.comment-quick-reply.hidden,.comment-quick-reply.reply-editor-editing .quick-reply-button{display:none}.comment-quick-reply.reply-editor-editing .quick-reply-editor{display:block}:root{--editor-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Robot, "Helvetica Neue", Helvetica, Arial, sans-serif;--editor-comment-layer-bg-color:#ffffff;--editor-comment-group-bg-color: #ffffff;--comment-root-border-color: #eaeaea;--editor-comment-layer-active-border-color: #cecece;--editor-box-shadow: 0px 3px 20px rgba(0, 0, 0, .15);--wiz-editor-z-comment-group-active-top-before: 29;--editor-comment-quote-color: #909090;--editor-comment-quote-before-bg-color: #909090;--editor-comment-switch-button-width: 12px;--editor-comment-active-color: #FFC328;--editor-bg-color: #ffffff;--wiz-editor-z-comment-head:11;--text-button-color-hover:#5587f0;--editor-comment-username-color:#07142A;--editor-comment-avatar-size: 32px}.disabled-scroll{overflow:hidden}.editor-root .editor-content div[data-type=editor-block].text-block.comment{box-shadow:none}.editor-root .editor-content div[data-type=editor-block].text-block.comment>div[data-type=block-content]>span{border-bottom:2px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block].text-block.comment.active{box-shadow:none;outline:none}.editor-root .editor-content div[data-type=editor-block].text-block.comment.active>div[data-type=block-content] span{background-color:#f8e6ab}.editor-root .editor-content div[data-type=editor-block] span.text.comment{border-bottom:2px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block] span.text.comment.active{background-color:#faf1d1}.editor-root .editor-content div[data-type=editor-block].comment{box-shadow:0 2px #f8e6ab}.editor-root .editor-content div[data-type=editor-block].comment.active{box-shadow:none;outline:4px solid #f8e6ab}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-comment-button{all:unset;position:absolute;right:-28px;top:0;width:24px;height:24px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:3px;color:#07142a;cursor:pointer}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-comment-button:hover{background:#eaeaea}.editor-web-comment-root{position:absolute;right:0;width:300px;top:0;bottom:0;transition:width .16s ease-in;will-change:width;font-family:var(--editor-font-family)}.editor-web-comment-root .comment-groups-container .comment-group-item-root{position:absolute;left:50%;right:0;width:290px;transform:translate(-50%);background-color:var(--editor-comment-group-bg-color);border-radius:2px;border-color:var(--editor-comment-layer-active-border-color);box-shadow:var(--editor-box-shadow);padding-bottom:18px}.editor-web-comment-root .comment-groups-container .comment-group-item-root:not(.no-animation){transition:top .2s ease-in,opacity .35s ease-in}.editor-web-comment-root .comment-groups-container .comment-group-item-root:before{content:"";position:absolute;left:0;right:0;height:6px;background-color:#fff;border-radius:2px 2px 0 0;z-index:var(--wiz-editor-z-comment-group-active-top-before)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head{display:flex;align-items:center}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-quote{box-sizing:content-box;font-size:12px;line-height:12px;height:12px;color:var(--editor-comment-quote-color);padding:18px 12px 10px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:100%;max-width:calc(100% - 80px)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-quote:before{content:"";display:block;width:2px;height:100%;background-color:var(--editor-comment-quote-before-bg-color);margin-right:6px;float:left;border-radius:10px}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch{display:flex;align-items:center;height:22px;padding-top:6px;visibility:hidden}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button{padding:0;width:var(--editor-comment-switch-button-width);margin:3px 0;color:#606060}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-up]{margin-right:16px}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button:not(.disabled):hover{color:var(--text-button-color-hover)}.editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button.disabled{color:#60606080;cursor:not-allowed}.editor-web-comment-root .comment-groups-container .comment-group-item-root.active:before{background-color:var(--editor-comment-active-color)}.editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch{visibility:visible}.editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply{display:none}.editor-mobile-comments-root{position:fixed;left:0;right:0;bottom:0;top:0;overflow:hidden;z-index:11}.editor-mobile-comments-root .mobile-comment-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:#00000073}.editor-mobile-comments-root .mobile-comment-groups-container{position:absolute;width:100%;height:100vh;z-index:1;overflow:hidden}.editor-mobile-comments-root .mobile-comment-groups-container .mobile-comment-groups-scroll-container{padding:0 12px}.editor-mobile-comments-root .mobile-comment-pull-info-container{position:absolute;right:0;left:0;bottom:100px;z-index:2;text-align:center;display:none}.editor-mobile-comments-root .mobile-comment-pull-info-container .mobile-comment-pull-info{display:inline-block;padding:12px;border-radius:36px;margin:0 auto;background-color:#000c;color:#fff;font-size:12px;opacity:0;transition:opacity .25s cubic-bezier(.65,.05,.36,1)}.editor-mobile-comments-root .mobile-comment-pull-info-container.active{display:block}.editor-mobile-comments-root .mobile-comment-pull-info-container.active .mobile-comment-pull-info{opacity:1}.editor-mobile-comments-root .mobile-group-item-root{margin:0 auto;width:100%;height:100vh;overflow:hidden}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item{min-height:calc(100vh + 1px);padding-bottom:50px}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item-space{height:50vh}.editor-mobile-comments-root .mobile-group-item-root .mobile-group-item-abstract{background-color:var(--editor-comment-layer-bg-color);padding:12px;color:#999;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.editor-mini-comment-root{position:absolute;right:0;top:0;bottom:0;width:48px;border-left:1px solid #f0f0f0;transition:width .16s ease-in;will-change:width;font-family:var(--editor-font-family);border:none;background-color:transparent;z-index:11}.editor-mini-comment-root .comment-groups-container{width:100%;height:100%}.editor-mini-comment-root .comment-groups-container .mini-group-item{position:absolute;top:0;left:50%;margin-left:-10px;transition:top .2s cubic-bezier(.65,.05,.36,1)}:is(.editor-web-comment-root,.editor-mobile-comments-root,.editor-mini-comment-root).hidden{display:none}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content]{margin:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content] span.file-icon{display:inline-flex;vertical-align:text-bottom}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=file] span[data-type=box-content] .file-name{color:var(--primary-color);padding:0;border-radius:12px;margin-right:4px;white-space:wrap;word-break:break-all;cursor:pointer}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office]{justify-content:start}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office].hover [data-type=block-content]{border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content]{max-width:360px;min-width:360px;height:48px;cursor:pointer}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root{display:flex;align-items:center;min-width:360px;max-width:100%;background-color:#f5f6f7;border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root:before{border-radius:3px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details{display:flex;flex-direction:column;justify-content:center;font-size:14px;flex-grow:1}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-name{color:#1f2329;max-width:185px;display:flex;flex-direction:row;align-items:center;white-space:nowrap}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-size{color:#646a73;font-size:12px;margin-top:2px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-details .file-name-pre{text-overflow:ellipsis;overflow:hidden}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-actions button{width:34px;height:34px;background-color:#fff;border:1px solid #dee0e3;border-radius:50%;margin:0 8px;padding:0;background-repeat:no-repeat;background-position:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-actions button svg{width:16px;height:16px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-icon{display:flex;width:36px;height:36px;margin:6px 6px 6px 12px}div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-icon>svg{width:100%;height:100%}div[data-type=editor-block].block-exclusive:after{content:attr(data-exclusive-tips);position:absolute;top:0px;left:0px;width:100%;background:#f8f8f8;border-radius:var(--editor-border-radius);white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-size:14px;line-height:22px;color:#909090;text-align:center;padding:9px 0}:root{--editor-version-button-border: black;--editor-bg-color: #ffffff;--editor-version-list-bg-color: white;--editor-version-select-bg-color: #F8F8F8}.version-dialog{display:flex;background-color:var(--editor-bg-color);width:100%;height:100%;color:var(--editor-color)}.version-dialog *{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;box-sizing:border-box}.version-dialog .version-viewer{flex:1;display:flex;flex-direction:column;width:0;padding:0}.version-dialog .version-viewer .version-dialog-editor{flex-grow:1;overflow-y:auto}.version-dialog .version-viewer .version-info-container{height:50px;border-bottom:#E8E8E8 1px solid;display:flex;align-items:center;flex-shrink:0;padding-left:20px;font-size:14px;color:#303030}.version-dialog .version-viewer .version-info-container .version-info-left .text-1{color:#909090}.version-dialog .version-viewer .version-info-container .version-info-left .name{font-weight:500}.version-dialog .version-viewer .version-info-container .editor-dropdown{margin-left:10px;margin-right:10px}.version-dialog .version-viewer .version-info-container .command-item[data-id=current-version]{min-width:200px;border:1px solid #f0f0f0}.version-dialog .version-viewer .version-info-container .command-item[data-id=current-version] .toolbar-item-name-container{flex-grow:1}.version-dialog .version-viewer .dialog-button-text{margin-top:1px;margin-left:-4px}.version-dialog .version-viewer .dialog-text-button{outline:none;background:transparent;border:none;display:flex;align-items:center;color:var(--editor-color);font-size:16px;font-weight:500;padding:4px 0;cursor:pointer}.version-dialog .version-viewer .dialog-text-button .dialog-button-icon{margin-right:0;width:24px;height:24px}.version-dialog .version-viewer .dialog-text-button .dialog-button-icon svg{fill:currentColor}.editor-root.history .root-container .editor-block .text-element .inline-plugin.editor-box-loading{display:none}.editor-root.history .editor-content{padding:30px 75px}.editor-root.history .history-inserted-block[data-type=editor-block] [data-type=block-content]{border:4px solid var(--op-selected-color)}.editor-root.history .history-inserted-block[data-type=editor-block]{position:relative}.editor-root.history .history-inserted-block[data-type=editor-block]:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-inserted-block[data-type=editor-block].table-block table{border:4px solid var(--op-selected-color)}.editor-root.history .history-inserted-block[data-type=editor-block].table-block table .child{pointer-events:none}.editor-root.history .history-inserted-block[data-type=editor-block].table-block{position:relative}.editor-root.history .history-inserted-block[data-type=editor-block].table-block:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-inserted-block[data-type=editor-block].table-block:hover:after{top:0}.editor-root.history .history-deleted-block [data-type=block-content]{border:4px solid var(--op-selected-color)}.editor-root.history .history-deleted-block [data-type=block-content]{position:relative}.editor-root.history .history-deleted-block [data-type=block-content]:after,.editor-root.history .history-deleted-block [data-type=block-content]:before{content:" ";position:absolute;display:flex;z-index:var(--wiz-editor-z-history-delete-marker);color:var(--op-color);justify-items:center;align-items:center;justify-content:center;align-content:center;pointer-events:none;overflow:visible;max-width:100%;max-height:100%;left:calc(50% - 16px);top:calc(50% - 2px);width:32px;height:4px;background-color:var(--op-color);transform:rotate(45deg);opacity:1}.editor-root.history .history-deleted-block [data-type=block-content]:before{transform:rotate(135deg)}.editor-root.history .history-deleted-block{position:relative}.editor-root.history .history-deleted-block:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-deleted-block .history-deleted-box{background-color:unset!important;text-decoration:unset!important}.editor-root.history .history-deleted-block .history-deleted-box:hover:after{opacity:0}.editor-root.history .history-inserted-text{line-height:revert!important;background-color:var(--op-selected-color)}.editor-root.history .history-inserted-text{position:relative}.editor-root.history .history-inserted-text:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history .history-deleted-box{background-color:var(--op-selected-color);text-decoration:line-through}.editor-root.history .history-deleted-box{position:relative}.editor-root.history .history-deleted-box:hover:after{content:attr(data-op-description);position:absolute;top:-26px;left:0;line-height:24px;background-color:var(--op-color);min-width:20px;opacity:1;color:#fff;padding:0 8px;z-index:var(--wiz-editor-z-history-op-description, 10);font-size:14px;font-weight:400;white-space:nowrap;border-radius:3px}.editor-root.history [data-box-type=history-deleted-box]>span[data-type=box-content]{border:none!important;margin:0!important}.editor-root.history [data-type=editor-block].table-block div[data-type=block-content]{overflow-x:revert}.editor-dialog-root{position:absolute;left:0;top:0;bottom:0;right:0;background-color:#639;z-index:100}.size-limit-textarea{display:inline-block;position:relative}.size-limit-textarea .size-limit-textarea-input{width:100%;resize:none;overflow:hidden;color:#303030;outline:none;border:1px solid #f0f0f0;border-radius:3px}.size-limit-textarea .size-limit-textarea-input:focus,.size-limit-textarea .size-limit-textarea-input:hover{border-color:#338fe5}.size-limit-textarea .size-limit-textarea-input:focus{box-shadow:0 0 0 2px #338fe533}.size-limit-textarea .size-limit-textarea-warning{position:absolute;right:0;bottom:10px;color:#909090;z-index:1;font-size:12px;pointer-events:none}.version-list-root{width:320px;background:var(--editor-version-list-bg-color);overflow-y:auto;padding:0;border-left:#E8E8E8 1px solid;display:flex;flex-direction:column}.version-list-root .version-list-header{padding:0 20px;font-size:14px;display:flex;align-items:center;margin-top:8px;margin-bottom:8px;flex-shrink:0;color:#909090}.version-list-root .version-list-header .version-count{flex-grow:1}.version-list-root .version-list-empty{height:100%;display:flex;align-items:center;justify-content:center;font-size:14px;color:#909090}.version-list-root .version-list-content{flex-grow:1;overflow-y:auto}.version-list-root .version-list-content .version-item{padding:15px 10px;cursor:pointer}.version-list-root .version-list-content .version-item.child{padding-left:32px}.version-list-root .version-list-content .version-item:not(.active):hover{background:rgba(112,132,164,.1)}.version-list-root .version-list-content .version-item.active{background-color:var(--editor-version-select-bg-color)}.version-list-root .version-list-content .version-item.active .version-item-title .version-actions{display:flex}.version-list-root .version-list-content .version-item.editing .version-item-memo{display:none}.version-list-root .version-list-content .version-item.active .version-item-memo{cursor:text}.version-list-root .version-list-content .version-item.active .version-item-memo:hover{outline:1px solid #338FE5}.version-list-root .version-list-content .version-item .version-item-restore-from{color:#909090;font-size:12px;line-height:1.5em;height:20px;padding:0 10px 10px}.version-list-root .version-list-content .version-item .version-item-restore-from:empty{display:none}.version-list-root .version-list-content .version-item .memo-input.size-limit-textarea{width:100%;min-height:60px}.version-list-root .version-list-content .version-item .memo-input.size-limit-textarea textarea{padding:5px 10px 10px;box-sizing:border-box;font-size:14px}.version-list-root .version-list-content .version-item .version-item-title{display:flex;align-items:center;padding-bottom:10px;padding-left:10px;padding-right:10px;height:24px}.version-list-root .version-list-content .version-item .version-item-title .version-item-date{font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.version-list-root .version-list-content .version-item .version-item-title .spacer{flex-grow:1}.version-list-root .version-list-content .version-item .version-item-title .version-actions{display:none}.version-list-root .version-list-content .version-item .version-item-title .version-actions button{display:flex;align-items:center;justify-content:center;height:16px;cursor:pointer;border:none;outline:none;background:transparent;padding:0 0 0 5px;color:#909090}.version-list-root .version-list-content .version-item .version-item-title .version-actions button:hover{color:#338fe5}.version-list-root .version-list-content .version-item .version-item-title .version-actions button.disabled,.version-list-root .version-list-content .version-item .version-item-title .version-actions button.disabled:hover{color:#c7c7c7}.version-list-root .version-list-content .version-item .version-item-title .version-actions .revert-button{border-left:1px solid #E8E8E8;margin-left:5px}.version-list-root .version-list-content .version-item .version-item-latest{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;border-radius:3px;display:flex;align-items:center;font-size:12px;margin-left:10px}.version-list-root .version-list-content .version-item .version-item-authors{list-style:none;margin:0;font-size:12px;padding-left:10px}.version-list-root .version-list-content .version-item .version-item-author{display:flex;align-items:center;margin-top:10px;color:#606060}.version-list-root .version-list-content .version-item .version-item-author-mark{width:6px;height:6px;border-radius:3px;margin-right:5px}.version-list-root .version-list-content .version-item .version-item-memo{font-size:14px;color:#303030;padding:5px 10px 10px;border-radius:3px}.version-list-root .version-list-content .version-item .version-item-memo:empty{display:none}.versions-dropdown-header{color:var(--text-color);height:44px;display:flex;align-items:center;padding-left:10px;border-bottom:1px solid #f0f0f0}.versions-dropdown-header .versions-dropdown-header-info{height:16px;color:#909090}.versions-dropdown-header .versions-dropdown-header-icon{height:16px;padding-left:5px;cursor:pointer}.editor-command-bar.menu .command-item.standard[data-id=prev-version]{height:44px}[data-command-bar-id=versions-dropdown-popup]{width:320px}[data-command-bar-id=versions-dropdown-popup] .tippy-box{color:var(--text-color)}[data-command-bar-id=versions-dropdown-popup] *{box-sizing:border-box}[data-command-bar-id=versions-dropdown-popup] .editor-command-bar-header{width:100%;margin-bottom:5px}[data-command-bar-id=versions-dropdown-popup] .command-item{width:100%;cursor:pointer}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container{padding:6px 10px;width:100%}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-memo{font-size:12px;color:#909090;line-height:20px}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-line1{line-height:22px;display:flex;align-items:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}[data-command-bar-id=versions-dropdown-popup] .command-item .version-item-container .version-item-line1 .version-item-latest{color:#338fe5;background-color:#eaf3fc;height:20px;padding:0 5px;margin-left:10px;border-radius:3px}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=no-versions]{height:34px;color:#909090;padding-left:10px;justify-content:center}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator]{width:100%;box-sizing:border-box}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item{width:100%}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-info{height:24px;color:#909090;display:flex;align-items:center;padding-left:10px;background-color:#f8f8f8;width:100%;box-sizing:border-box;margin:5px 0}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container{height:44px;display:flex;align-items:center;padding-left:10px;color:#303030}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container .filter-item-input{cursor:pointer;accent-color:#338FE5}[data-command-bar-id=versions-dropdown-popup] .command-item[data-id=filter-separator] .filter-memoed-version-item .filter-item-input-container .filter-item-label{user-select:none;cursor:pointer;line-height:1em}.editor-root.readonly .editor-content div[data-type=editor-block].focused div[data-type=block-tools] .block-helper .heading-marker,.editor-root.readonly .editor-content div[data-type=editor-block].highlighted div[data-type=block-tools] .block-helper .heading-marker{display:flex}.editor-root .editor-content div[data-type=editor-block].heading-collapsed div[data-type=block-tools] .block-helper .heading-collapse-button svg{transform:rotate(270deg)}.editor-root .editor-content div[data-type=editor-block].focused div[data-type=block-tools] .block-helper .heading-marker,.editor-root .editor-content div[data-type=editor-block].highlighted div[data-type=block-tools] .block-helper .heading-marker{display:none}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button{width:24px;height:24px;cursor:grab;margin:0;padding:0;display:flex;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:3px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker:hover,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button:hover{background-color:var(--selected-color)}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker svg,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button svg{transform:rotate(360deg);transition:transform .2s linear}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker svg,.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-collapse-button svg{width:16px;height:16px}.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] .block-helper .heading-marker:hover{background-color:transparent}.embed-block div[data-type=block-content] .editor-toc-container{display:block;width:100%;background-color:#f0f0f0;padding:20px}.embed-block div[data-type=block-content] .editor-toc-container.loading{margin:0;min-height:100px}.embed-block div[data-type=block-content] .editor-toc-container .toc-node+.toc-node{margin-top:10px}.embed-block div[data-type=block-content] .editor-toc-container .toc-node .toc-text{cursor:pointer;color:var(--primary-color)}.embed-block div[data-type=block-content] .editor-toc-container .toc-node .toc-children{margin-top:10px;padding-left:20px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=mention] span[data-type=box-content]{margin:0}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] [data-box-type=mention] span[data-type=box-content] .mention-name{color:var(--primary-color);padding:0;border-radius:12px;margin-left:4px;margin-right:4px;white-space:wrap;word-break:break-all;cursor:pointer}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-icon{width:20px;height:20px;border-radius:50%;overflow:hidden}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-icon img{width:100%;height:100%}[data-command-bar-id=editor-mention] .editor-command-bar.menu .command-item.menu-item .menu-item-name{flex-grow:0;margin-right:5px}.editor-root .editor-templates{position:fixed;bottom:26px;height:256px;width:auto;max-width:100%;padding-left:30px;padding-right:44px;overflow:hidden}.editor-root .editor-templates .editor-templates-title{color:#909090;font-size:14px;margin-left:0;margin-bottom:20px;line-height:19.6px}.editor-root .editor-templates .editor-templates-cards{display:flex;margin-left:0}.editor-root .editor-templates .editor-templates-cards .editor-template-card{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;cursor:pointer;flex-shrink:0;height:192px;width:188px;background:none;border:1px solid #e8e8e8;border-radius:3px;margin:0 0 0 15px;padding:0;align-items:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card:first-child{margin-left:0}.editor-root .editor-templates .editor-templates-cards .editor-template-card:hover{box-shadow:0 0 1px #30303033,0 8px 16px #30303026}.editor-root .editor-templates .editor-templates-cards .editor-template-card:hover>.editor-template-name{color:#338fe5}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-name{display:flex;align-items:center;height:40px;width:100%;border-top:1px solid #dedede;padding-left:20px;padding-right:20px;flex:0 0 50px;font-size:14px;font-weight:500;line-height:22px;color:#303030}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-name span{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-name{border-top:none}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-name span{padding-left:0;text-align:center}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-thumb-container{display:flex;align-items:center;justify-content:center;padding:16px 39px 14px}.editor-root .editor-templates .editor-templates-cards .editor-template-card.more .editor-template-thumb-container>img{width:110px;height:112px;max-width:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-thumb-container{flex:1;position:relative;padding:10px 5px 0;height:142px;margin:0;overflow:revert}.editor-root .editor-templates .editor-templates-cards .editor-template-card .editor-template-thumb-container>img{max-width:100%}.editor-dialog-container{min-width:500px;position:relative;left:-9px}.editor-dialog-container .dialog-header{display:flex;justify-content:space-between;align-items:center;padding:0 20px;border-bottom:1px solid #e8e8e8}.editor-dialog-container .dialog-header .close-icon{cursor:pointer}.editor-dialog-container .dialog-header .dialog-header-title{padding:8px 0 11px;font-size:18px;font-weight:700;flex-grow:1}.editor-dialog-container .dialog-content{padding:20px;border-bottom:1px solid #e8e8e8}.editor-dialog-container .dialog-footer{margin:10px 0 5px;padding:0 20px;text-align:right}.editor-dialog-container .dialog-footer button{min-width:58px;min-height:30px;padding:0 10px;border-radius:3px;background-color:#eef3f8;font-size:14px;color:#fff;cursor:pointer}.editor-dialog-container .dialog-footer .cancel-button{margin:0 8px 0 0;background-color:transparent;border:1px solid #c7c7c7;color:#606060}.editor-dialog-container .dialog-footer .cancel-button:hover{color:#303030;background:#eee;border:1px solid #c7c7c7}.editor-dialog-container .dialog-footer .submit-button{outline:none;background-color:#338fe5;color:#fff;border:0}.editor-dialog-container .dialog-footer .submit-button:hover{background-color:#5ca5ea}.embed-block[data-embed-type=webpage]{height:400px;min-height:100px;max-height:1000px}.embed-block[data-embed-type=webpage] .webpage-mask{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1;background-color:transparent}.embed-block[data-embed-type=webpage].resizing [data-type=block-tools] .block-resizer{pointer-events:all!important}.embed-block[data-embed-type=webpage].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=webpage].selected>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=webpage]>div[data-type=block-content]{justify-content:center;height:100%}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed{width:100%}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed .editor-preview-iframe{width:100%;max-height:500px;height:100%;border:none;position:relative}.embed-block[data-embed-type=webpage]>div[data-type=block-content]>.editor-embed .editor-preview-iframe-loading{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;justify-content:center;align-items:center;background-color:#fff}.webpage-content .help-container{color:#303030;border:1px solid #dedede;padding:10px;border-radius:4px;border-left:4px solid #338fe5;margin-top:16px;margin-bottom:16px}.webpage-content .help-container .help-content{display:flex;align-items:center}.webpage-content .help-container .help-content .help-icon{display:flex;align-items:center;height:20px;color:#338fe5;margin-right:12px}.webpage-content .help-link-container{margin-top:8px;display:flex;align-items:center}.webpage-content .help-link-container .help-link-content{display:flex;align-items:center;color:#338fe5;text-decoration:none}.webpage-content .help-link-container .help-link-content .help-link-icon{width:16px;height:16px;margin-left:8px}div.editor-root div.editor-content div[data-type=editor-container].root.select-all>.container-blocks>div[data-type=editor-block][data-embed-type=webpage]>div[data-type=block-content]:before{display:block}:root{--editor-quoted-color: #7084a4;--editor-drawio-empty-svg: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC43MjAzIDI4LjcwOTdIMjUuOTIzM0MyNS4yMTY1IDI4LjcwOTcgMjQuNjQzNSAyOC4xNDgxIDI0LjY0MzUgMjcuNDU1MlYyNS43MzMzSDIwLjUyODNDMjAuNDk4NiAyNS43Njk2IDIwLjQ2NjkgMjUuODA0MiAyMC40MzMzIDI1LjgzN0wxNS45MTkyIDMwLjI2MjFWMzQuNzU1NkgyNC42NDM1VjMzLjcyNzZDMjQuNjQzNSAzMy4wMzQ4IDI1LjIxNjUgMzIuNDczMiAyNS45MjMzIDMyLjQ3MzJIMzguNzIwM0MzOS40MjcgMzIuNDczMiA0MCAzMy4wMzQ4IDQwIDMzLjcyNzZWMzguNzQ1NUM0MCAzOS40MzgzIDM5LjQyNyA0MCAzOC43MjAzIDQwSDI1LjkyMzNDMjUuMjE2NSA0MCAyNC42NDM1IDM5LjQzODMgMjQuNjQzNSAzOC43NDU1VjM3LjMzMzNIMTQuNjI2M0MxMy45MTIyIDM3LjMzMzMgMTMuMzMzMyAzNi43NTYyIDEzLjMzMzMgMzYuMDQ0NFYzMC42OTQxTDguMzc4NTIgMjUuODM3QzguMTM2MjYgMjUuNjAxNCA4IDI1LjI4MDggOCAyNC45NDYzQzggMjQuNjExOCA4LjEzNjI2IDI0LjI5MTEgOC4zNzg1MiAyNC4wNTU2TDEzLjMzMzMgMTkuMTk4NVYxNS43NzJDMTEuNzc5OCAxNS4yMjI5IDEwLjY2NjcgMTMuNzQxNiAxMC42NjY3IDEyQzEwLjY2NjcgOS43OTA4NSAxMi40NTc1IDggMTQuNjY2NyA4QzE2Ljg3NTggOCAxOC42NjY2IDkuNzkwODUgMTguNjY2NiAxMkMxOC42NjY2IDEzLjcyNjUgMTcuNTU4OCAxNS4yNTgxIDE1LjkxOTEgMTUuNzk4OFYxOS4yODg4QzE1LjkxOTEgMTkuMzkxOCAxNS45MDY4IDE5LjQ5NDMgMTUuODgyMyAxOS41OTQzTDE5LjUxNTEgMjMuMTU1NUgyNC42NDM1VjIyLjQzNzNDMjQuNjQzNSAyMS43NDQ1IDI1LjIxNjUgMjEuMTgyOSAyNS45MjMzIDIxLjE4MjlIMzguNzIwM0MzOS40MjcgMjEuMTgyOSA0MCAyMS43NDQ1IDQwIDIyLjQzNzNWMjcuNDU1MkM0MCAyOC4xNDgxIDM5LjQyNyAyOC43MDk3IDM4LjcyMDMgMjguNzA5N1pNMjcuMjAzIDM3LjQ5MUgzNy40NDA2VjM0Ljk4MjFIMjcuMjAzVjM3LjQ5MVpNMTQuNDA1OSAyOC4xOTU0TDExLjA5MTUgMjQuOTQ2M0wxNC40MDU5IDIxLjY5NzJMMTcuNzIwNCAyNC45NDYzTDE0LjQwNTkgMjguMTk1NFpNMjcuMjAzIDI2LjIwMDhIMzcuNDQwNlYyMy42OTE4SDI3LjIwM1YyNi4yMDA4WiIgZmlsbD0iIzA3MTQyQSIvPgo8L3N2Zz4K)}.flex-center,.editor-drawio-iframe-container.loading:before,.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:after,.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:before{display:flex;align-items:center;justify-content:center}.full-screen,.editor-drawio-iframe-container.loading:before,.drawio-iframe-element,.editor-drawio-iframe-container{width:100%;height:100%}.editor-drawio-iframe-container{position:fixed;top:0;left:0;z-index:1000}div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content]{outline:1px solid #DEDEDE}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content]{justify-content:center;border-radius:3px;padding:10px}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio]>div[data-type=block-content] .editor-drawio-content{text-align:center}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed{width:240px;height:80px;display:inline-block;text-align:center}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:before{background-image:var(--editor-drawio-empty-svg);position:absolute;content:" ";color:var(--editor-quoted-color);top:8px;left:calc(50% - 24px);width:48px;height:48px}.embed-block .editor-empty-drawio.editor-drawio-content.editor-embed:after{position:absolute;content:attr(data-empty-drawio-content);color:var(--editor-quoted-color);bottom:0;left:0;width:100%;height:32px;top:50%}div.editor-root div.editor-content div[data-type=editor-container] div[data-embed-type=drawio].embed-block>div[data-type=block-content] img{max-width:100%;max-height:100%;width:100%;height:100%}.editor-drawio-iframe-container.loading:before{content:attr(data-placeholder);position:absolute;top:0;left:0;background-color:#f7f6f3;z-index:2}.editor-content .editing{background-color:#cdcdcd40}.editor-content div[data-type=block-tools] .embed-code-editor-container{position:absolute;top:0;left:0px;right:0px;bottom:0;background-color:#cdcdcd40;z-index:var(--wiz-editor-z-embed-code-editor-mask);padding:8px}.editor-content div[data-type=block-tools] .embed-code-editor-container textarea{width:100%;height:100%;resize:none;outline:none;padding:12px;border:1px solid #b9bfc8;border-radius:4px;background-color:#fff;color:#333}.flex-row-center,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=mermaid] div[data-type=block-content] .graph-embed,div[data-embed-type=flowchart] div[data-type=block-content] .graph-embed,div[data-embed-type=plantuml] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed:after,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed:after,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed:after,.embed-block,div[data-embed-type=mermaid],div[data-embed-type=flowchart],div[data-embed-type=plantuml]{display:flex;flex-direction:row;align-items:center;justify-content:center}.embed-block div[data-type=block-content],div[data-embed-type=mermaid] div[data-type=block-content],.embed-block div[data-type=block-content],div[data-embed-type=flowchart] div[data-type=block-content],.embed-block div[data-type=block-content],div[data-embed-type=plantuml] div[data-type=block-content]{width:100%;position:relative}.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed,.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed,.embed-block div[data-type=block-content] .empty-embed,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed{width:100%;min-height:106px;background-color:#cdcdcd40}.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=mermaid] div[data-type=block-content] .empty-embed:after,.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=flowchart] div[data-type=block-content] .empty-embed:after,.embed-block div[data-type=block-content] .empty-embed:after,div[data-embed-type=plantuml] div[data-type=block-content] .empty-embed:after{content:attr(data-empty-tips);position:absolute;top:0;right:0;width:100%;height:100%;color:#07142a;white-space:nowrap}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed),.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed),div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed){width:100%;height:100px}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed) img,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed) img,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed) img,div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed) img{display:none}.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=mermaid] div[data-type=block-content] .invalid-code:not(.empty-embed):after,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=flowchart] div[data-type=block-content] .invalid-code:not(.empty-embed):after,.embed-block div[data-type=block-content] .invalid-code:not(.empty-embed):after,div[data-embed-type=plantuml] div[data-type=block-content] .invalid-code:not(.empty-embed):after{content:attr(data-invalid-text);position:absolute;top:0;right:0;width:100%;height:100%;outline:1px solid red;display:flex;flex-direction:row;align-items:center;justify-content:center;color:red}.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=mermaid] div[data-type=block-content] .embed-img-content,.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=flowchart] div[data-type=block-content] .embed-img-content,.embed-block div[data-type=block-content] .embed-img-content,div[data-embed-type=plantuml] div[data-type=block-content] .embed-img-content{width:100%;text-align:center}.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=mermaid] div[data-type=block-content] .mermaid-embed-img,.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=flowchart] div[data-type=block-content] .mermaid-embed-img,.embed-block div[data-type=block-content] .mermaid-embed-img,div[data-embed-type=plantuml] div[data-type=block-content] .mermaid-embed-img{max-width:100%;min-width:200px}.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=mermaid] div[data-type=block-content] .editor-plantuml-img,.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=flowchart] div[data-type=block-content] .editor-plantuml-img,.embed-block div[data-type=block-content] .editor-plantuml-img,div[data-embed-type=plantuml] div[data-type=block-content] .editor-plantuml-img{max-width:100%}.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=mermaid] div[data-type=block-content] .embed-graph-img-content,.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=flowchart] div[data-type=block-content] .embed-graph-img-content,.embed-block div[data-type=block-content] .embed-graph-img-content,div[data-embed-type=plantuml] div[data-type=block-content] .embed-graph-img-content{width:100%;text-align:center;padding:10px}.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=mermaid] div[data-type=block-content] .embed-graph-img-content img,.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=flowchart] div[data-type=block-content] .embed-graph-img-content img,.embed-block div[data-type=block-content] .embed-graph-img-content img,div[data-embed-type=plantuml] div[data-type=block-content] .embed-graph-img-content img{max-width:100%}.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=mermaid] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=flowchart] div[data-type=block-content] .graph-embed,.embed-block div[data-type=block-content] .graph-embed,div[data-embed-type=plantuml] div[data-type=block-content] .graph-embed{width:100%}.hr-transition,.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container .editor-embed-hr{transition:border-top ease-in-out .4s}.embed-block[data-type=editor-block][data-embed-type=hr].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-type=editor-block][data-embed-type=hr].selected>div[data-type=block-content]{outline:none!important}.embed-block[data-type=editor-block][data-embed-type=hr]:is(.focused) div[data-type=block-content] .editor-embed-container .editor-embed-hr{caret-color:transparent}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container{display:flex;align-items:center;width:100%;height:24px}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-content] .editor-embed-container .editor-embed-hr{display:block;width:100%;border:none;margin:0;border-top:2px dashed #cccccc;cursor:pointer}.embed-block[data-type=editor-block][data-embed-type=hr] div[data-type=block-tools]>div.block-helper{height:100%}:root{--hover-color: #40a9ff}.flex-column-center,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{display:flex;justify-content:center;align-items:center;flex-flow:column}.common{width:400px;height:180px;background-color:#fafafa;border:1px dashed #d9d9d9;border-radius:2px;transition:border-color .3s}.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{height:200px}.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty .media-error-icon,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .media-error-icon{display:flex}.editor-root .editor-content div[data-type=editor-block].embed-block.media-block-uploading div[data-type=block-tools] .block-helper{display:none}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error{height:400px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty .media-error-icon,.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .media-error-icon{display:flex}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content]:after,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content]:after,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content]:after,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content]:after{display:none}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content] .media,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content] .media,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content] .media,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content] .media{position:relative}.embed-block[data-embed-type=video].locked-by-self>[data-type=block-content] .media:after,.embed-block[data-embed-type=video].locked-by-others>[data-type=block-content] .media:after,.embed-block[data-embed-type=audio].locked-by-self>[data-type=block-content] .media:after,.embed-block[data-embed-type=audio].locked-by-others>[data-type=block-content] .media:after{content:" ";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;z-index:1;background-color:#303030;opacity:.1}.embed-block[data-embed-type=video].hover>div[data-type=block-content],.embed-block[data-embed-type=audio].hover>div[data-type=block-content]{outline:none!important}.embed-block[data-embed-type=video].selected>div[data-type=block-content]:before,.embed-block[data-embed-type=audio].selected>div[data-type=block-content]:before{display:none}.embed-block[data-embed-type=video]>div[data-type=block-content],.embed-block[data-embed-type=audio]>div[data-type=block-content]{justify-content:center;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media.full-screen,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media.full-screen{width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media{display:flex;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress{position:relative;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress audio,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress audio{display:block;width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress video,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress video{display:block;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#303030;opacity:.8;display:flex;align-items:center;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar{width:75%;height:6px;border-radius:3px;display:flex;background-color:#fff;overflow:hidden}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-progress .uploading-progress-mask .uploading-progress-bar .uploading-progress-bar-value{background-color:#338fe5}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error{width:100%;background:#F8F8F8;outline:1px solid #DEDEDE;border-radius:3px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error-icon svg,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error-icon svg{width:48px;height:48px;color:#c7c7c7}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .line-1,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .line-1{margin-top:10px;font-size:18px;text-align:center;color:#303030}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .line-2,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .line-2{margin-top:5px;font-size:14px;text-align:center;color:#606060}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-error .retry-upload,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-error .retry-upload{margin-left:4px;color:#338fe5;cursor:pointer;text-decoration:none}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty{width:100%;background:#FFFFFF;outline:1px solid #DEDEDE;border-radius:3px}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-empty svg,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-empty svg{width:48px;height:48px;color:#c7c7c7}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element{width:100%;display:flex;justify-content:center}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .video-container video,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .video-container video{display:block;min-width:50px;max-width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .audio-container,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .audio-container{width:100%}.embed-block[data-embed-type=video]>div[data-type=block-content] .media-element .audio-container audio,.embed-block[data-embed-type=audio]>div[data-type=block-content] .media-element .audio-container audio{display:block;width:100%}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment{box-shadow:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment .media,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment .media{box-shadow:0 2px #f8e6ab}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment.active,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment.active{outline:none}.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=video].comment.active .media,.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=audio].comment.active .media{box-shadow:none;outline:4px solid #f8e6ab}`)),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
2
  (function(b,Hn){typeof exports=="object"&&typeof module<"u"?Hn(exports,require("kiwi-intl"),require("lodash.merge"),require("string-template"),require("nanoid"),require("events"),require("query-string"),require("js-base64"),require("snabbdom"),require("lodash.clonedeep"),require("lodash.isequal"),require("quill-delta"),require("tiny-typed-emitter"),require("lodash.intersection"),require("ot-json1"),require("axios"),require("lodash.findlastindex"),require("reconnecting-websocket"),require("fast-sha256"),require("lodash.debounce"),require("tippy.js"),require("blueimp-md5"),require("css-color-converter"),require("markmap-view"),require("lodash.throttle"),require("prismjs"),require("prismjs/components/prism-c"),require("prismjs/components/prism-cpp"),require("prismjs/components/prism-abap"),require("prismjs/components/prism-arduino"),require("prismjs/components/prism-bash"),require("prismjs/components/prism-basic"),require("prismjs/components/prism-clojure"),require("prismjs/components/prism-coffeescript"),require("prismjs/components/prism-csharp"),require("prismjs/components/prism-css"),require("prismjs/components/prism-dart"),require("prismjs/components/prism-diff"),require("prismjs/components/prism-docker"),require("prismjs/components/prism-elixir"),require("prismjs/components/prism-elm"),require("prismjs/components/prism-erlang"),require("prismjs/components/prism-flow"),require("prismjs/components/prism-fortran"),require("prismjs/components/prism-fsharp"),require("prismjs/components/prism-gherkin"),require("prismjs/components/prism-glsl"),require("prismjs/components/prism-go"),require("prismjs/components/prism-graphql"),require("prismjs/components/prism-groovy"),require("prismjs/components/prism-haskell"),require("prismjs/components/prism-java"),require("prismjs/components/prism-javascript"),require("prismjs/components/prism-json"),require("prismjs/components/prism-julia"),require("prismjs/components/prism-kotlin"),require("prismjs/components/prism-latex"),require("prismjs/components/prism-less"),require("prismjs/components/prism-lisp"),require("prismjs/components/prism-livescript"),require("prismjs/components/prism-lua"),require("prismjs/components/prism-makefile"),require("prismjs/components/prism-markdown"),require("prismjs/components/prism-markup"),require("prismjs/components/prism-matlab"),require("prismjs/components/prism-mermaid"),require("prismjs/components/prism-nix"),require("prismjs/components/prism-objectivec"),require("prismjs/components/prism-ocaml"),require("prismjs/components/prism-pascal"),require("prismjs/components/prism-perl"),require("prismjs/components/prism-php"),require("prismjs/components/prism-powershell"),require("prismjs/components/prism-prolog"),require("prismjs/components/prism-protobuf"),require("prismjs/components/prism-python"),require("prismjs/components/prism-r"),require("prismjs/components/prism-reason"),require("prismjs/components/prism-ruby"),require("prismjs/components/prism-rust"),require("prismjs/components/prism-sass"),require("prismjs/components/prism-scala"),require("prismjs/components/prism-scheme"),require("prismjs/components/prism-scss"),require("prismjs/components/prism-solidity"),require("prismjs/components/prism-sql"),require("prismjs/components/prism-swift"),require("prismjs/components/prism-typescript"),require("prismjs/components/prism-vbnet"),require("prismjs/components/prism-verilog"),require("prismjs/components/prism-vhdl"),require("prismjs/components/prism-visual-basic"),require("prismjs/components/prism-wasm"),require("prismjs/components/prism-yaml"),require("mime-db"),require("dom-to-image"),require("@guyplusplus/turndown-plugin-gfm"),require("turndown"),require("marked"),require("@better-scroll/core"),require("plantuml-encoder"),require("docx")):typeof define=="function"&&define.amd?define(["exports","kiwi-intl","lodash.merge","string-template","nanoid","events","query-string","js-base64","snabbdom","lodash.clonedeep","lodash.isequal","quill-delta","tiny-typed-emitter","lodash.intersection","ot-json1","axios","lodash.findlastindex","reconnecting-websocket","fast-sha256","lodash.debounce","tippy.js","blueimp-md5","css-color-converter","markmap-view","lodash.throttle","prismjs","prismjs/components/prism-c","prismjs/components/prism-cpp","prismjs/components/prism-abap","prismjs/components/prism-arduino","prismjs/components/prism-bash","prismjs/components/prism-basic","prismjs/components/prism-clojure","prismjs/components/prism-coffeescript","prismjs/components/prism-csharp","prismjs/components/prism-css","prismjs/components/prism-dart","prismjs/components/prism-diff","prismjs/components/prism-docker","prismjs/components/prism-elixir","prismjs/components/prism-elm","prismjs/components/prism-erlang","prismjs/components/prism-flow","prismjs/components/prism-fortran","prismjs/components/prism-fsharp","prismjs/components/prism-gherkin","prismjs/components/prism-glsl","prismjs/components/prism-go","prismjs/components/prism-graphql","prismjs/components/prism-groovy","prismjs/components/prism-haskell","prismjs/components/prism-java","prismjs/components/prism-javascript","prismjs/components/prism-json","prismjs/components/prism-julia","prismjs/components/prism-kotlin","prismjs/components/prism-latex","prismjs/components/prism-less","prismjs/components/prism-lisp","prismjs/components/prism-livescript","prismjs/components/prism-lua","prismjs/components/prism-makefile","prismjs/components/prism-markdown","prismjs/components/prism-markup","prismjs/components/prism-matlab","prismjs/components/prism-mermaid","prismjs/components/prism-nix","prismjs/components/prism-objectivec","prismjs/components/prism-ocaml","prismjs/components/prism-pascal","prismjs/components/prism-perl","prismjs/components/prism-php","prismjs/components/prism-powershell","prismjs/components/prism-prolog","prismjs/components/prism-protobuf","prismjs/components/prism-python","prismjs/components/prism-r","prismjs/components/prism-reason","prismjs/components/prism-ruby","prismjs/components/prism-rust","prismjs/components/prism-sass","prismjs/components/prism-scala","prismjs/components/prism-scheme","prismjs/components/prism-scss","prismjs/components/prism-solidity","prismjs/components/prism-sql","prismjs/components/prism-swift","prismjs/components/prism-typescript","prismjs/components/prism-vbnet","prismjs/components/prism-verilog","prismjs/components/prism-vhdl","prismjs/components/prism-visual-basic","prismjs/components/prism-wasm","prismjs/components/prism-yaml","mime-db","dom-to-image","@guyplusplus/turndown-plugin-gfm","turndown","marked","@better-scroll/core","plantuml-encoder","docx"],Hn):(b=typeof globalThis<"u"?globalThis:b||self,Hn(b["oneseditor-editor"]={},b.KiwiIntl,b.merge,b.stringFormat,b.nanoid$1,b.events,b.queryString,b.jsBase64,b.snabbdom,b.cloneDeep,b.isEqual,b.Delta,b.tinyTypedEmitter,b.intersection,b.json1,b.axios,b.findLastIndex,b.ReconnectingWebSocket,b.sha256,b.debounce,b.tippy$1,b.md5,b.cssColorConverter,b.markmap,b.throttle,b.Prism,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,b.mime,b.domToImage,b.turndownPluginGfm,b.TurndownService,b.marked,b.BetterScroll,b.plantumlEncoder,b.docx))})(this,function(b,Hn,ps,nB,oB,_3,rB,sa,xi,iB,sB,lB,Dt,cB,aB,uB,dB,hB,fB,mB,J1,gB,K1,pB,CB,AB,hee,fee,mee,gee,pee,Cee,Aee,bee,vee,yee,kee,wee,Bee,Eee,xee,Iee,Tee,Dee,See,Lee,Mee,Ree,Oee,_ee,Pee,Fee,Nee,$ee,Hee,jee,Uee,zee,Vee,Wee,qee,Gee,Zee,Qee,Yee,Jee,Kee,Xee,ete,tte,nte,ote,rte,ite,ste,lte,cte,ate,ute,dte,hte,fte,mte,gte,pte,Cte,Ate,bte,vte,yte,kte,wte,Bte,Ete,bB,vB,yB,kB,P3,wB,BB,ge){"use strict";var uee=Object.defineProperty;var dee=(b,Hn,ps)=>Hn in b?uee(b,Hn,{enumerable:!0,configurable:!0,writable:!0,value:ps}):b[Hn]=ps;var g=(b,Hn,ps)=>(dee(b,typeof Hn!="symbol"?Hn+"":Hn,ps),ps);const wt=n=>n&&typeof n=="object"&&"default"in n?n:{default:n};function Sd(n){if(n&&n.__esModule)return n;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const EB=wt(Hn),X1=wt(ps),xB=wt(nB),F3=wt(_3),fe=wt(iB),la=wt(sB),on=wt(lB),em=wt(cB),Ld=Sd(aB),IB=wt(uB),TB=wt(dB),DB=wt(hB),SB=Sd(fB),qt=wt(mB),LB=wt(J1),MB=Sd(J1),Md=wt(gB),RB=Sd(pB),OB=wt(CB),ca=wt(AB),tm=wt(bB),N3=wt(vB),_B=wt(kB),$3=wt(wB),PB=wt(BB);function FB(n){const e=o=>o<10?`0${String(o)}`:String(o),t=o=>o<10?`00${String(o)}`:o<100?`0${String(o)}`:String(o);return`${n.getFullYear()}-${e(n.getMonth()+1)}-${e(n.getDate())} ${e(n.getHours())}:${e(n.getMinutes())}:${e(n.getSeconds())}.${t(n.getMilliseconds())}`}var aa=(n=>(n.DEBUG="DEBUG",n.INFO="INFO ",n.WARN="WARN ",n.ERROR="ERROR",n))(aa||{});const H3=new Map,Rc=class{constructor(e){g(this,"times",new Map);this.category=e}shouldLog(e){const t=Object.values(aa).indexOf(e),o=Object.values(aa).indexOf(Rc.level);return t>=o}_log(e,t,o,r){var B;if(!this.shouldLog(e))return;const i=typeof process>"u"?{}:process;let s="";if(typeof t=="object")try{s="message"in t?t.message:JSON.stringify(t,null,4)}catch{s=""}else typeof t=="string"?t&&(s=t):s=JSON.stringify(t);s=r?`${s} - ${r}`:s;const l=`${this.category}`;let a=console.log;e==="WARN "&&(a=console.warn),e==="ERROR"&&(a=console.error);const d=`${FB(new Date)}`,f=e,p=l,A=Rc.extParams?"[{date}] {level}: [{module} {extParams}] - {msg}":"[{date}] {level}: [{module}] - {msg}",v=[xB.default(((B=i.env)==null?void 0:B.LOG_TEMPLATE)||A,{date:d,level:f,module:p,msg:s,extParams:Rc.extParams})];if(typeof t=="object"){const D=t.stack;D&&v.push(D)}if(a===console.error&&Rc.debugMode){const D=new Error().stack;D&&v.push(D)}a(...v),o&&this._log(e,o)}log(e,t){this._log("INFO ",e,void 0,t)}debug(e,t){this._log("DEBUG",e,void 0,t)}info(e,t){this._log("INFO ",e,void 0,t)}warn(e,t,o){this._log("WARN ",e,t,o)}error(e,t,o){this._log("ERROR",e,t,o)}time(e){this.times.set(e,Date.now())}timeEnd(e){this.timeLog(e),this.times.delete(e)}timeLog(e){const t=this.times.get(e);if(!t){this.warn(`no time label: ${e}`);return}this.debug(`${e}: ${Date.now()-t}`)}static setExtParams(e){this.extParams=e}};let Ii=Rc;g(Ii,"debugMode",!1),g(Ii,"level","DEBUG"),g(Ii,"extParams","");function S(n){const e=H3.get(n);if(e)return e;const t=new Ii(n);return H3.set(n,t),t}const NB={name:"Ones Editor",date:{dateFromFuture:"From future",dateJustNow:"Just now",dateYesterday:"Yesterday",dateMinutesAgo:"{num} minutes ago",date1HourAgo:"1 hour ago",dateHoursAgo:"{num} hours ago",dateDaysAgo:"{num} days ago",dateWeeksAgo:"{num} weeks ago"},common:{cancel:"cancel"},docx:{imageExportFailed:"Failed to load image"}},$B={name:"Ones Editor",date:{dateFromFuture:"\u6765\u81EA\u672A\u6765",dateJustNow:"\u521A\u521A",dateYesterday:"\u6628\u5929",dateMinutesAgo:"{num}\u5206\u949F\u524D",date1HourAgo:"1\u5C0F\u65F6\u524D",dateHoursAgo:"{num}\u5C0F\u65F6\u524D",dateDaysAgo:"{num}\u5929\u524D",dateWeeksAgo:"{num}\u5468\u524D"},common:{cancel:"\u53D6\u6D88"},docx:{imageExportFailed:"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"}},HB={name:"Ones Editor",date:{dateFromFuture:"\u672A\u6765\u304B\u3089",dateJustNow:"\u305F\u3060\u4ECA",dateYesterday:"\u6628\u65E5",dateMinutesAgo:"{num}\u5206\u524D",date1HourAgo:"1\u6642\u9593\u524D",dateHoursAgo:"{num}\u6642\u9593\u524D",dateDaysAgo:"{num}\u65E5\u524D",dateWeeksAgo:"{num}\u9031\u524D"},common:{cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},docx:{imageExportFailed:"\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"}},jB=S("i18n"),UB={"en-US":NB,"zh-CN":$B,"ja-JP":HB},Rd=EB.default.init("en-US",UB);function zB(n=void 0){Rd.setLang&&Rd.setLang(n||"en-US")}function VB(n){X1.default(Rd.__metas__,n)}function WB(n,e){const t=Rd.get(n,e);return t===n&&jB.warn(`no locale value for key ${n}`),t}const O=Object.freeze(Object.defineProperty({__proto__:null,setLang:zB,mergeLang:VB,t:WB},Symbol.toStringTag,{value:"Module"})),xte="";class j3{constructor(e,t){this.editor=e,this.data=t}getData(){return this.data}getEditor(){return this.editor}destroy(){}}class qB extends Error{constructor(e){if(super(e),this.code="Assert",this.stack){const t=this.stack.split(`
3
3
  `);if(t.length>1)if(this.lineNumber&&this.columnNumber){const o=t[1].match(/(.*)@(.*):(\d+):(\d+)/);o&&(this.lineNumber=+o[3],this.columnNumber=+o[4],this.fileName=o[2]),t.splice(0,1)}else t.splice(1,1);this.stack=t.join(`
4
4
  `)}}}function m(n,e,t){if(!e)throw n.error(`assert failed: ${t}`),new qB(t)}const GB=oB.customAlphabet("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",8),U3="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function ZB(){return U3[Date.now()%U3.length]}const K=()=>`${ZB()}${GB()}`;class z3 extends F3.default.EventEmitter{constructor(t=60){super();g(this,"cache",new Map);g(this,"expiredSeconds");this.expiredSeconds=t,this.startAutoClear()}delete(t){const o=this.cache.get(t);o&&this.emit("delete",o.data),this.cache.delete(t)}getSync(t,o){const r=this.cache.get(t),i=Date.now();if(r&&(i-r.lastRead)/1e3<this.expiredSeconds)return r.lastRead=i,r.data;const s=o(t);return this.cache.set(t,{lastRead:i,data:s}),s}async get(t,o){const r=this.cache.get(t),i=Date.now();if(r&&(i-r.lastRead)/1e3<this.expiredSeconds)return r.lastRead=i,r.data;const s=await o(t);return this.cache.set(t,{lastRead:i,data:s}),s}startAutoClear(){setInterval(()=>{const t=Date.now();Array.from(this.cache.entries()).forEach(([o,r])=>{(t-r.lastRead)/1e3>this.expiredSeconds&&this.delete(o)})},10*1e3)}}class ua{constructor(){g(this,"_callbacks",new Set)}get callbacks(){return Array.from(this._callbacks)}registerCallback(e){this._callbacks.add(e)}unregisterCallback(e){this._callbacks.delete(e)}clearCallbacks(){this._callbacks.clear()}}const QB=S("await-locker");class YB{constructor(){g(this,"_acquired",!1);g(this,"_waitingResolvers",[]);this._acquired=!1,this._waitingResolvers=[]}acquireAsync(e){return this._acquired?new Promise((t,o)=>{this._waitingResolvers.push(t),e&&e>0&&setTimeout(()=>{const r=this._waitingResolvers.indexOf(t);if(r!==-1){this._waitingResolvers.splice(r,1);const i=new Error(`lock timeout: ${e}, waiting resolves: ${this._waitingResolvers.length}`);o(i)}},e)}):(this._acquired=!0,Promise.resolve())}tryAcquire(){return this._acquired?!1:(this._acquired=!0,!0)}release(){if(!this._acquired)throw new Error("Cannot release an unacquired lock");if(this._waitingResolvers.length>0){const e=this._waitingResolvers.shift();m(QB,e,"Resolver missing"),e(void 0)}else this._acquired=!1}acquired(){return this._acquired}debug(){const e=this._waitingResolvers.length;return console.log(`waiting resolves: ${e}`),{waitingCount:e}}}class JB{constructor(){g(this,"_map");this._map=new Map}getLocker(e){let t=this._map.get(e);return t||(t=new YB,this._map.set(e,t)),t}async lock(e,t){await this.getLocker(e).acquireAsync(t)}release(e){this.getLocker(e).release()}remove(e){this.isLocking(e)||this._map.delete(e)}isLocking(e){return this._map.has(e)?this.getLocker(e).acquired():!1}}const yo=new JB;/**
@@ -24,7 +24,7 @@ Available method signatures are:
24
24
  `:""}const e6={boxType:"br",updateBoxContent:bI,convertTo:vI},t6=S("editor-boxes");class n6{constructor(e){g(this,"boxes",new Map);this.editor=e}registerBoxClass(e){const t=e.boxType,o=this.boxes.get(t);m(t6,!o,`duplicated box type: ${t}`),this.boxes.set(t,e)}getBoxClass(e){const t=this.boxes.get(e);return m(t6,t,`unknown box type: ${e}`),t}createBox(e,t){const o=LC(t),r=RC(o);return this.getBoxClass(t.type).updateBoxContent(this.editor,o,r,t),o}}function yI(n,e,t,o){const r=o,{width:i,height:s,src:l}=r,a=["editor-box-image"];r.link&&a.push("editor-box-image-link");const d=w("img",a,t);i&&(d.style.width=`${i}px`),s&&(d.style.height=`${s}px`),d.src=n.doc.buildResourceUrl(l)}const o6={boxType:"image",updateBoxContent:yI},kI="data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";function wI(n,e,t){W(t,"editor-box-anchor"),om(kI,[],t)}const r6={boxType:"anchor",updateBoxContent:wI};function BI(n,e,t,o){w("span",[],t,o.text)}const i6={insertionType:"inputting",updateInsertionContent:BI},s6=S("editor-insertion");class l6{constructor(e){g(this,"insertions",new Map);this.editor=e}registerInsertionClass(e){const t=e.insertionType,o=this.insertions.get(t);m(s6,!o,`duplicated insertion type: ${t}`),this.insertions.set(t,e)}getInsertionClass(e){const t=this.insertions.get(e);return m(s6,t,`unknown insertion type: ${e}`),t}createInsertion(e,t){const o=OC(t.type,t.id),r=PC(o);return this.getInsertionClass(t.type).updateInsertionContent(this.editor,o,r,t),o}}class EI{constructor(e){g(this,"cursors",new Map);g(this,"timer");this.editor=e,this.timer=this.startTimer()}add(e,t){this.cursors.set(e,t)}startTimer(){return setInterval(()=>{const e=Date.now();Array.from(this.cursors).forEach(([t,o])=>{if(e-o>3e3){const r=_C(this.editor,t);r&&te(r,"active"),this.cursors.delete(t)}})},1e3)}destroy(){clearInterval(this.timer)}}function xI(n,e,t,o){var l;const r=o;Date.now()-r.time<5*1e3&&(n.addCustom("active-cursors",d=>new EI(d)).add(r.id,r.time),W(e,"active")),w("span",[],t,"|").setAttribute("data-cursor-name",r.name),e.style.setProperty("--cursor-color",n.getColor((l=r.rainbowIndex)!=null?l:0))}const hg={insertionType:"remote-cursor",updateInsertionContent:xI};class c6{constructor(e){g(this,"decorators",[]);this.editor=e}registerDecorator(e){this.decorators.push(e)}decorateBlock(e,t){let o=t;return this.decorators.forEach(r=>{if(r.decorateBlock){const i=r.decorateBlock(this.editor,e,t);i&&(o=fe.default(i))}}),o}decorateText(e,t){let o=t;const r=new Map;return this.decorators.forEach(i=>{if(i.decorateText){const s=i.decorateText(this.editor,e,t);if(s){const{insertions:l,text:a}=s;l&&Array.from(l.entries()).forEach(([d,f])=>{const p=r.get(d);p?p.push(...f):r.set(d,f)}),a&&(o=fe.default(a))}}}),{insertions:r,text:o}}}const fg=S("editor-input");class II{constructor(e,t){g(this,"editor");g(this,"composing",!1);g(this,"callbacks");g(this,"inputElement");g(this,"handleDocumentSelectionChange",()=>{setTimeout(()=>{var t;const e=(t=document.getSelection())==null?void 0:t.focusNode;e&&this.editor.contains(e)&&!Ul(e)?(this.editor.emit("focus",this.editor),this.callbacks.onFocus(),this.editor.input.focus()):(this.editor.emit("blur",this.editor),this.callbacks.onBlur())},100)});g(this,"handleEditorSelectionChanged",()=>{const t=!this.editor.isWritable();this.inputElement.readOnly=t});g(this,"handleReadonlyChanged",()=>{this.handleEditorSelectionChanged()});g(this,"handleCompositionstart",e=>{this.composing=!0,this.callbacks.onCompositionStart(e)});g(this,"handleCompositionend",e=>{this.composing=!1,this.callbacks.onUpdateCompositionText(e,this.inputElement.value,!0),this.inputElement.value=""});g(this,"handleInput",e=>{if(e instanceof InputEvent&&!!e.data){if(this.editor.readonly){this.inputElement.value="";return}this.composing?this.callbacks.onUpdateCompositionText(e,e.data,!1):(this.callbacks.onInsertText(e,e.data),this.inputElement.value="")}});g(this,"handleKeyDown",e=>{if(!this.composing){if(this.callbacks.onKeyDown(e)){e.preventDefault(),e.stopPropagation();return}!this.editor.isWritable()||setTimeout(()=>{this.composing||(this.inputElement.value="")})}});g(this,"handleCopy",e=>{this.callbacks.onCopy(e)});g(this,"handleCut",e=>{if(this.editor.readonly){e.stopPropagation(),e.preventDefault();return}this.callbacks.onCut(e),fg.debug("on cut")});g(this,"handlePaste",e=>{if(this.editor.readonly){e.stopPropagation(),e.preventDefault();return}this.callbacks.onPaste(e)});g(this,"handlePasteText",e=>{this.callbacks.onPasteText(e)});this.editor=e,this.callbacks=t;const o=w("input",["editor-input"],e.contentElement);o.type="text",o.name="editor-input",o.onkeydown=this.handleKeyDown,o.oninput=this.handleInput,o.oncopy=this.handleCopy,o.onpaste=this.handlePaste,o.oncut=this.handleCut,o.addEventListener("compositionstart",this.handleCompositionstart),o.addEventListener("compositionend",this.handleCompositionend),this.inputElement=o,document.addEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.addListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}destroy(){this.callbacks.destroy(),document.removeEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.removeListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged);const e=this.inputElement;e.removeEventListener("compositionstart",this.handleCompositionstart),e.removeEventListener("compositionend",this.handleCompositionend),e.onkeydown=null,e.oninput=null,e.oncopy=null,e.onpaste=null,e.oncut=null}getInput(){return this.inputElement}focus(){this.editor.selection.caret.visible()||this.editor.selection.caret.update(),Kt.isMobileSafari?this.inputElement.focus():setTimeout(()=>{this.inputElement.focus()})}handleChanged(e){this.callbacks.onChanged(e)}handleRemoteChanged(e){this.callbacks.onRemoteChanged(e)}addHandler(e){this.callbacks.addHandler(e)}removeHandler(e){this.callbacks.removeHandler(e)}defaultInsertText(e,t,o,r,i){m(fg,e===this.editor,"invalid editor"),this.callbacks.defaultInsertText(e,t,o,r,i)}defaultHandleKeydown(e,t){return m(fg,e===this.editor,"invalid editor"),this.callbacks.defaultHandleKeydown(e,t)}}function a6(n){const e=n.rootElement,t=e.getBoundingClientRect(),o=vs(e),r=window.innerWidth,i=window.innerHeight,s=t.left<0?0:t.left,l=t.top<0?0:t.top,a=t.right>r?r:t.right,d=t.bottom>i?i:t.bottom,f=(s+a)/2,p=(l+d)/2,A=0-t.left+f,v=0-t.top+p,B=n.input.inputElement;B.style.left=`${A/o}px`,B.style.top=`${v/o}px`}const mg=S("editor-caret");class TI{constructor(e){g(this,"editor");g(this,"caretElem");g(this,"handleReadOnlyChanged",()=>{this.update()});this.editor=e,this.caretElem=w("div",["editor-cursor"],this.editor.contentElement),this.editor.on("readonlyChanged",this.handleReadOnlyChanged)}destroy(){this.editor.off("readonlyChanged",this.handleReadOnlyChanged)}visible(){const e=window.getComputedStyle(this.caretElem);return e.display!=="none"&&e.opacity!=="0"}hasCaret(){if(this.editor.readonly||!this.editor.selection.range.isCollapsed())return!1;const e=this.editor.selection.range.start;if(!(e instanceof $t))return!1;const t=this.editor.getBlockById(e.blockId);return!!ee(this.editor,t)}update(){if(q3(this.editor.rootElement))return;const e=this.caretElem;if(this.hasCaret())e.style.display="";else{e.style.display="none",a6(this.editor);return}const{range:t}=this.editor.selection;m(mg,t.isCollapsed,"range is not collapsed");const o=t.start;m(mg,o instanceof $t,"only simple block position can has caret");const r=this.editor.getBlockById(o.blockId);m(mg,ee(this.editor,r),"only text kind block can has caret");let i;const s=r.querySelector("span.inputting-insertion");s?(i=As(s),i=new DOMRect(i.right,i.top,1,i.height)):i=zn(r,o);const l=this.editor.contentElement.getBoundingClientRect(),a=i.left-l.left,d=i.top-l.top;e.style.left=`${a}px`,e.style.top=`${d}px`,e.style.height=`${i.height}px`;const f=this.editor.input.inputElement;f.style.left=`${a}px`,f.style.top=`${d+i.height-24}px`,Kt.isMobileSafari&&(f.style.left=`${a-4}px`,f.style.height=`${i.height}px`);const A=wo(r,{horizontal:!0}).getBoundingClientRect(),v=A.left-l.left,B=v+A.width;a<v||a>B?(a6(this.editor),e.style.display="none"):e.style.display=""}}function DI(n){jC(n),n.selection.range.getSelectedBlocks().forEach(e=>UC(n,e.block,e.start,e.end))}const SI=S("editor-dom");function u6(n){return wo(n.rootContainer).clientHeight}function LI(n){return n.getFirstBlock().getBoundingClientRect().top}function MI(n){return n.getLastBlock().getBoundingClientRect().bottom}function gg(n){const t=wo(n.rootContainer).getBoundingClientRect(),o=t.x<0?0:t.x,r=t.y<0?0:t.y,i=t.right>window.innerWidth?window.innerWidth:t.right,s=t.bottom>window.innerHeight?window.innerHeight:t.bottom;return new DOMRect(o,r,i-o,s-r)}function RI(n,e){const t=gg(n),o=n.getBlockById(e.blockId),i=Io(n,o,e);return ys(t,i.x,i.y)&&ys(t,i.right,i.bottom)}function d6(n,e){const t=gg(n),o=e.getBoundingClientRect();return o.top>=t.top&&o.top<=t.bottom||o.bottom<=t.bottom&&o.bottom>=t.top}function OI(n,e){const t=gg(n),o=e.getBoundingClientRect();return ys(t,o.x,o.y)||ys(t,o.right,o.bottom)}function _I(n){if(!cm(n.rootContainer)){SI.warn("editorScrollIntoView: editor is not visible");return}const e=n.rootContainer.getBoundingClientRect();if(e.height<1&&e.width<1)return;const t=n.selection,o=t.range.focus;if(!o.isSimple()){const f=o,p=n.getContainerById(f.childContainerId);OI(n,p)||p.scrollIntoView();return}if(t.range.start.blockId===t.range.end.blockId){const f=n.getBlockById(t.range.start.blockId);if(Lt(f)&&d6(n,f)||Le(n,f)&&d6(n,f))return}const r=o,i=n.getBlockById(r.blockId);if(RI(n,r))return;const s=Io(n,i,r),l=i.getBoundingClientRect(),a=Bt(i),d=w("div",["editor-block-anchor"],a);d.style.top=`${s.top-l.top}px`,am(d,{elementToScroll:wo(n.rootContainer)}),setTimeout(()=>{d.remove()},200)}function PI(n,e){if(e.isCollapsed())return!1;const t=St(n.rootContainer),o=Gt(n.rootContainer),{start:r,end:i}=e;return r.blockId===ie(t)&&r.offset===0&&i.blockId===ie(o)&&i.offset===ue(n,o)}const h6=S("range-in-block");function f6(n,e){const t=e.getEditor(),o=t.getBlockById(e.start.blockId),r=t.getBlockById(e.end.blockId),i=o===n||Ke(n,o),s=r===n||Ke(n,r);return!!(i||s)}function m6(n,e){const t=n.doc.toJSON(),o=new Set(Object.values(t.blocks).map(s=>s.map(l=>l.id)).flat());let r,i=lt(e);if(i){for(;i&&!o.has(ie(i));)i=lt(i);m(h6,i,"no prev block while deleting a block"),r=bt(n,i,ue(n,i))}else{const s=Ze(e);m(h6,s,"no prev and next block while deleting a block"),r=bt(n,s,0)}return r}const FI=S("block-to-html");function pg(n,e,t,o){const r=Ss(n,e.type);if(r.convertTo)return r.convertTo(n,e,t,"html",o);if(r.blockKind!=="text")return`[${e.type}]`;m(FI,e.text,"no text");const i=rt(e.text);return`<div>${Y3(i)}</div>`}const g6=S("block-to-text");function NI(n,e,t){let o="";return e.forEach(r=>{if(m(g6,typeof r.insert=="string","invalid op"),r.attributes&&r.attributes.box===!0){const i=r.attributes,s=n.editorBoxes.getBoxClass(i.type);if(s!=null&&s.convertTo){o+=s.convertTo(n,i,t,"text");return}if(r.attributes.text){o+=r.attributes.text;return}o+=`[${i.type}]`}o+=r.insert}),o}function uh(n,e,t,o){const r=Ss(n,e.type);return r.convertTo?r.convertTo(n,e,t,"text",o):r.blockKind!=="text"?`[${e.type}]`:(m(g6,e.text,"no text"),NI(n,e.text,t))}function Cg(n,e,t,o){const r=Ss(n,e.type);return r.convertTo?r.convertTo(n,e,t,"markdown",o):uh(n,e,t,o)}function dh(n,e){return e.blocks.root.map((r,i)=>pg(n,r,e,[{containerId:"root",blockIndex:i}])).join(`
25
25
  `)}function p6(n,e){return`<!doctype html><html><head><meta charset="utf8" /></head><body>${dh(n,e)}</body></html>`}function Ia(n,e){return e.blocks.root.map((r,i)=>uh(n,r,e,[{containerId:"root",blockIndex:i}])).join(`
26
26
  `)}function Ta(n,e){return e.blocks.root.map((r,i)=>Cg(n,r,e,[{containerId:"root",blockIndex:i}])).join(`
27
- `)}const $I=S("get-text-position");function ql(n,e){const t=e!=null?e:n.selection.range.start;t instanceof $t||m($I,!1,`invalid insert pos type: ${typeof t}`);const{blockId:o}=t,r=n.getBlockById(o),i=be(r),s=ne(r),l=ae(s),{offset:a}=t;return{block:r,container:s,containerId:l,blockIndex:i,offset:a}}const Da=S("insert-text");function C6(n,e,t,o){var s;const r=n.doc.getBlockData(e,t);if(m(Da,r,"no block data"),m(Da,r.text,"no block text"),rn(r.text)===0)return m(Da,o===0,"invalid text offset"),n.editorCommandProviders.getEmptyBlockTextAttributes(n,r.id);if(o===0)return;const i=jt(r.text,o-1,1).middle;if(!((s=i[0].attributes)!=null&&s.box))return i[0].attributes}function HI(n,e,t){const o=ne(e),r=ae(o),i=be(e);return C6(n,r,i,t)}function A6(n,e,t,o,r){const i=ne(e),s=ae(i),l=be(e),a=HI(n,e,t),d=th(t,o,a!=null?a:null);return n.doc.localUpdateBlockText(s,l,d,r),mn(n,e)}function b6(n,e,t,o){const r=ne(e),i=ae(r),s=be(e),l=th(t," ",o);return n.doc.localUpdateBlockText(i,s,l),mn(n,e)}function Ag(n,e,t,o,r){const i=n.doc.getBlockData(t,o);m(Da,i,"no block data"),m(Da,i.text,"no block text");const s=C6(n,t,o,r),l=th(r,e,s!=null?s:null);return n.doc.localUpdateBlockText(t,o,l),mn(n,n.getBlockById(i.id))}function bg(n,e){n.selection.range.isCollapsed()||n.clearSelectedContents();const{containerId:t,blockIndex:o,offset:r}=ql(n);Ag(n,e,t,o,r)}const hh=S("update-composition-text");function v6(n){const e=n.selection.range.start;e instanceof $t||m(hh,!1,`invalid insert pos type: ${typeof e}`);const{blockId:t}=e,o=n.getBlockById(t);m(hh,ee(n,o),"not a text kind block");const r=ne(o),i=ae(r),s=be(o),l=n.doc.getBlockData(i,s);m(hh,l,"no block data in doc"),m(hh,l.text,"no text data in text block");const a=Re(o);Jd(n,Di(o),t,a,l.text)}function y6(n){Ax(n)}function Gl(n,e,t,o,r,i){return n.doc.localInsertBlock(e,t,o,r,i),n.getBlockById(o.id)}const Sa=S("delete-block-text");function vg(n,e,t,o,r){if(!n.isBlockWritable(e))return Sa.error("block is not writable"),0;m(Sa,ee(n,e),"block is not a text kind block");const i=ne(e),s=ae(i),l=be(e),a=n.doc.getBlockData(s,l);m(Sa,a,"no block data in doc"),m(Sa,a.text,"no text data in text block");let d=t;sn(e,t)||(d=Ri(e,d));let f=t+o;m(Sa,f<=ue(n,e),`invalid offset and count: ${t}, ${o}`),sn(e,f)||(f=Os(e,f));const p=f-d,A=S4(d,p);return n.doc.localUpdateBlockText(s,l,A,r),p}const yg=S("break-text-block");function k6(n,e){const o=n.getBlockData(e).quoted;return o?{quoted:o}:{}}function Zl(n,e,t,o){m(yg,ee(n,e),`block is not a text kind block: ${Se(e)}`),m(yg,t>=0&&t<=ue(n,e),`invalid offset: ${t}`);const r=ne(e),i=ae(r),s=be(e),l=o!=null&&o.copyBlockAttributes?k6(n,e):{};if(!(o!=null&&o.forceInsertAfter)&&(t===0||t===ue(n,e))){const v=t===0?s:s+1,B={...sr(""),...l,...o==null?void 0:o.newBlockData},D=bt(n,e.id,0),I=Gl(n,i,v,B,D);return{block:e,newBlock:I}}m(yg,sn(e,t),"not a valid offset");const a=mn(n,e),{right:d}=xn(a,t),f=rn(d);f>0&&vg(n,e,t,f);const p={...sr(d),...l,...o==null?void 0:o.newBlockData},A=Gl(n,i,s+1,p,bt(n,p.id,0));return{block:e,newBlock:A}}const jI=S("prepare-insert-new-block");function UI(n,e,t){if(e&&t!==void 0&&t!==null){const d=n.getContainerById(e),f=At(d);return m(jI,t>=0&&t<=f.length,`invalid blockIndex: ${t}`),{containerId:e,blockIndex:t}}const o=n.selection.range.start;if(!o.isSimple())return null;const r=n.getBlockById(o.blockId);if(e=ae(ne(r)),t=be(r),!ee(n,r))return{containerId:e,blockIndex:t+1};const s=o.offset;if(s===0||s===ue(n,r))return{containerId:e,blockIndex:s===0?t:t+1};const a=Zl(n,r,s).newBlock;return{containerId:e,blockIndex:be(a)}}const zI=S("auto-insert-block");function w6(n,e,t,o,r,i){const s=UI(n,t,o);m(zI,s,`not an valid insert position: ${n.selection.range}`);const l={blockId:e.id,offset:0},a={anchor:l,focus:l};return Gl(n,s.containerId,s.blockIndex,e,r!=null?r:a,i)}const VI=S("delete-block");function fh(n,e,t){e.children&&(t.push(...e.children),e.children.forEach(o=>{n.getChildContainerData(o).forEach(i=>{fh(n,i,t)})}))}function mh(n,e,t){const o=ne(e),r=ae(o),i=be(e),s=n.doc.getBlockData(r,i);return m(VI,s,"no block data in doc"),n.doc.localDeleteBlock(r,i,Ht(n,{anchor:t.start,focus:t.end})),s}function kg(n,e,t){return n.undoManager.runInGroup(()=>{const o=ne(e);Bo(o)===1&&n.insertTextBlock("",ae(o),0);let r=t?Si(n,t):null;if(!r){const l=n.selection.range;f6(e,l)?r=m6(n,e):r=l}const i=mh(n,e,r),s=[];return fh(n,i,s),s.length>0&&n.doc.localDeleteChildContainers(s),i})}function WI(n,e){const t=[e];n.doc.getContainerBlocks(e).forEach(r=>{fh(n,r,t)}),n.doc.localDeleteChildContainers(t)}function B6(n,e){const t=[...e];e.forEach(o=>{n.doc.getContainerBlocks(o).forEach(i=>{fh(n,i,t)})}),n.doc.localDeleteChildContainers(t)}const wg=S("merge-text-block");function E6(n,e,t){m(wg,ee(n,e),"only text block can be merged"),m(wg,ee(n,t),"only text block can be merged");const o=_i(n,e),r=_i(n,t),i=o.text,s=r.text;m(wg,i&&s,"block data has no text");const l=ne(e),a=ae(l),d=be(e),f=ue(n,e),p=Ag(n,s,a,d,f),A=bt(n,e,rn(i));return kg(n,t,A),p}const lr=S("clear-selected-contents");function gh(n,e){m(lr,ee(n,e.block),"not a text kind block");const{start:t,end:o}=e;m(lr,t.isSimple(),"not a simple block position"),m(lr,o.isSimple(),"not a simple block position");const r=t.offset,i=o.offset;m(lr,r<=i,`invalid delete text offset: ${r}, ${i}`),r!==i&&n.deleteTextFromBlock(e.block,r,i-r)}function x6(n,e,t){const o=ae(e),r=At(e),i=t.focus?void 0:n.selection.range.toDocRange(),s=n.insertTextBlock("",o,0,{newRange:i});t.focus&&n.selection.selectBlock(s,0),r.reverse().forEach(l=>{n.deleteBlock(l)})}function qI(n,e){const{block:t,start:o,end:r}=e;if(ee(n,t)){gh(n,e);return}if(Lt(t)||o.isSimple()){m(lr,r.isSimple(),"invalid range");const s=ne(t),l=be(t),a=n.insertTextBlock("",ae(s),l);n.selection.selectBlock(a,0),n.deleteBlock(t);return}m(lr,Le(n,t),"invalid block kind"),m(lr,!o.isSimple()&&!r.isSimple(),"invalid range"),Ms(n,t,o,r),n.selection.range.getSelectedContainers().forEach((s,l)=>{x6(n,s,{focus:l===0})})}function GI(n){if(!n.isWritable())return;const e=n.selection.range;if(e.isCollapsed())return;const t=e.getSelectedBlocks();if(m(lr,t.length>0,"no selected block"),t.length===1){qI(n,t[0]);return}const o=t[0],r=o.block,i=ne(r);m(lr,t.length>1,"no selected block");const s=t[t.length-1],l=s.block;if(ee(n,r)){gh(n,o);const f=bt(n,o.block,o.start.offset);if(t.slice(1,t.length-1).reverse().forEach(A=>n.deleteBlock(A.block)),ee(n,l)){gh(n,s),n.mergeTextBlock(r,l,{focus:!0}),n.selection.setRange(f);return}n.deleteBlock(l),n.selection.setRange(f);return}if(ee(n,l)){gh(n,s),t.slice(0,t.length-1).reverse().forEach(f=>n.deleteBlock(f.block)),n.selection.selectBlock(s.block,0);return}if(t.length===Bo(i)){x6(n,i,{focus:!0});return}const a=lt(r),d=Ze(l);m(lr,a||d,"no prev or next block"),t.forEach(f=>n.deleteBlock(f.block))}function Bg(n){n.selection.range.isCollapsed()||n.undoManager.runInGroup(()=>{n.emit("beforeClearSelection",n);try{n.doc.beginBatchUpdate(),GI(n)}finally{n.doc.endBatchUpdate()}n.emit("afterClearSelection",n)})}const ZI=S("core");function I6(n,e,t){const o=ne(e),r=ae(o),i=be(e);return n.doc.localUpdateBlockText(r,i,t),setTimeout(()=>{n.selection.updateSelection(null)}),mn(n,e)}function T6(n,e,t){if(!n.isBlockWritable(e)){ZI.error("block is not writable");return}const o=n.getBlockText(e),r=ln.diff(o,t);I6(n,e,r)}function ph(n,e,t){const o=mn(n,e),r=typeof t=="string"?Oi(t):t,i=ln.diff(o,r);return I6(n,e,i)}const La=S("update-block-data");function Ch(n,e,t,o){const r=ne(e),i=ae(r),s=be(e),l=n.doc.getBlockData(i,s),a={insert:{},delete:[]},d=new Set(Object.keys(l)),f=new Set(Object.keys(t));return d.forEach(A=>{if(!f.has(A)){if(A==="id"||A==="type"||A==="text")return;La.debug(`delete key: ${A}`),a.delete.push(A)}}),Object.entries(t).forEach(([A,v])=>{m(La,A!=="id"&&A!=="type",`invalid block data delta, ${A}`);const B=l[A];if(v==null){B!=null&&(La.debug(`delete key: ${A}`),a.delete.push(A));return}B!==v&&(la.default(B,v)||A==="text"&&ln.diff(B,v).length===0||(d.has(A)?(La.debug(`replace key: ${A}`),a.delete.push(A)):La.debug(`insert key: ${A}`),a.insert[A]=v))}),n.doc.localUpdateBlockData(i,s,a,o),_i(n,e)}function D6(n,e,t,o){const i={...n.getBlockData(e),embedData:t};return n.updateBlockData(e,i,o)}function Eg(n,e,t){if(!Le(n,e)||!(t!=null&&t.tryFocusToChildSimpleBlock)){n.selection.selectBlock(e,0);return}const r=jn(n,e).getChildContainers(n,e)[0],i=St(r);Eg(n,i,t)}function Fs(n){const e=[];let t={};return n.forEach(o=>{e.push(...o.blocks.root);const{root:r,...i}=o.blocks;t={...t,...i}}),{blocks:{...t,root:e},meta:{},comments:{}}}const Ma=S("clone-block");function Pi(n,e,t,o){const r=n.getBlockClass(t.type);if(r.blockToDoc)return r.blockToDoc(e,t,(f,p)=>(m(Ma,t!==p,"invalid child block"),Pi(n,f,t,o)));let i={};const s=new Map,l=fe.default(t);l.children&&(l.children=l.children.map(f=>{const p=K(),A=e.blocks[f];m(Ma,Array.isArray(A),"invalid child blocks");const v=A.map(_=>Pi(n,e,_,o)),B=Fs(v),{root:D,...I}=B.blocks;return i={...i,...I},i[p]=B.blocks.root,s.set(f,p),p}));const a=Array.from(s.entries()),d=f=>{for(const p of a){const[A,v]=p;{const B=`${A}/`;if(f.startsWith(B)){const D=f.substring(B.length),I=`${v}/${D}`;return Ma.debug(`replace key: ${f} -> ${I}`),I}}{const B=`${A}_`;if(f.startsWith(B)){const D=f.substring(B.length),I=`${v}_${D}`;return Ma.debug(`replace key: ${f} -> ${I}`),I}}}return f};return Array.from(Object.entries(l)).forEach(([f,p])=>{const A=d(f);A!==f&&delete l.key,l[A]=p}),l.id=K(),o&&(o.blockIdMap.set(t.id,l.id),s.forEach((f,p)=>o.containerIdMap.set(p,f))),{blocks:{root:[l],...i},meta:{},comments:{}}}function xg(n,e,t,o){const r=e.blocks[t];m(Ma,Array.isArray(r),"invalid child blocks");const i=r.map(l=>Pi(n,e,l,o));return Fs(i)}function Ig(n,e,t){const o=e.blocks.root.map(r=>Pi(n.editorBlocks,e,r,t));return fe.default(Fs(o))}const S6=S("insert-doc");function L6(n,e,t,o,r){if(Le(n,e)){S6.warn("failed to insert doc into a complex block");return}const i=Ig(n,o,r),s=ne(e),l=be(e),a=ae(s);n.doc.beginBatchUpdate(),n.undoManager.runInGroup(()=>{var R,U,z;Object.entries(i.blocks).forEach(([q,oe])=>{q!=="root"&&n.doc.localInsertChildContainer(q,oe)});const d=i.blocks.root;if(Lt(e)){n.deleteBlock(e);let q;d.reverse().forEach(oe=>{const me=n.insertBlock(a,l,oe);q||(q=me)}),q&&n.selection.selectBlock(q,ue(n,q));return}if(m(S6,ee(n,e),"not a text block"),dt(n,e)){const q=a==="root"&&n.getBlockByIndex(a,0)===e,oe=be(e);let me;d.forEach((Be,je)=>{const Ue=n.insertBlock(a,oe+je,Be);je===d.length-1&&(me=Ue)}),me&&n.selection.selectBlock(me,ue(n,me)),q&&n.deleteBlock(e);return}if(d.length===1){const q=d[0];if(Ca(n,q.type)){n.insertTextToBlock(e,t,(R=q.text)!=null?R:[]);return}n.breakTextBlock(e,t),n.insertBlock(a,l+1,q);return}const f=t===ue(n,e),p=t===0,A=d[0],v=d[d.length-1];let B;!f&&!p?B=n.breakTextBlock(e,t,{forceInsertAfter:!0}):B=e;const D=p?l:l+1;f?(B=n.insertBlock(a,l+1,v),n.selection.selectBlock(B,ue(n,B))):(n.selection.selectBlock(B,0),Ca(n,v.type)?n.insertTextToBlock(B,0,(U=v.text)!=null?U:[]):n.insertBlock(a,D,v));const I=n.selection.range;let _=D;Ca(n,A.type)?p?(n.insertBlock(a,D,A),_+=1):n.insertTextToBlock(e,t,(z=A.text)!=null?z:[]):(n.insertBlock(a,D,A),_+=1),d.slice(1,d.length-1).reverse().forEach(q=>{n.insertBlock(a,_,q)}),n.selection.setRange(I)}),n.doc.endBatchUpdate()}function Tg(n,e,t,o,r){const i=Ig(n,o,r),s=ae(e),l=[];return n.undoManager.runInGroup(()=>{Object.entries(i.blocks).forEach(([d,f])=>{d!=="root"&&n.doc.localInsertChildContainer(d,f)}),i.blocks.root.reverse().forEach(d=>{const f=n.insertBlock(s,t,d);l.push(f)})}),l}function M6(n,e,t){const o=Bo(e);Tg(n,e,o,t);for(let r=0;r<o;r++){const i=St(e);n.deleteBlock(i)}}const Ra=S("add-text-attribute");function QI(n,e,t,o){const{start:r,end:i}=t;m(Ra,r.blockId===i.blockId&&r.blockId===ie(e),"invalid range"),m(Ra,o,"invalid attribute name");const s=n.getBlockText(e),l=Wl(r.offset,i.offset-r.offset,s,o,void 0,{ignoreValue:!0});return n.setBlockText(e,l),l}function R6(n,e,t,o,r){const{start:i,end:s}=t;m(Ra,i.blockId===s.blockId&&i.blockId===ie(e),"invalid range"),m(Ra,o,"invalid attribute name");const l=n.getBlockText(e),a=wa(i.offset,s.offset-i.offset,l,o,r);return n.setBlockText(e,a),a}function Ql(n,e,t,o,r){const{start:i,end:s}=t;m(Ra,i.blockId===s.blockId&&i.blockId===ie(e),"invalid range");const l=n.getBlockText(e),a=$4(i.offset,s.offset-i.offset,l,o,r);return n.setBlockText(e,a),a}function O6(n,e,t,o){const r=So(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{r.forEach(i=>{const{block:s,start:l,end:a}=i;if(!ee(n,s))return;if(dt(n,s)){o(n,ie(s),e,t);return}const d=Ht(n,{anchor:l,focus:a});e==="color"||e==="backgroundColor"?Ql(n,s,d,e,t):(Ql(n,s,d,"color",null),Ql(n,s,d,"backgroundColor",null))})})}function _6(n,e,t){const o=So(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{o.forEach(r=>{const{block:i,start:s,end:l}=r;if(!ee(n,i))return;if(dt(n,i)){(e==="clearColor"||e==="clearAll")&&t(n,ie(i),"color",null),(e==="clearBackground"||e==="clearAll")&&t(n,ie(i),"backgroundColor",null);return}const a=Ht(n,{anchor:s,focus:l});(e==="clearColor"||e==="clearAll")&&Ql(n,i,a,"color",null),(e==="clearBackground"||e==="clearAll")&&Ql(n,i,a,"backgroundColor",null)})})}function Dg(n,e){const t=So(n,{simpleBlockOnly:!0}).filter(s=>ee(n,s.block));if(t.length===0)return[null,null];const o=s=>{if(ue(n,s.block)===0)return e(n,ie(s.block));const l=s.start,a=s.end,d=n.getBlockText(s.block);return U4(l.offset,a.offset-l.offset,d)};let[r,i]=o(t[0]);return r===null&&i===null?[r,i]:(t.forEach(s=>{const[l,a]=o(s);l===null||r===null?r=null:r=l===r?r:null,a===null||i===null?i=null:i=a===i?i:null}),[r,i])}const Vn=S("adjust-selection-pos");function P6(n){const e=[];for(;n;){const t=ne(n);if(e.unshift(t),Xe(t))return e;const o=re(t);m(Vn,o,"child container has not parent container"),n=o}m(Vn,!1,"should not come here: getParentContainers")}function F6(n,e){for(;e;){const t=ne(e);if(t===n)return e;const o=re(t);m(Vn,o,"could not find parent block for a child container"),e=o}m(Vn,!1,"no parent block in specified container")}function YI(n,e){const t=P6(n),o=P6(e);m(Vn,t.length>0&&o.length>0,"block has not parent container"),m(Vn,t[0]===o[0],"root container does not equal");let r=t[0];for(let l=1;l<t.length||o.length;l++)if(t[l]!==o[l]){r=t[l-1];break}const i=F6(r,n),s=F6(r,e);return{parentContainer:r,newBlock1:i,newBlock2:s}}function N6(n,e){let t=re(e);for(m(Vn,t,"element is not in a block");t;){const o=ne(t);m(Vn,To(o),"not a child container");const r=re(o);if(m(Vn,r,"child container has not parent block"),r===n)return o;t=r}m(Vn,!1,"failed to find parent container in complex block")}function Ah(n,e,t){const o=n.getBlockById(e.blockId),r=n.getBlockById(t.blockId);if(o===r)return e instanceof $t&&t instanceof $t?{anchor:e,focus:t}:e instanceof Do&&t instanceof Do?Qd(n,o,e,t):null;const i=ne(o),s=ne(r);if(i===s)return e instanceof Do&&(e=se(o,0,"home")),t instanceof Do&&(t=se(r,ue(n,r),"end")),m(Vn,e instanceof $t,"not valid position type"),m(Vn,t instanceof $t,"not valid position type"),{anchor:e,focus:t};if(o.contains(s))return null;if(r.contains(i)){if(e instanceof $t&&t instanceof Do){const B=n.getContainerById(t.childContainerId);if(B===i)return{anchor:t,focus:t};const D=re(i);if(D&&D===re(B)){const I=ht(D,ae(i)),_=ht(D,ae(B));return Qd(n,D,I,_)}}return null}const l=Pd(o,r)>0,{newBlock1:a,newBlock2:d}=YI(o,r);if(a===d){const B=a,D=N6(B,o),I=N6(B,r);return e=ht(a,ae(D)),t=ht(a,ae(I)),Vn.debug(`select in complex block: ${D.id}, ${I.id}`),Qd(n,B,e,t)}let f=l?ue(n,a):0;a===o&&e instanceof $t&&(f=e.offset);let A=l?0:ue(n,d);return d===r&&t instanceof $t&&(A=t.offset),e=se(a,f,l?"end":"home"),t=se(d,A,l?"home":"end"),{anchor:e,focus:t}}const JI=S("move-complex-block-position");function KI(n,e,t){const o=n.getBlockById(e.blockId);m(JI,Le(n,o),"is not a complex block");const r=jn(n,o),i=n.getContainerById(e.childContainerId),s=r.getNextContainer(n,o,i,t,{noWrap:!0});return s?ht(o,ae(s)):null}const Oa=S("move-simple-block-position");function $6(n,e){const t=En(n,e,{visibleOnly:!0});m(Oa,t.length>0,"complex block has not any child container");const o=t[0];return St(o)}function H6(n,e){const t=En(n,e,{visibleOnly:!0});m(Oa,t.length>0,"complex block has not any child container");const o=t[t.length-1];return Gt(o)}function j6(n,e,t){const o=t?$6(n,e):H6(n,e);return Le(n,o)?j6(n,o,t):o}function XI(n,e){const t=n.getBlockById(e.blockId);return Le(n,t)&&e.offset===0?$6(n,t):Ds(t)}function eT(n,e){const t=n.getBlockById(e.blockId);return Le(n,t)&&e.offset===1?H6(n,t):Ts(t)}function Sg(n){return n==="ArrowLeft"||n==="ArrowUp"}function Lg(n,e,t){const o=ne(e);if(Xe(o))return null;const r=re(o);m(Oa,r,"child container has not parent block"),m(Oa,Le(n,r),"is not a complex block");const i=jn(n,r).getNextContainer(n,r,o,t);return i?Sg(t)?Gt(i):St(i):Lg(n,r,t)}function tT(n,e,t){const o=ne(e);if(Xe(o))return null;const r=re(o);if(m(Oa,r,"child container has not parent block"),Sg(t)){const l=lt(r);if(l)return l}else{const l=Ze(r);if(l)return l}const i=Lg(n,r,t);if(i)return i;let s=r;for(;!Xe(ne(s));)s=re(ne(s));return Sg(t)?lt(s):Ze(s)}function nT(n,e,t){return!Le(n,e)||jn(n,e).enableKeyboardSelect?e:j6(n,e,t==="ArrowDown"||t==="ArrowRight")}function oT(n,e,t){const o=n.getBlockById(e.blockId),i=Qe(n,o).moveCaret(n,o,e,t);if(i)return i;let s=t==="ArrowDown"||t==="ArrowRight"?XI(n,e):eT(n,e);if(s||(s=Lg(n,o,t),s||(s=tT(n,o,t))),!s){if(t==="ArrowDown"||t==="ArrowRight"){if(n.readonly||!Xe(ne(o)))return null;const l=n.insertTextBlock("",ae(n.rootContainer),Bo(n.rootContainer));return se(l,0,"home")}return null}if(s=nT(n,s,t),ee(n,s)){const l=n.selection.getSuggestedCaretX();if(t==="ArrowDown")return Sx(n,s,o,e,l);if(t==="ArrowUp")return Dx(n,s,o,e,l)}return t==="ArrowLeft"||t==="ArrowUp"?se(s,ue(n,s),"end"):t==="ArrowRight"||t==="ArrowDown"?se(s,0,"home"):null}function rT(n,e,t){if(e==="ArrowLeft")return t.start;const o=t.end,r=n.getBlockById(o.blockId);if(ee(n,r))return o;const i=Ze(r);if(i)return se(i,0,"home");if(!Xe(ne(r))||n.readonly)return o;const s=n.insertTextBlock("",ae(n.rootContainer),Bo(n.rootContainer));return se(s,0,"home")}function iT(n,e,t){const o=n.selection.range;let r;if(o instanceof Zt)t==="move"&&!o.isCollapsed()&&(e==="ArrowLeft"||e==="ArrowRight")?r=rT(n,e,o):r=oT(n,o.getFocusedPos(),e);else if(r=KI(n,o.focus,e),t==="move"){const i=r!=null?r:o.focus,s=n.getContainerById(i.childContainerId);if(e==="ArrowLeft"||e==="ArrowUp"){const l=Gt(s);r=se(l,0,"home")}else{const l=St(s);r=se(l,ue(n,l),"end")}}return r?t==="move"?{anchor:r,focus:r}:Ah(n,o.anchor,r):null}function Fi(n,e,t){const o=iT(n,e,t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),(e==="ArrowLeft"||e==="ArrowRight")&&n.selection.updateLastCaretRect(),!0}function U6(n){return Fi(n,"ArrowLeft","move"),!0}function z6(n){return Fi(n,"ArrowRight","move"),!0}function V6(n){return Fi(n,"ArrowUp","move"),!0}function W6(n){if(Fi(n,"ArrowDown","move")||n.readonly)return!0;const e=n.getFocusedBlock(),t=ne(e);if(Xe(t)||Gt(t)!==e)return!0;const o=n.rootContainer;return n.insertTextBlock("",ae(o),Bo(o)),!0}function q6(n){return Fi(n,"ArrowDown","select"),!0}function G6(n){return Fi(n,"ArrowLeft","select"),!0}function Z6(n){return Fi(n,"ArrowRight","select"),!0}function Q6(n){return Fi(n,"ArrowUp","select"),!0}const Y6=S("word-offset");function Mg(n,e){const t=n.selection.range.focus;m(Y6,t.isSimple(),"invalid range type");const o=n.getBlockById(t.blockId);if(dt(n,o))return se(o,0,"home");if(t.offset===0||!ee(n,o)){const s=lt(o);if(!s)return null;const l=se(s,ue(n,s),"end");if(e==="select"&&ee(n,s)){const a=ug(n,s,l.offset);return se(s,a,"normal")}return l}const r=ug(n,o,t.offset);return se(o,r,"normal")}function Rg(n,e){const t=n.selection.range.focus;m(Y6,t.isSimple(),"invalid range type");const o=n.getBlockById(t.blockId);if(dt(n,o))return se(o,0,"end");if(t.offset===ue(n,o)||!ee(n,o)){const s=Ze(o);if(!s)return null;const l=se(s,0,"home");if(e==="select"&&ee(n,s)){const a=dg(n,s,l.offset);return se(s,a,"end")}return l}const r=dg(n,o,t.offset);return se(o,r,"normal")}function J6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Mg(n,"move");return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function K6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Rg(n,"move");return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function X6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Mg(n,"select");return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function e9(n){if(!n.selection.range.focus.isSimple())return!1;const t=Rg(n,"select");return t?(n.selection.setSelection(n.selection.range.anchor,t),n.selection.updateLastCaretRect(),!0):!1}S("find-block");function Og(n,e){if(!Le(n,e))return e;const o=jn(n,e).getChildContainers(n,e)[0],i=At(o)[0];return Og(n,i)}function _g(n,e){if(!Le(n,e))return e;const t=jn(n,e).getChildContainers(n,e),o=t[t.length-1],r=At(o),i=r[r.length-1];return _g(n,i)}function t9(n){const e=_g(n,Gt(n.rootContainer)),t=se(e,ue(n,e),"end");return n.selection.setSelection(t),!0}function n9(n){const e=Og(n,n.getFirstBlock()),t=se(e,0,"home");return n.selection.setSelection(t),!0}function o9(n){const e=Og(n,n.getFirstBlock()),t=se(e,0,"home");return n.selection.setSelection(n.selection.getAnchorPos(),t),!0}function Pg(n){const e=_g(n,Gt(n.rootContainer)),t=se(e,ue(n,e),"end");return n.selection.setSelection(n.selection.getAnchorPos(),t),!0}const r9=S("line-offset");function i9(n){const e=n.selection.range.focus;m(r9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId);if(e.offset===0||!ee(n,t))return se(t,0,"home");let r=E4(t,e).start;const{next:i}=qd(t,r);return i&&oo(i)&&pa(i)==="br"&&(r+=1),se(t,r,"home")}function s9(n){const e=n.selection.range.focus;m(r9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId);if(e.offset===ue(n,t)||!ee(n,t))return se(t,ue(n,t),"end");const o=E4(t,e);return se(t,o.end,"end")}function l9(n){if(!n.selection.range.focus.isSimple())return!1;const t=i9(n);return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function c9(n){if(!n.selection.range.focus.isSimple())return!1;const t=s9(n);return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function a9(n){if(!n.selection.range.focus.isSimple())return!1;const t=i9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function u9(n){if(!n.selection.range.focus.isSimple())return!1;const t=s9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}const d9=S("find-block-position");function sT(n,e,t,o){m(d9,Le(n,e),"is not a complex block");const r=jn(n,e).getChildContainers(n,e);m(d9,r.length>0,"complex block has not any child container");const i=Io(n,t,o),s=i.left+i.width/2,l=i.top+i.height/2,a=m4(n,e,s,l);return Fg(n,a,t,o)}function Fg(n,e,t,o){if(Le(n,e))return sT(n,e,t,o);const r=ie(e);let i=Number.MAX_SAFE_INTEGER;const s=Io(n,t,o),l=s.left+s.width/2,a=s.top+s.height/2;let d=se(r,0,"home");const f=ue(n,e);for(let p=0;p<=f;p++){const A=se(r,p,"normal"),v=Io(n,e,A),B=tr(v,l,a);B<i&&(i=B,d=A)}return d}const h9=S("page-offset");function lT(n,e){const t=u6(n)*.9,r=e.getBoundingClientRect().bottom-t;if(r<LI(n))return n.getFirstBlock();const i=lt(e);if(!i)return n.getFirstBlock();let s=i;for(;s;){if(s.getBoundingClientRect().y<r)return s;s=lt(s)}return n.getFirstBlock()}function cT(n,e){const t=u6(n)*.9,o=e.getBoundingClientRect(),r=MI(n),i=o.top+t;if(i>r)return n.getLastBlock();const s=Ze(e);if(!s)return n.getLastBlock();let l=s;for(;l;){if(l.getBoundingClientRect().bottom>i)return l;l=Ze(l)}return n.getLastBlock()}function f9(n){const e=n.selection.range.focus;m(h9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId),o=lT(n,t);let r;return o===n.getFirstBlock()?r=se(o,0,"home"):r=Fg(n,o,t,e),r}function m9(n){const e=n.selection.range.focus;m(h9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId),o=cT(n,t);let r;return o===n.getLastBlock()?r=se(o,ue(n,o),"end"):r=Fg(n,o,t,e),r}function g9(n){if(!n.selection.range.focus.isSimple())return!1;const t=f9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function p9(n){if(!n.selection.range.focus.isSimple())return!1;const t=m9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function C9(n){if(!n.selection.range.focus.isSimple())return!1;const t=f9(n);if(!t)return!1;const o=Ah(n,n.selection.getAnchorPos(),t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),n.selection.updateLastCaretRect(),!0}function A9(n){if(!n.selection.range.focus.isSimple())return!1;const t=m9(n);if(!t)return!1;const o=Ah(n,n.selection.getAnchorPos(),t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),n.selection.updateLastCaretRect(),!0}const _a=S("select-all");function b9(n,e){const t=St(n),o=Gt(n);return e.start.offset===0&&e.start.blockId===ie(t)&&e.end.offset===ue(e.getEditor(),o)&&e.end.blockId===ie(o)}function aT(n,e){const t=e.getEditor(),o=jn(t,n).getChildContainers(t,n),r=o[0],i=o[o.length-1],s=ie(n);return e.start.blockId===s&&e.start.childContainerId===ae(r)&&e.end.blockId===s&&e.end.childContainerId===ae(i)}function uT(n,e){m(_a,e,"no parent block"),m(_a,Le(n,e),"not a complex block");const t=jn(n,e).getChildContainers(n,e),o=t[0],r=t[t.length-1];n.selection.setRange(Ht(n,{anchor:ht(e,ae(o)),focus:ht(e,ae(r))}))}function v9(n,e){const t=ne(e);Ng(n,t)}function y9(n){const e=n.getFocusedBlock(),t=n.selection.range;if(t.start.isSimple()){if(t.start.blockId===t.end.blockId&&ee(n,e)){const r=t.start,i=t.end,s=ue(n,e);if(r.offset>0||i.offset<s)return n.selection.selectBlock(e,0,s),!1}return W(n.rootContainer,"select-all"),v9(n,St(n.rootContainer)),!1}return m(_a,!t.isSimple(),"invalid range type"),aT(e,t)?(v9(n,e),!1):(m(_a,e,"no parent block"),m(_a,Le(n,e),"not a complex block"),uT(n,e),!0)}function Ng(n,e){const t=At(e),o=t[0],r=t[t.length-1],i=se(o,0,"home"),s=se(r,ue(n,r),"end");n.selection.setSelection(i,s,{noScroll:!0})}function k9(n){Pg(n),n.focus()}const $g=S("selected-block-to-doc");function w9(n,e,t){!e.children||e.children.forEach(o=>{const r=n.getChildContainerData(o);r.forEach(i=>{w9(n,i,t)}),t.blocks[o]=fe.default(r)})}function bh(n,e){const t=Qe(n,e.block);if(t.selectionToDoc)return t.selectionToDoc(n,e);const o=fe.default(_i(n,e.block));if(ee(n,e.block)){const i=e.start,s=e.end;if(m($g,o.text,"no block text"),i.offset===s.offset)return{blocks:{root:[{...o,text:[]}]},meta:{},comments:{}};const{middle:l}=jt(o.text,i.offset,s.offset-i.offset);return{blocks:{root:[{...o,text:l}]},meta:{},comments:{}}}if(Lt(e.block))return{blocks:{root:[o]},meta:{},comments:{}};m($g,Le(n,e.block),"not complex block"),m($g,o.children,"no children");const r={blocks:{root:[o]},meta:{},comments:{}};return w9(n,o,r),r}function Hg(n,e){const t=se(e,0,"normal"),o=se(e,ue(n,e),"end");return bh(n,{block:e,start:t,end:o})}const dT=S("block-to-doc");function hT(n,e){m(dT,e.length>0,"invalid params, no blocks");const t=e.map(o=>Hg(n,o));return Fs(t)}function vh(n){const t=n.selection.range.getSelectedBlocks().map(o=>bh(n,o));return Fs(t)}function B9(n,e){const t=n.getContainerById(e),i=At(t).map(s=>({start:se(s,0,"home"),end:se(s,ue(n,s),"end"),block:s})).map(s=>bh(n,s));return Fs(i)}const yh=S("editor-selection");class fT{constructor(e){g(this,"editor");g(this,"caret");g(this,"_range");g(this,"lastCaretRect");g(this,"handleBlockDelete",(e,t,o,r)=>{if(o||r.child)return;const i=this.range;if(f6(t,i)){yh.debug("adjust selection because remote deleted current block");const s=m6(e,t);this.setRange(s,{noScroll:!0})}});this.editor=e;const t=e.getFirstBlock(),o=ie(t);this.caret=new TI(e);const r=se(o,0,"normal");this._range=Ht(e,{anchor:r,focus:r}),this.lastCaretRect=null,this.editor.addListener("blockDeleted",this.handleBlockDelete),setTimeout(()=>{this.updateFocusedBlock(null)})}destroy(){this.caret.destroy()}get range(){return this._range}get focusedBlock(){return this.getFocusedBlock()}get startBlock(){return this.getStartBlock()}get endBlock(){return this.getEndBlock()}getFocusedBlock(){const e=this.range.focus;return this.editor.getBlockById(e.blockId)}getStartBlock(){const e=this.range.start;return this.editor.getBlockById(e.blockId)}getEndBlock(){const e=this.range.end;return this.editor.getBlockById(e.blockId)}selectBlock(e,t,o){const r=se(e,t,"normal");let i;o&&(i=se(e,o,"normal")),this.setSelection(r,i)}setSelection(e,t,o){if(t||(t=e),this.verifyPos(e),this.verifyPos(t),!this.selectionChanging(e,t))return this.range;const r=Ht(this.editor,{anchor:e,focus:t});if(this.range.isEqual(r))return this.range;const i=this._range;return this._range=r,this.selectionChanged(),this.updateFocusedBlock(i),xe(this.editor.rootContainer,"select-all")&&(!r.isSimple()||!PI(this.editor,r))&&te(this.editor.rootContainer,"select-all"),o!=null&&o.noScroll||this.scrollIntoView(),this.range}setRange(e,t){return this.setSelection(e.anchor,e.focus,t)}updateSelection(){this.caret.update(),DI(this.editor)}getFocusedPos(){return this.range.focus}getAnchorPos(){return this.range.anchor}selectionChanging(e,t){return!0}selectionChanged(){this.updateSelection(),this.editor.emit("selectionChanged",this.editor)}updateLastCaretRect(){const e=this.range.focus;if(!Nr(e))return;const t=this.editor.getBlockById(e.blockId);this.lastCaretRect=Io(this.editor,t,e)}getSuggestedCaretX(){var e;return(e=this.lastCaretRect)==null?void 0:e.x}scrollIntoView(){_I(this.editor)}verifyPos(e){const t=this.editor.getBlockById(e.blockId);if(e.isSimple())e.offset>=0&&e.offset<=ue(this.editor,t)||m(yh,!1,"invalid block position, out of range");else{const o=e.childContainerId;!!this.editor.getContainerById(o)||m(yh,!1,"invalid complex block position, no container found")}}updateFocusedBlock(e){if(e&&this.range.start.blockId===e.start.blockId)return;let t;e&&e.start.blockId===e.end.blockId&&(t=this.editor.findBlockById(e.start.blockId));let o;(this.range.isCollapsed()||!this.range.isSimple()||this.range.start.blockId===this.range.end.blockId)&&(o=this.editor.getBlockById(this.range.start.blockId));let r=!1;t&&xe(t,"focused")&&(te(t,"focused"),r=!0),this.removeAllBlockFocusedClass(),o&&this.setBlockFocused(o)&&(r=!0),r&&this.editor.emit("focusBlockChanged",this.editor,o!=null?o:null,t!=null?t:null)}verify(){this.verifyPos(this._range.start),this.verifyPos(this._range.end)}to(e){const t=vh(this.editor);return e==="text"?Ia(this.editor,t):e==="markdown"?Ta(this.editor,t):p6(this.editor,t)}removeAllBlockFocusedClass(){this.editor.rootContainer.querySelectorAll('div[data-type="editor-block"].focused, div[data-type="editor-block"].child-focused').forEach(e=>{te(e,"focused"),te(e,"child-focused")})}setBlockFocused(e){if(xe(e,"focused"))return!1;W(e,"focused");let t=ne(e);for(;To(t);){const o=re(t);m(yh,o,"parent block not found"),W(o,"child-focused"),t=ne(o)}return!0}}function mT(n){const e=n.selection.range.focus;if(!e.isSimple())return;const t=n.findBlockById(e.blockId);!t||n.selection.selectBlock(t,0,ue(n,t))}function gT(n){const e=n.selection.range.focus;if(!e.isSimple())return;const t=n.findBlockById(e.blockId);if(!t||!ee(n,t))return;let o=Mg(n,"select"),r=Rg(n,"select");if(!o||!r)return;const i=e.blockId;o.blockId!==i&&(o=se(t,0,"home")),r.blockId!==i&&(r=se(t,ue(n,t),"end")),n.selection.setSelection(o,r)}class pT{constructor(e){g(this,"editor");g(this,"startPos",null);g(this,"lastCaretRect");g(this,"mouseDownEvent",null);g(this,"handleMouseDown",e=>{this.mouseDownEvent=e;const t=C4(this.editor,e.x,e.y);if(t){if(t instanceof or)return;const o=this.editor.selection.range;if(e.shiftKey&&o.isSimple()){const r=o.anchor;this.editor.selection.setSelection(r,t.focus),this.startPos=t.start}else this.editor.selection.setSelection(t.anchor,t.focus),this.startPos=t.start;this.editor.selection.updateLastCaretRect()}});g(this,"handleMouseMove",e=>{if(!this.startPos||!this.mouseDownEvent||Math.abs(this.mouseDownEvent.x-e.x)<3&&Math.abs(this.mouseDownEvent.y-e.y)<3)return;const t=Yd(this.editor,e.x,e.y);if(!t)return;const o=Ah(this.editor,this.startPos,t.end);if(!o)return;const{anchor:r,focus:i}=o;this.editor.selection.setSelection(r,i)});g(this,"handleMouseUp",e=>{this.startPos=null});this.editor=e,this.startPos=null,this.lastCaretRect=new DOMRect}isSelecting(){return this.startPos!==null}stopSelection(){this.startPos=null}handleDblClick(e){gT(this.editor)}handleTripleClick(e){mT(this.editor)}}function CT(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.undo(),!0)}function AT(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.redo(),!0)}const E9=S("delete-text");function x9(n,e,t,o){const r=o!=null?o:n.selection.range.start;r instanceof $t||m(E9,!1,`invalid insert pos type: ${typeof r}`);const{blockId:i}=r,s=n.getBlockById(i);m(E9,ee(n,s),"block is not a text kind block");let{offset:l}=r;if(e==="backward"){if(l-t<0)return 0;if(!sn(s,l-t)){const a=Ri(s,l);t=l-a}}else if(e==="forward"&&l+t>ue(n,s))return 0;return e==="backward"&&(l-=t),n.deleteTextFromBlock(s,l,t)}function I9(n,e){if(n.getBlockData(e).quoted){const t={quoted:null};return n.updateBlockData(e,t),!0}return!1}const bT=S("handle-backspace");function jg(n,e){if(!dt(n,e))return;const t=ne(e);Bo(t)!==1&&n.deleteBlock(e)}function vT(n,e){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const t=n.selection.range.start,o=n.getBlockById(t.blockId);if(ee(n,o))if(t.offset===0){if(I9(n,o))return;const r=lt(o);if(r){if(!n.isBlockWritable(r))return;if(ee(n,r))n.mergeTextBlock(r,o,{focus:!0});else if(Le(n,r)){jg(n,o);const i=zl(n,r);i?n.selection.selectBlock(i,ue(n,i)):n.selection.selectBlock(r,0,ue(n,r))}else jg(n,o),m(bT,Lt(r),"prev block is not embed block"),n.selection.selectBlock(r,1)}else{const i=ne(o);if(To(i)){const s=d4(n,i);if(s){if(!n.isBlockWritable(s))return;jg(n,o),n.selection.selectBlock(s,ue(n,s))}}}}else x9(n,"backward",1,null),n.selection.updateLastCaretRect();else{const r=be(o),i=ne(o);n.insertTextBlock("",ae(i),r),n.deleteBlock(o)}}function yT(n,e){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const t=n.selection.range.start,o=n.getBlockById(t.blockId);if(ee(n,o))if(t.offset===ue(n,o)){const r=Ze(o);if(r){if(!n.isBlockWritable(r))return;ee(n,r)?n.mergeTextBlock(o,r,{focus:!0}):dt(n,o)?n.deleteBlock(o,bt(n,r,0)):n.deleteBlock(r)}}else x9(n,"forward",1,null);else{const r=be(o),i=ne(o);n.insertTextBlock("",ae(i),r),n.deleteBlock(o)}}function kT(n){const{range:e}=n.selection,{start:t,end:o}=e,r=n.getBlockById(t.blockId),i=n.getBlockById(o.blockId);if(r!==i||!Le(n,r))return!1;if(Nr(t))return!0;const s=Ms(n,r,t,o),l=En(n,r);return s.length===l.length}function wT(n,e){if(kT(n)){const o=n.getFocusedBlock(),r=be(o),i=ae(ne(o));n.insertTextBlock("",i,r+1);return}n.selection.range.isCollapsed()||n.clearSelectedContents();const t=n.getFocusedBlock();if(ee(n,t)){if(dt(n,t)&&I9(n,t))return;const o=n.selection.range.start,r=n.breakTextBlock(t,o.offset,{copyBlockAttributes:!0});o.offset!==0?n.selection.selectBlock(r,0):n.selection.scrollIntoView()}else{const o=n.insertTextBlock();n.selection.selectBlock(o,0)}}function BT(n,e){const t=n.selection.range.getSelectedBlocks()[0],{block:o}=t;if(!ee(n,o))return!1;const r=t.end;return n.insertBoxToBlock(o,r.offset,{type:"br",id:K(),box:!0,created:Date.now()}),!0}const ET=S("input-handler-actions");function xT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(wT(n),!0))}function IT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(yT(n),!0))}function TT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(vT(n),!0))}function DT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(BT(n),!0))}function ST(n){return n.readonly||!n.isWritable()||!window.isSecureContext?!1:(navigator.clipboard.readText().then(e=>{n.input.handlePasteText(e)}).catch(e=>{ET.error(e)}),!0)}const kh={ArrowDown:W6,ArrowUp:V6,ArrowLeft:U6,ArrowRight:z6,"Shift+ArrowDown":q6,"Shift+ArrowUp":Q6,"Shift+ArrowLeft":G6,"Shift+ArrowRight":Z6,"CtrlOrCmd+ArrowLeft":J6,"CtrlOrCmd+ArrowRight":K6,"CtrlOrCmd+Shift+ArrowLeft":X6,"CtrlOrCmd+Shift+ArrowRight":e9,"CtrlOrCmd+ArrowUp":n9,"CtrlOrCmd+ArrowDown":t9,"CtrlOrCmd+Shift+ArrowUp":o9,"CtrlOrCmd+Shift+ArrowDown":Pg,"CtrlOrCmd+A":y9,Home:a9,End:u9,"Shift+Home":l9,"Shift+End":c9,PageUp:g9,PageDown:p9,"Shift+PageUp":C9,"Shift+PageDown":A9,"CtrlOrCmd+Z":CT,"CtrlOrCmd+Shift+Z":AT,Enter:xT,Delete:IT,Backspace:TT,"Shift+Enter":DT,"CtrlOrCmd+Shift+V":ST};function T9(n,e){return n.shortcuts.handleKeyboardEvents(n,e)!==void 0}function D9(n,e,t){if(e.type==="embed"){const i=e.embedData,s=i.src;if(s&&typeof s=="string"){const l=t.get(s);l&&(i.src=l)}return}const o=e.text;o&&o.forEach(i=>{if(i.attributes&&i.attributes.src&&typeof i.attributes.src=="string"){const s=t.get(i.attributes.src);s&&(i.attributes.src=s)}});const r=e.children;r&&r.forEach(i=>{n.blocks[i].forEach(l=>{D9(n,l,t)})})}function S9(n,e,t){if(t.size===0)return;e.blocks.root.forEach(r=>{const i=n.editorBlocks.getBlockClass(r.type);i.replaceResources?i.replaceResources(r,t):D9(e,r,t)})}async function LT(n,e){const t=e.filter(i=>i.indexOf(":")===-1),o=await n.doc.addResources(t),r=new Map;if(t.length!==o.length)return r;for(let i=0;i<t.length;i++)r.set(t[i],o[i]);return r}function MT(n,e){var i,s;const o=e.meta.serverId;if(!o||typeof o!="string")return!1;const r=(s=(i=n.doc).getServerMeta)==null?void 0:s.call(i);return!(!r||r.serverId!==o)}async function RT(n,e){const o=e.meta.resources;if(!o||Object.keys(o).length===0)return;let r=new Map;if(MT(n,e)){const s=Array.from(Object.keys(o));r=await LT(n,s),S9(n,e,r)}const i=new Map;Object.entries(o).forEach(([s,l])=>{r.get(s)===void 0&&s!==l&&i.set(s,l)}),i.size!==0&&S9(n,e,i)}async function OT(n,e,t){await RT(n,e),n.undoManager.runInGroup(()=>{const{start:o,end:r}=n.selection.range,i=n.getBlockById(o.blockId);if(o.blockId===r.blockId&&Lt(i)){const s=ne(i),l=n.getBlockIndex(i),[a]=n.insertDocAt(s,l+1,e,t);a&&n.selection.selectBlock(a,ue(n,a))}else{n.clearSelectedContents();const{block:s,offset:l}=ql(n);n.insertDoc(s,l,e,t)}})}const _T=["text/x-ones-editor-doc","image/*","text/office-html","text/html","text/plain","text/markdown","*"];function PT(n){let e;for(const t of _T)if(e=n[t],e)break;return e||null}function L9(n,e,t){if(e.type==="embed"){const s=e.embedData.src;if(s&&typeof s=="string")for(const l of s.split("|"))t.add(l);return}const o=e.text;o&&o.forEach(i=>{i.attributes&&i.attributes.src&&typeof i.attributes.src=="string"&&t.add(i.attributes.src)});const r=e.children;r&&r.forEach(i=>{n.blocks[i].forEach(l=>{L9(n,l,t)})})}function FT(n,e){const t=new Set;return e.blocks.root.forEach(r=>{const i=n.editorBlocks.getBlockClass(r.type);i.getResources?i.getResources(r).forEach(s=>{t.add(s)}):L9(e,r,t)}),Array.from(t)}function wh(n,e){return`<!doctype html><html><head><meta charset="utf8" />${`<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${ws(JSON.stringify(e))}::ones-editor-doc" />`}</head><body>${n}</body></html>`}function Bh(n,e){var i,s,l;const t=(l=(s=(i=n.doc).getServerMeta)==null?void 0:s.call(i))!=null?l:{},o=FT(n,e),r={};o.forEach(a=>{const d=n.doc.buildResourceUrl(a,{withToken:!0});r[a]=d}),e.meta={...t,resources:r}}function NT(n,e,t){if(e.preventDefault(),e.stopPropagation(),!e.clipboardData)return;let o=vh(n);const r=t==null?void 0:t(n,e,o);if(r===!0)return;typeof r=="object"&&r!==null&&(o=r),Bh(n,o);const i=dh(n,o),s=Ta(n,o),l=wh(i,o);e.clipboardData.setData("text/html",l),e.clipboardData.setData("text/plain",s),e.clipboardData.setData("text/x-ones-editor-doc",JSON.stringify(o))}async function Eh(n,e){const t=Hg(n,e);Bh(n,t);const o=dh(n,t),r=Ta(n,t),i=wh(o,t);return bm([{type:"text/plain",data:new Blob([r],{type:"text/plain"})},{type:"text/html",data:new Blob([i],{type:"text/html"})}])}class $T{constructor(e){g(this,"editor");g(this,"handlers",[]);g(this,"onPasteText",async e=>{const t=new DataTransfer;t.setData("text/plain",e);const o=await this.editor.dataConverter.fromData(this.editor,t);o&&this.pasteDocs(o,null)});this.editor=e}onInsertText(e,t){if(!ee(this.editor,this.editor.getFocusedBlock()))return;const{containerId:o,blockIndex:r,offset:i}=ql(this.editor);this.handleBeforeInsertText(o,r,i,t)||(this.defaultInsertText(this.editor,o,r,i,t),this.handleAfterInsertText(o,r,i,t),this.editor.selection.updateLastCaretRect())}onKeyDown(e){if(this.handleBeforeKeyDown(e))return!0;const t=this.defaultHandleKeydown(this.editor,e);return this.handleAfterKeyDown(e)?!0:t}onChanged(e){for(let t=0;t<this.handlers.length;t++){const o=this.handlers[t];o.handleChanged&&o.handleChanged(this.editor,e)}}onRemoteChanged(e){for(let t=0;t<this.handlers.length;t++){const o=this.handlers[t];o.handleRemoteChanged&&o.handleRemoteChanged(this.editor,e)}}onCompositionStart(e){this.editor.updateCompositionText("",!1);const{containerId:t,blockIndex:o,offset:r}=ql(this.editor);for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];s.handleCompositionStart&&s.handleCompositionStart(this.editor,t,o,r)}}onUpdateCompositionText(e,t,o){this.editor.updateCompositionText(t,o),this.editor.selection.caret.update();const{containerId:r,blockIndex:i,offset:s}=ql(this.editor);for(let l=0;l<this.handlers.length;l++){const a=this.handlers[l];a.handleUpdateCompositionText&&a.handleUpdateCompositionText(this.editor,r,i,s,o)}this.editor.selection.updateLastCaretRect()}onCopy(e){NT(this.editor,e,(t,o,r)=>{for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleBeforeCopy){const l=s.handleBeforeCopy(this.editor,o,r);if(l===!0)return!0;if(typeof l=="object"&&l!=null)return l}}})}onCut(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeCut&&r.handleBeforeCut(this.editor,e)===!0)return}if(this.onCopy(e),this.editor.selection.range.isCollapsed()){const o=this.editor.selection.focusedBlock;Lt(o)&&this.editor.deleteBlock(o)}else Bg(this.editor)}onPaste(e){if(e.preventDefault(),e.stopPropagation(),!e.clipboardData)return;this.editor.dataConverter.fromData(this.editor,e.clipboardData).then(async o=>{o&&this.pasteDocs(o,e)})}onFocus(){W(this.editor.rootElement,"active")}onBlur(){te(this.editor.rootElement,"active")}addHandler(e){this.handlers.push(e)}removeHandler(e){const t=this.handlers.indexOf(e);t!==-1&&this.handlers.splice(t)}handleBeforeInsertText(e,t,o,r){for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleBeforeInsertText&&s.handleBeforeInsertText(this.editor,e,t,o,r))return!0}return!1}handleAfterInsertText(e,t,o,r){for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleAfterInsertText&&s.handleAfterInsertText(this.editor,e,t,o,r))return!0}return!1}handleBeforeKeyDown(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeKeyDown&&r.handleBeforeKeyDown(this.editor,e))return!0}const t=this.defaultHandleKeydown(this.editor,e);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterKeyDown&&r.handleAfterKeyDown(this.editor,e))return!0}return t}handleAfterKeyDown(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeKeyDown&&r.handleBeforeKeyDown(this.editor,e))return!0}const t=this.defaultHandleKeydown(this.editor,e);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterKeyDown&&r.handleAfterKeyDown(this.editor,e))return!0}return t}defaultInsertText(e,t,o,r,i){bg(this.editor,i)}defaultHandleKeydown(e,t){return T9(this.editor,t)?(t.preventDefault(),t.stopPropagation(),!0):!1}async pasteDoc(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforePasteDoc&&await r.handleBeforePasteDoc(this.editor,e))return}const t={blockIdMap:new Map,containerIdMap:new Map};await OT(this.editor,e,t);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterPasteDoc&&await r.handleAfterPasteDoc(this.editor,e,t))return}}async pasteDocs(e,t){for(let r=0;r<this.handlers.length;r++){const i=this.handlers[r];if(i.handleBeforePaste&&await i.handleBeforePaste(this.editor,t,e))return}const o=PT(e);if(!!o){await this.pasteDoc(o);for(let r=0;r<this.handlers.length;r++){const i=this.handlers[r];if(i.handleAfterPaste&&await i.handleAfterPaste(this.editor,t,e))return}}}destroy(){this.handlers.forEach(e=>{var t;(t=e.destroy)==null||t.call(e,this.editor)}),this.handlers=[]}}function HT(n,e,t){const o=Rr(e,t);return o.remove(),o}S("copy-dom-attributes");const M9=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"];function jT(n,e){for(let l=0;l<M9.length;l++){const a=M9[l];e[a]=n[a]}const t=n.attributes,o=e.attributes,r=[],i=[];for(let l=0;l<t.length;l++){const a=t[l],d=o.getNamedItem(a.name);d?d.value!==a.value&&(d.value=a.value,i.push(a)):r.push(a)}const s=[];for(let l=0;l<o.length;l++){const a=o[l];t.getNamedItem(a.name)||s.push(a)}r.forEach(l=>{e.setAttribute(l.name,l.value)}),i.forEach(l=>{e.setAttribute(l.name,l.value)}),s.forEach(l=>{e.removeAttribute(l.name)})}function R9(n){const e=Array.from(n.childNodes).filter(t=>!xC(t));return e.forEach(t=>{t.remove()}),e}function O9(n,e,t){var d;const o=n.getContainerById(e),r=Rr(o,t),i=Di(r),s=n.doc.getBlockData(e,t),l=Qe(n,r);if((d=l==null?void 0:l.handleUpdateBlock)==null?void 0:d.call(l,n,r,s))n.editorBlockRenders.updateBlock(n,i,r,s);else{const f=n.editorBlocks.createBlock(i,o,s),p=R9(f);R9(r),p.forEach(v=>{r.appendChild(v)});const A=Vd(f);if(A){const v=Vd(r);v&&v.remove(),r.appendChild(A)}jT(f,r)}VC(n,r,s),n.blockHooks.forEach(f=>{var p;(p=f.update)==null||p.call(f,n,i,o,r,s)}),setTimeout(()=>{n.selection.updateSelection(null)})}const UT=S("transform-selection");function _9(n,e,t,o){const{range:r}=n.selection,{anchor:i,focus:s}=r;if(i.blockId!==e&&s.blockId!==e)return r;m(UT,i.isSimple()&&s.isSimple(),"invalid text pos type");let l=i;if(i.blockId===e){const d=ln.transformCursor(i.offset,t,o);l=se(e,d,"normal")}let a=s;if(s.blockId===e){const d=ln.transformCursor(s.offset,t,o);a=se(e,d,"normal")}return Ht(n,{anchor:l,focus:a})}const zT=S("handle-block-text-changed");function VT(n,e,t,o,r){const i=n.getContainerById(e),s=Rr(i,t),l=n.doc.getBlockData(e,t);if(m(zT,l.text,"no block text"),NC(n,s).setBlockText(n,s,l.text),!r){const a=_9(n,l.id,o,r);n.selection.setRange(a,{noScroll:!0})}}function WT(n,e){const t=fe.default(n);return e.delete.forEach(r=>{delete t[r]}),{...t,...e.insert}}function P9(n,e,t,o){const r=Qe(n,e);r.handleDeleteBlock&&r.handleDeleteBlock(n,e,t,o),n.emit("blockDeleted",n,e,t,o)}function qT(n,e,t,o){const r=n.getBlockByIndex(e,t);r.querySelectorAll('[data-type="editor-block"]').forEach(i=>{P9(n,i,o,{child:!0})}),P9(n,r,o,{child:!1})}const Mo=S("editor-doc");class GT extends ua{constructor(t,o,r){super();g(this,"localEvents",[]);this.editor=t,this.externalDoc=o,this.externalDoc.registerCallback(this),this.registerLocalEvents(r)}beginBatchUpdate(){return this.externalDoc.beginBatchUpdate()}endBatchUpdate(){return this.externalDoc.endBatchUpdate()}registerLocalEvents(t){this.localEvents.push(t)}toJSON(){return this.externalDoc.toJSON()}getVersionHelper(){var o,r;return(r=(o=this.externalDoc).getVersionHelper)==null?void 0:r.call(o)}getContainerBlocks(t){return this.externalDoc.getContainerBlocks(t)}getBlockData(t,o){return this.externalDoc.getBlockData(t,o)}verifyBlockWritable(t,o){const r=this.editor.getBlockByIndex(t,o);m(Mo,this.editor.isBlockWritable(r),`block is not writable, ${t}, ${o}`)}localUpdateBlockText(t,o,r,i){m(Mo,!this.editor.readonly,"editor is readonly"),this.verifyBlockWritable(t,o);const s=this.getBlockData(t,o),l=s.text;m(Mo,l,`no text, ${t}, ${o}`);const a=_9(this.editor,s.id,r,!0),d=ln.apply(l,r);this.localEvents.forEach(p=>p.onBeforeUpdateBlockText(t,s.id,l,d,a.toDocRange()));const f=this.externalDoc.localUpdateBlockText(t,o,r);return this.editor.selection.setRange(a,i),f}localUpdateBlockData(t,o,r,i){m(Mo,!this.editor.readonly,"editor is readonly");const s=this.editor.getBlockByIndex(t,o);if(!this.editor.isBlockWritable(s)){const f=Array.from(r.delete).filter(A=>A!=="comments"),p=Object.keys(r.insert).filter(A=>A!=="comments");(f.length>0||p.length>0)&&m(Mo,!1,`block is not writable, comment supported only, ${JSON.stringify(r)}}`)}const l=fe.default(this.getBlockData(t,o)),a=fe.default(WT(l,r));this.localEvents.forEach(f=>f.onBeforeUpdateBlockData(t,l.id,l,a,i));const d=this.externalDoc.localUpdateBlockData(t,o,r,i);return this.editor.selection.setRange(Si(this.editor,i)),d}localInsertBlock(t,o,r,i,s){m(Mo,!this.editor.readonly,"editor is readonly"),this.localEvents.forEach(a=>a.onBeforeInsertBlock(t,o,r,i));const l=this.externalDoc.localInsertBlock(t,o,r,i);return this.editor.selection.setRange(Si(this.editor,i),s),l}localDeleteBlock(t,o,r){m(Mo,!this.editor.readonly,"editor is readonly"),this.verifyBlockWritable(t,o);const i=fe.default(this.getBlockData(t,o));this.localEvents.forEach(l=>l.onBeforeDeleteBlock(t,o,i,r));const s=this.externalDoc.localDeleteBlock(t,o,r);return this.editor.selection.setRange(Si(this.editor,r)),s}localDeleteChildContainers(t){return m(Mo,!this.editor.readonly,"editor is readonly"),t.forEach(o=>{const r=fe.default(this.getContainerBlocks(o));this.localEvents.forEach(i=>i.onBeforeDeleteChildContainer(o,r))}),this.externalDoc.localDeleteChildContainers(t)}localInsertChildContainer(t,o){return m(Mo,!this.editor.readonly,"editor is readonly"),this.localEvents.forEach(r=>r.onBeforeInsertChildContainer(t,fe.default(o))),this.externalDoc.localInsertChildContainer(t,o)}onRequestReload(t){Mo.debug(`reload doc: ${t}`),this.editor.reload(),this.callbacks.forEach(r=>{var i;return(i=r.onRequestReload)==null?void 0:i.call(r,t)});const o=!1;this.editor.emit("docChanged",this.editor,o)}onUpdateBlockText(t,o,r,i){this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockText)==null?void 0:l.call(s,t,o,r,i)}),VT(this.editor,t,o,r,i),this.editor.emit("docChanged",this.editor,i)}onUpdateBlockData(t,o,r,i){this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,t,o,r,i)}),O9(this.editor,t,o),this.editor.emit("docChanged",this.editor,i)}onInsertBlock(t,o,r,i){this.callbacks.forEach(l=>{var a;return(a=l.onInsertBlock)==null?void 0:a.call(l,t,o,r,i)});const s=this.editor.getContainerById(t);_E(this.editor,s,o,r),this.editor.emit("docChanged",this.editor,i)}onDeleteBlock(t,o,r){qT(this.editor,t,o,r),this.callbacks.forEach(s=>{var l;return(l=s.onDeleteBlock)==null?void 0:l.call(s,t,o,r)});const i=this.editor.getContainerById(t);HT(this.editor,i,o),this.editor.emit("docChanged",this.editor,r)}onInsertChildContainer(t,o,r){this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,t,o,r)})}onDeleteChildContainer(t,o){this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,t,o)})}onCustomMessage(t){this.callbacks.forEach(o=>{var r;return(r=o.onCustomMessage)==null?void 0:r.call(o,t)})}onStatusChanged(t){this.callbacks.forEach(o=>{var r;return(r=o.onStatusChanged)==null?void 0:r.call(o,t)})}onError(t){this.callbacks.forEach(o=>{var r;return(r=o.onError)==null?void 0:r.call(o,t)})}uploadResource(t,o){return this.externalDoc.uploadResource(t,o)}addResources(t){return this.externalDoc.addResources(t)}buildResourceUrl(t,o){return this.externalDoc.buildResourceUrl(t,o)}request(t,o){return this.externalDoc.request(t,o)}broadcastMessage(t){return this.externalDoc.broadcastMessage(t)}getUser(){return this.externalDoc.getUser()}getRemoteUsers(){return this.externalDoc.getRemoteUsers()}destroy(){this.externalDoc.destroy(),this.clearCallbacks()}getServerMeta(){var t,o,r;return(r=(o=(t=this.externalDoc).getServerMeta)==null?void 0:o.call(t))!=null?r:{}}reset(t){Mo.log("reset doc"),this.externalDoc=t,this.externalDoc.registerCallback(this),this.editor.reload()}}function F9(n,e){if(n.length===0){n.push(e);return}const t=n[n.length-1];if(!t.combinable(e)){n.push(e);return}t.combine(e)}const Ug=S("undo-action");class Yl{constructor(e,t,o){g(this,"beforeRange");g(this,"afterRange");this.containerId=t,this.beforeRange=e.selection.range.clone().toDocRange(),this.afterRange=o}undo(e){return!1}redo(e){return!1}combinable(e){return m(Ug,e,"no other action"),!1}combine(e){m(Ug,!1,"no other")}setAfterRange(e){this.afterRange&&Ug.warn("after range has already set"),this.afterRange=e}}const ZT=S("block-action");class N9 extends Yl{constructor(t,o,r,i,s){super(t,o,s);g(this,"blockData");g(this,"blockIndex");this.blockData=fe.default(i),this.blockIndex=r}deleteBlock(t,o){if(!t.getContainerById(this.containerId))return!1;const i=t.getBlockById(this.blockData.id);return i?(m(ZT,this.blockIndex===be(i),"invalid block index"),mh(t,i,Si(t,o)),!0):!1}insertBlock(t,o){return Gl(t,this.containerId,this.blockIndex,fe.default(this.blockData),o),!0}}class QT extends N9{undo(e){return this.deleteBlock(e,this.beforeRange)}redo(e){return this.insertBlock(e,this.afterRange)}}class YT extends N9{undo(e){return this.insertBlock(e,this.beforeRange)}redo(e){return this.deleteBlock(e,this.afterRange)}}class JT extends Yl{constructor(t){super(t,ae(t.rootContainer),t.selection.range.toDocRange());g(this,"actions",[])}addAction(t){F9(this.actions,t),this.afterRange=t.afterRange}undo(t){let o=!1;return this.actions.concat().reverse().forEach(r=>{r.undo(t)&&(o=!0)}),o}redo(t){let o=!1;return this.actions.forEach(r=>{r.redo(t)&&(o=!0)}),o}setAfterRange(t){this.afterRange=t;const o=this.actions[this.actions.length-1];!o||o instanceof Yl&&(o.afterRange||o.setAfterRange(t))}}const Ns=S("update-block-data-action");class xh extends Yl{constructor(t,o,r,i,s,l){super(t,o,l);g(this,"beforeBlockData");g(this,"afterBlockData");g(this,"blockId");this.blockId=r,m(Ns,this.blockId===i.id,"invalid block id"),m(Ns,this.blockId===s.id,"invalid block id"),this.beforeBlockData=fe.default(i),this.afterBlockData=fe.default(s),m(Ns,this.beforeBlockData.type===this.afterBlockData.type,"invalid block type")}undo(t){m(Ns,t,"no editor");const o=t.getBlockById(this.blockId);if(!o)return!1;const r=t.getContainerById(this.containerId);return m(Ns,r,"no container"),Ch(t,o,xh.toAttributes(this.beforeBlockData),this.beforeRange),!0}redo(t){m(Ns,t,"no editor");const o=t.getBlockById(this.blockId);if(!o)return!1;const r=t.getContainerById(this.containerId);return m(Ns,r,"no container"),Ch(t,o,xh.toAttributes(this.afterBlockData),this.afterRange),!0}static toAttributes(t){const o=fe.default(t);return delete o.id,delete o.type,o}}const zg=S("update-block-text-action");class Pa extends Yl{constructor(t,o,r,i,s,l){super(t,o,l);g(this,"beforeRichTextData");g(this,"afterRichTextData");g(this,"blockId");g(this,"type");this.blockId=r,this.beforeRichTextData=fe.default(i),this.afterRichTextData=fe.default(s),this.type=Pa.calType(i,s)}static calType(t,o){m(zg,t,"no old data"),m(zg,o,"no new data");const i=ln.diff(t,o),s=new Set;let l=!1;const a=f=>iC(f)?`cjk_${f}`:oC(f)?"number":Fd(f)?"space":rC(f)?"letter":"unknown";let d=!1;return i.forEach(f=>{f.insert?f.insert===" "?s.add("insert_letter"):typeof f.insert=="string"&&f.insert.startsWith(" ")&&f.insert.length>1?(l=!0,d=!0,s.add(`insert_${a(f.insert.substr(1))}`)):s.add(`insert_${a(f.insert)}`):f.delete&&(l?l=!1:s.add("delete"))}),{textType:Array.from(s).join("|"),begin:d}}undo(t){if(!t.getContainerById(this.containerId))return!1;const r=t.getBlockById(this.blockId);return r?(ph(t,r,this.beforeRichTextData),!0):!1}redo(t){if(!t.getContainerById(this.containerId))return!1;const r=t.getBlockById(this.blockId);return r?(ph(t,r,this.afterRichTextData),!0):!1}combinable(t){if(!(t instanceof Pa)||t.type.begin||this.type.textType!==t.type.textType||t.blockId!==this.blockId)return!1;const o=t.beforeRange,r=o.anchor;if(!r.isSimple())return!1;const i=this.afterRange;if(!i)return!1;const s=i.anchor;return!(!s.isSimple()||s.blockId!==o.anchor.blockId||s.offset!==r.offset)}combine(t){m(zg,t instanceof Pa,"invalid action type");const o=t;this.afterRichTextData=o.afterRichTextData,this.afterRange=t.afterRange}}class $9 extends Yl{constructor(e,t,o){super(e,t,e.selection.range.toDocRange()),this.blocks=o}deleteChildContainer(e){return e.doc.localDeleteChildContainers([this.containerId]),!0}insertChildContainer(e){return e.doc.localInsertChildContainer(this.containerId,fe.default(this.blocks)),!0}}class KT extends $9{undo(e){return this.deleteChildContainer(e)}redo(e){return this.insertChildContainer(e)}}class XT extends $9{undo(e){return this.insertChildContainer(e)}redo(e){return this.deleteChildContainer(e)}}const Ro=S("undo");class eD{constructor(e){g(this,"editor");g(this,"actions",[]);g(this,"undoCursor");g(this,"currentGroup",null);g(this,"groupCounter",0);g(this,"undoRedoing",!1);g(this,"handleSelectionChange",e=>{if(this.currentGroup){this.currentGroup.setAfterRange(e.selection.range.toDocRange());return}const t=this.actions[this.actions.length-1];!t||t.afterRange||t.setAfterRange(e.selection.range.toDocRange())});this.editor=e,this.undoCursor=-1,this.editor.addListener("selectionChanged",this.handleSelectionChange)}reset(){this.actions=[],this.undoCursor=-1}prepareSaveUndoState(){this.undoCursor!==-1&&(this.actions.splice(this.undoCursor),this.undoCursor=-1)}addAction(e){this.currentGroup?this.currentGroup.addAction(e):(F9(this.actions,e),setTimeout(()=>{this.editor.input.handleChanged(e)}))}beginGroup(){this.groupCounter===0?(m(Ro,!this.currentGroup,"current group already exists"),this.currentGroup=new JT(this.editor),this.groupCounter=1):(m(Ro,this.currentGroup,"current group not exists"),this.groupCounter+=1)}endGroup(){m(Ro,this.currentGroup,"current group not exists"),m(Ro,this.groupCounter>0,"group counter === 0"),this.groupCounter-=1,this.groupCounter===0&&(this.currentGroup.actions.length===0?Ro.warn("empty undo group, skip it"):(this.actions.push(this.currentGroup),this.editor.input.handleChanged(this.currentGroup)),this.currentGroup=null)}hasGroup(){return this.groupCounter>0}runInGroup(e){this.beginGroup();try{const t=e();return setTimeout(()=>this.editor.selection.caret.update()),t}catch(t){throw Ro.error(`failed to run action: ${t.message}`),t}finally{this.endGroup()}}undo(){this.undoCursor===-1&&(this.undoCursor=this.actions.length);try{for(this.undoRedoing=!0;this.undoCursor>0;){this.undoCursor-=1;const e=this.actions[this.undoCursor];if(e.undo(this.editor)){try{this.editor.selection.setRange(Si(this.editor,e.beforeRange))}catch(t){Ro.error(`undo: failed to restore caret pos: ${t.message}`)}return this.editor.input.handleChanged(e),!0}}return!1}finally{this.undoRedoing=!1}}redo(){this.undoCursor===-1&&(this.undoCursor=this.actions.length);try{for(this.undoRedoing=!0;this.undoCursor<this.actions.length;){const e=this.actions[this.undoCursor];if(this.undoCursor+=1,e.redo(this.editor)){try{const t=e.afterRange;t?this.editor.selection.setRange(Si(this.editor,t)):Ro.warn("no after range")}catch(t){Ro.error(`redo: failed to set caret pos after redo: ${t.message}`)}return this.editor.input.handleChanged(e),!0}}return!1}finally{this.undoRedoing=!1}}canUndo(){return!(this.actions.length===0||this.undoCursor===0)}canRedo(){return!(this.actions.length===0||this.undoCursor===-1||this.undoCursor===this.actions.length)}lastAction(){var t;const e=this.undoCursor===-1?this.actions.length-1:this.undoCursor-1;return(t=this.actions[e])!=null?t:null}undoTo(e){for(;;){const t=this.lastAction();if(!t||t===e)return!0;if(!this.undo())return!1}}onBeforeUpdateBlockText(e,t,o,r,i){this.undoRedoing||(this.prepareSaveUndoState(),ln.diff(o,r).length!==0&&this.addAction(new Pa(this.editor,e,t,o,r,i)))}onBeforeUpdateBlockData(e,t,o,r,i){if(this.undoRedoing)return;this.prepareSaveUndoState();const s=new xh(this.editor,e,t,o,r,i);this.addAction(s)}onBeforeInsertBlock(e,t,o,r){this.undoRedoing||(this.prepareSaveUndoState(),m(Ro,t>=0,"invalid block index"),m(Ro,o,"no block data"),this.addAction(new QT(this.editor,e,t,o,r)))}onBeforeDeleteBlock(e,t,o,r){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new YT(this.editor,e,t,o,r)))}onBeforeInsertChildContainer(e,t){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new KT(this.editor,e,t)))}onBeforeDeleteChildContainer(e,t){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new XT(this.editor,e,t)))}}class tD{async fromData(e,t){const o=t.getData("text/x-ones-editor-doc");if(o)return{"text/x-ones-editor-doc":JSON.parse(o)}}}class nD{constructor(){g(this,"converters",[]);this.addConverter(new tD)}async fromData(e,t){let o={};for(const r of this.converters){const i=await r.fromData(e,t);i&&(o={...o,...i})}return o}addConverter(e){this.converters.push(e)}}class oD{constructor(e){g(this,"renders",[]);this.editor=e}registerRender(e){this.renders.push(e)}renderText(e,t){const o={classes:[],attributes:{},styles:{}};return this.renders.forEach(r=>{if(r.renderText){const i=r.renderText(this.editor,e,t);i.classes&&o.classes.push(...i.classes),i.attributes&&(o.attributes={...o.attributes,...i.attributes}),i.styles&&(o.styles={...o.styles,...i.styles})}}),o}renderBlock(e,t,o){const r={classes:[],attributes:{},styles:{}};return this.renders.forEach(i=>{if(i.renderBlock){const s=i.renderBlock(this.editor,t,o);s.classes&&r.classes.push(...s.classes),s.attributes&&(r.attributes={...r.attributes,...s.attributes}),s.styles&&(r.styles={...r.styles,...s.styles})}}),r}updateBlock(e,t,o,r){this.renders.forEach(i=>{var s;(s=i.updateBlock)==null||s.call(i,e,t,o,r)})}}class gt extends Dt.TypedEmitter{constructor(t){super();g(this,"hoveringBlock",null);g(this,"hoveringTextChild",null);g(this,"filters",[]);g(this,"finders",[]);g(this,"handleDocumentMouseMove",t=>{if(this.hoveringBlock){for(const s of this.filters)if(s.isInBlock(this.hoveringBlock,t))return}const o=document.elementFromPoint(t.x,t.y);if(!o){this.setHoveringBlock(null,t,null);return}let r=re(o);if((!r||!Ke(this.editor.rootContainer,r))&&(r=this.findBlockByFinders(t),!r)){this.setHoveringBlock(null,t,null);return}const i=this.getParentTextContentChild(r,o);this.setHoveringBlock(r,t,i)});this.editor=t,document.addEventListener("mousemove",this.handleDocumentMouseMove)}destroy(){document.removeEventListener("mousemove",this.handleDocumentMouseMove),this.filters.forEach(t=>t.destroy()),this.filters=[],this.finders.forEach(t=>t.destroy()),this.finders=[]}addFilter(t){this.filters.push(t)}addFinder(t){this.finders.push(t)}hoveringBlockId(){return this.hoveringBlock?ie(this.hoveringBlock):""}findBlockByFinders(t){for(let o=0;o<this.finders.length;o++){const i=this.finders[o].findTargetBlock(this.editor,t);if(i)return i}return null}setHoveringBlock(t,o,r){if(this.hoveringBlock===t&&this.hoveringTextChild===r)return;if(this.hoveringBlock!==t){const s=this.hoveringBlock&&Ke(this.editor.rootContainer,this.hoveringBlock)?this.hoveringBlock:null;s&&te(s,"hover"),t&&W(t,"hover"),this.hoveringBlock=t,this.emit("change",this.hoveringBlock,s,o)}const i=this.hoveringTextChild;this.hoveringTextChild=r,this.emit("childChange",this.hoveringBlock,r,i,o)}static get(t){return t.addCustom("standard-hovering-block",()=>new gt(t))}getParentTextContentChild(t,o){if(!ee(this.editor,t))return null;const r=Re(t);return o.parentElement===r?o:Im(o)}}const H9="style-color-",j9="style-bg-color-";class rD{renderText(e,t,o){const r=[],i={},s={};return Object.entries(o).forEach(([l,a])=>{a===!0?l.startsWith(H9)?i["data-style-color"]=l.substring(H9.length):l.startsWith(j9)?i["data-style-bg-color"]=l.substring(j9.length):l.startsWith("style")&&r.push(l):typeof a=="string"&&(l==="link"&&(r.push("link"),i.link=a),l==="inline-style-color"&&(s.color=a))}),{classes:r,attributes:i,styles:s}}renderBlock(e,t,o){var l,a;const r={};Object.entries(o).filter(d=>d[0].startsWith("style-")).forEach(([d,f])=>{r[`data-${d}`]=`${f}`});const s=[];return((a=(l=e.selection)==null?void 0:l.range)==null?void 0:a.start.blockId)===o.id&&s.push("focused"),typeof o.align=="string"&&o.align&&(r["data-style-align"]=o.align),o.heading&&(r["data-style-heading"]=String(o.heading)),o.quoted&&(r["data-style-quoted"]="true"),gt.get(e).hoveringBlockId()===o.id&&s.push("hover"),{attributes:r,classes:s}}updateBlock(e,t,o,r){var s,l;Array.from(o.attributes).forEach(a=>{a.name.startsWith("data-style-")&&o.removeAttribute(a.name)}),Object.entries(r).filter(a=>a[0].startsWith("style-")).forEach(([a,d])=>{o.setAttribute(`data-${a}`,`${d}`)}),((l=(s=e.selection)==null?void 0:s.range)==null?void 0:l.start.blockId)===r.id&&W(o,"focused"),gt.get(e).hoveringBlockId()===r.id&&W(o,"hover")}}function iD(n){n.editorBlocks.registerBlockClass(In),n.editorBlocks.registerBlockClass(u4),n.editorBoxes.registerBoxClass(X4),n.editorBoxes.registerBoxClass(e6),n.editorBoxes.registerBoxClass(o6),n.editorBoxes.registerBoxClass(r6),n.editorInsertions.registerInsertionClass(i6),n.editorBlockRenders.registerRender(new rD)}function sD(n,e){iD(n),e!=null&&e.blocks&&e.blocks.forEach(t=>n.editorBlocks.registerBlockClass(t)),e!=null&&e.boxes&&e.boxes.forEach(t=>n.editorBoxes.registerBoxClass(t)),e!=null&&e.embeds&&e.embeds.forEach(t=>n.editorEmbeds.registerEmbedClass(t)),e!=null&&e.insertions&&e.insertions.forEach(t=>n.editorInsertions.registerInsertionClass(t)),e!=null&&e.decorators&&e.decorators.forEach(t=>n.editorDecorators.registerDecorator(t)),e!=null&&e.dataConverters&&e.dataConverters.forEach(t=>n.dataConverter.addConverter(t)),e!=null&&e.commandProviders&&e.commandProviders.forEach(t=>n.editorCommandProviders.registerCommandProvider(t)),e!=null&&e.textRenders&&e.textRenders.forEach(t=>n.editorBlockRenders.registerRender(t))}const U9=S("range-commands");function z9(n,e){n.forEach(t=>{t.source=e,t.children&&z9(t.children,e)})}function V9(n,e,t){const o=ie(e);m(U9,o===t.start.blockId,"invalid start range"),m(U9,o===t.end.blockId,"invalid end range");const r=n.editorCommandProviders.getCommandProviders();let i=[];return r.forEach(s=>{const l=s.getAvailableCommands(n,e,t);z9(l,s.id),i.push(...l)}),r.forEach(s=>{if(s.filterCommands){const l=s.filterCommands(n,e,t,i);l&&(i=l)}}),Le(n,e)&&Ms(n,e,t.start,t.end).forEach(l=>{At(l).forEach(d=>{const f=ue(n,d),p=Ht(n,{anchor:se(d,0,"home"),focus:se(d,f,"end")}),A=V9(n,d,p);i.push(...A)})}),i}function W9(n){const e=n.getEditor(),t=n.getSelectedBlocks(),o=[];return t.forEach(r=>{const i=Ht(e,{anchor:r.start,focus:r.end});V9(e,r.block,i).forEach(l=>{o.push(l)})}),o}function q9(n,e,t,o,r,i){var f;const s=n.editorCommandProviders.getCommandProviders();for(let p=0;p<s.length;p++){const A=s[p];if(A.beforeExecuteCommand&&A.beforeExecuteCommand(n,e,t,o,r))return!1}const l=n.editorCommandProviders.getCommandProvider(o.source),a={};if((f=l.executeCommand)!=null&&f.call(l,n,e,t,o,r,{}))return i[ie(e)]=a,!0;let d=!1;return Le(n,e)&&Ms(n,e,t.start,t.end).forEach(A=>{At(A).forEach(B=>{const D=ue(n,B),I=Ht(n,{anchor:se(B,0,"home"),focus:se(B,D,"end")});q9(n,B,I,o,r,i)&&(d=!0)})}),s.forEach(p=>{p.afterExecuteCommand&&p.afterExecuteCommand(n,e,t,o,r,i)}),d}function G9(n,e,t){const o=n.getEditor(),r={},i=o.editorCommandProviders.getCommandProvider(e.source);return i.executeRangeCommand&&i.executeRangeCommand(o,n,e,t,r)||n.getSelectedBlocks().forEach(l=>{const a=Ht(o,{anchor:l.start,focus:l.end});q9(o,l.block,a,e,t,r)}),r}const lD=S("command-providers");class Z9{constructor(e){g(this,"providers",[]);this.editor=e}registerCommandProvider(e){this.providers.push(e)}getCommandProviders(){return this.providers}getCommandProvider(e){const t=this.providers.find(o=>o.id===e);return m(lD,t,`no command provider, id=${e}`),t}getCommands(e){return W9(e)}executeCommand(e,t,o){return this.editor.undoManager.runInGroup(()=>G9(e,t,o))}getEmptyBlockTextAttributes(e,t){let o={};if(this.providers.forEach(r=>{var s;const i=(s=r.getEmptyBlockTextAttributes)==null?void 0:s.call(r,e,t);i&&(o={...o,...i})}),Object.keys(o).length!==0)return o}}function cD(n,e){const t=ne(e),o=ae(t),r=be(e);O9(n,o,r)}const aD=S("table-scroll");class Q9{constructor(e,t,o,r,i){g(this,"handleEvent",e=>{this.handler(this.editor,e,this.data)});this.editor=e,this.dom=t,this.name=o,this.handler=r,this.data=i,t.addEventListener(o,this.handleEvent)}destroy(){this.dom.removeEventListener(this.name,this.handleEvent)}}class uD{constructor(e){g(this,"handlers",new Map);this.editor=e}destroy(){Array.from(this.handlers.entries()).forEach(([e,t])=>{t.forEach(o=>o.destroy()),this.handlers.delete(e)})}addEventListener(e,t,o,r){const i=this.handlers.get(e);if(i){if(i.find(s=>s.handler===o&&s.name===t)){aD.warn(`event has already registered: ${t}`);return}i.push(new Q9(this.editor,e,t,o,r))}else{const s=new Q9(this.editor,e,t,o,r);this.handlers.set(e,[s])}}removeEventListener(e,t,o){if(!e){for(const[i,s]of Array.from(this.handlers.entries()))for(let l=s.length-1;l>=0;l--){const a=s[l];if(t)t===a.name&&o===a.handler&&s.splice(l,1);else if(o===a.handler){s.splice(l,1),a.destroy(),s.length===0&&this.handlers.delete(i);continue}}return}const r=this.handlers.get(e);if(r){const i=r.findIndex(s=>s.handler===o&&s.name===t);if(i!==-1){const s=r[i];r.splice(i,1),s.destroy(),r.length===0&&this.handlers.delete(e)}}}removeAllListeners(e,t){const o=this.handlers.get(e);if(o)if(t)for(let r=0;r<o.length;r++){const i=o[r];i.name===t&&(o.splice(r,1),i.destroy())}else o.forEach(r=>{r.destroy()}),this.handlers.delete(e)}}const Y9=S("update-block-text");function dD(n,e){const t=n.getBoxById(e.id),o=re(t);m(Y9,o,"no parent block"),m(Y9,ee(n,o),"not a text block");const r=n.getBlockText(o),i=V4(r,"id",e.id,e);T6(n,o,i)}function hD(n,e){for(const t of n.blockHooks)if(t.writable){const o=t.writable(n,e);if(typeof o=="boolean")return o}return!0}function fD(n){return n.readonly?!1:!So(n).find(o=>!n.isBlockWritable(o.block))}class mD{constructor(e){this.editor=e}getKey(e){return`${this.editor.id}-${e}`}getItem(e){return window.localStorage.getItem(this.getKey(e))}setItem(e,t){if(!t){this.removeItem(e);return}window.localStorage.setItem(this.getKey(e),t)}removeItem(e){window.localStorage.removeItem(this.getKey(e))}}class gD{constructor(){g(this,"shortcuts",[])}handleKeyboardEvents(e,t){const o=this.shortcuts;for(const r of o){const i=Object.entries(r);for(const[s,l]of i)if(Mr(t,s)){const a=l(e,t);if(a!==void 0)return a}}}}const Ur=S("editor");class pD extends Dt.TypedEmitter{constructor(t,o,r){var i,s,l,a,d,f,p;super();g(this,"parent");g(this,"rootElement");g(this,"contentElement");g(this,"rootContainerObject");g(this,"rootContainer");g(this,"input");g(this,"selection");g(this,"selectionHandler");g(this,"doc");g(this,"id");g(this,"clientId");g(this,"compositingText","");g(this,"undoManager");g(this,"shortcuts",new gD);g(this,"dataConverter",new nD);g(this,"editorBlocks",new s4(this));g(this,"editorBoxes",new n6(this));g(this,"editorInsertions",new l6(this));g(this,"editorEmbeds",new c4(this));g(this,"editorDecorators",new c6(this));g(this,"editorCommandProviders",new Z9(this));g(this,"editorBlockRenders",new oD(this));g(this,"blockHooks",[]);g(this,"domEvents",new uD(this));g(this,"customs",new Map);g(this,"options");g(this,"inputHandlers",new $T(this));g(this,"settingsProvider");g(this,"_readonly",!1);Ur.debug("create editor"),this.setMaxListeners(100),this.options={colors:(i=r==null?void 0:r.colors)!=null?i:["#9923E9","#4587C2","#8BDB7A","#FB28D3","#CBC619","#10FEEB","#812A1A","#8A3F25","#22D742","#A53E74","#555C87","#57E0AA"],componentsOptions:(l=(s=r==null?void 0:r.components)==null?void 0:s.options)!=null?l:{},scrollContainer:r==null?void 0:r.scrollContainer},this.settingsProvider=(a=r==null?void 0:r.settingsProvider)!=null?a:new mD(this),sD(this,r==null?void 0:r.components),this.blockHooks.push(...(f=(d=r==null?void 0:r.components)==null?void 0:d.blockHooks)!=null?f:[]),this.id=(p=r==null?void 0:r.id)!=null?p:K(),this.clientId=K(),this.undoManager=new eD(this),this.doc=new GT(this,o,this.undoManager),this.parent=t,this.rootElement=w("div",["editor-root"],this.parent),this.rootElement.setAttribute("data-editor-client-id",this.clientId),this.contentElement=w("div",["editor-content"],this.rootElement),this.rootContainerObject=o4(this),this.rootContainer=this.rootContainerObject.rootContainer,this.input=new II(this,this.inputHandlers),this.selection=new fT(this),this.selectionHandler=new pT(this),r!=null&&r.shortcuts&&this.shortcuts.shortcuts.push(...r.shortcuts),Kt.isMobile&&W(this.rootElement,"mobile"),Kt.isSafari&&W(this.rootElement,"safari"),this._readonly&&W(this.rootElement,"readonly"),this.emit("load",this,!1)}get readonly(){return this._readonly}set readonly(t){this._readonly=t,t?W(this.rootElement,"readonly"):te(this.rootElement,"readonly"),this.emit("readonlyChanged",this)}get scrollContainer(){return this.options.scrollContainer?this.options.scrollContainer:wo(this.rootContainer)}addCustom(t,o){const r=this.customs.get(t);if(r)return r;const i=o(this);return this.customs.set(t,i),i}getCustom(t){const o=this.customs.get(t);return m(Ur,o,`${t} does not exists`),o}replaceCustom(t,o){const r=this.customs.get(t);return r&&r.destroy(),this.customs.set(t,o),o}findCustom(t){return this.customs.get(t)}findCustomByType(t){const o=this.customs.values();for(const r of o)if(r instanceof t)return r;return null}destroyCustom(t){const o=this.customs.get(t);o&&(this.customs.delete(t),o.destroy())}getComponentOptions(t){return this.options.componentsOptions[t]}registerLocalEvents(t){this.doc.registerLocalEvents(t)}reload(){this.rootContainerObject.reload(),this.emit("load",this,!0)}createBlock(t,o,r){return this.editorBlocks.createBlock(t,o,r)}createBox(t,o){return this.editorBoxes.createBox(t,o)}createInsertion(t,o){return this.editorInsertions.createInsertion(t,o)}destroy(){Ur.debug("destroy editor"),this.emit("destroy",this),this.input.destroy(),this.rootContainerObject.destroy(),this.rootElement.remove(),this.doc.destroy(),this.customs.forEach(t=>t.destroy()),this.customs.clear(),this.selection.destroy(),this.domEvents.destroy(),this.removeAllListeners(),this.inputHandlers.destroy()}focus(){this.input.focus()}focusToBlock(t,o){Eg(this,t,o)}isWritable(){return fD(this)}isBlockWritable(t){return hD(this,t)}getChildContainerData(t){const o=this.doc.getContainerBlocks(t);return m(Ur,o,`no child container data: ${t}, ${JSON.stringify(this.doc)}`),m(Ur,Array.isArray(o),`container data is not an array: ${JSON.stringify(o)}`),o}createChildContainer(t,o,r){return r4(this,t,o,r)}getFirstBlock(){return this.rootContainer.querySelector("[data-type=editor-block]")}getLastBlock(){const t=Array.from(this.rootContainer.querySelectorAll(":scope [data-type=editor-block]"));return t[t.length-1]}getFocusedBlock(){return this.selection.getFocusedBlock()}findBlockById(t){const o=this.rootContainer.querySelector(`#${t}`);return o&&m(Ur,Es(o),"not an valid block element"),o!=null?o:null}findBoxById(t){const o=this.rootContainer.querySelector(`#${t}`);return o&&m(Ur,xm(o),"not an valid box element"),o!=null?o:null}getBlockById(t){const o=this.findBlockById(t);return m(Ur,o,`no block, id=${t}`),o}getBoxById(t){const o=this.findBoxById(t);return m(Ur,o,`no box, id=${t}`),o}getBlockByIndex(t,o){const r=this.getContainerById(t);return Rr(r,o)}getBlockIndex(t){if(typeof t=="string"){const o=this.getBlockById(t);return be(o)}return be(t)}getContainerById(t){return Fr(this,t)}getParentContainer(t){return ne(t)}reloadBlock(t){cD(this,t)}contains(t){const o=t instanceof Element?t:t.parentElement;return o?o.closest("div.editor-root")===this.rootElement:!1}insertBlock(t,o,r,i,s){const l={blockId:r.id,offset:0},a={anchor:l,focus:l};return Gl(this,t,o,r,i!=null?i:a,s)}insertEmbed(t,o,r,i,s){const l={id:K(),type:"embed",embedType:r,embedData:i};return this.insertBlock(t,o,l,s)}deleteBlock(t,o){kg(this,t,o)}mergeTextBlock(t,o){return E6(this,t,o)}breakTextBlock(t,o,r){return Zl(this,t,o,r).newBlock}getTextPosition(){return ql(this)}getBlockString(t,o){const r=this.getBlockText(t);return rt(r,o)}getBlockData(t){return _i(this,t)}getBoxData(t){return J4(this,t)}getBlockText(t){return mn(this,t)}setBlockText(t,o){T6(this,t,o)}deleteTextFromBlock(t,o,r,i){return vg(this,t,o,r,i)}insertTextToBlock(t,o,r,i){return A6(this,t,o,r,i)}insertBoxToBlock(t,o,r){return b6(this,t,o,r)}pasteDoc(t){return this.inputHandlers.pasteDoc(t)}insertDoc(t,o,r,i){L6(this,t,o,r,i)}insertDocAt(t,o,r,i){return Tg(this,t,o,r,i)}deleteChildContainers(t){B6(this,t)}replaceBlockText(t,o){return ph(this,t,o)}updateBlockData(t,o,r){const i={...this.getBlockData(t),...o},{id:s,type:l,...a}=i;return Ch(this,t,a,(r!=null?r:this.selection.range).toDocRange())}updateEmbedData(t,o,r){return D6(this,t,o,r)}updateBoxData(t){dD(this,t)}getSelectedText(){const t=vh(this);return Ia(this,t)}clearSelectedContents(){Bg(this)}insertTextBlock(t,o,r,i){const s=sr(t!=null?t:"");return w6(this,s,o,r,i==null?void 0:i.newRange,i==null?void 0:i.insertBlockOptions)}updateCompositionText(t,o){if(t&&!o&&(this.selection.range.isCollapsed()||this.clearSelectedContents()),!t&&!o){y6(this);return}o?(this.compositingText="",hm()||bg(this,t)):(this.compositingText=t,v6(this))}getColor(t){const o=this.options.colors;return o.length===0?"#FF1A75":o[t%o.length]}}function Fa(n,e,t){return new pD(n,e,t)}function CD(n){const e=(o,r)=>{const i=o.findIndex(l=>l.id===r.id);if(i===-1){o.push(r);return}const s=o[i];if(s.value!==r.value){o.splice(i,1);return}if(!!s.states){if(!r.states){s.states=[];return}s.states=em.default(s.states,r.states)}},t=[];return n.forEach(o=>{o.forEach(r=>{e(t,r)})}),t}const AD=["#FBBFBD","#FFDDB6","#FFF897","#C5F0C1","#CEDDFE","#DCC9FC","#E5E6E8","#F76964","#FFA53D","#FFE928","#63D156","#A0BBFE","#C4A5FB","#BBBFC3"];class Ih extends Dt.TypedEmitter{constructor(t){super();g(this,"users",new Map);g(this,"cursors",new Map);g(this,"addingUser",!1);g(this,"colors");this.colors=t&&t.length>0?t:AD}setCursor(t){this.addUser(t.user);const o=this.cursors.get(t.user.userId);if(o&&la.default(o,t))return;this.cursors.set(t.user.userId,t);const r=new Set([t.range.anchor.blockId,t.range.focus.blockId]),i=new Set(r);o&&new Set([o.range.anchor.blockId,o.range.focus.blockId]).forEach(l=>{r.has(l)||i.add(l)}),this.emit("remote-carets-change",[...i])}addUsers(t){this.addingUser=!0,t.forEach(o=>this.addUser(o)),this.addingUser=!1,this.emit("change",Array.from(this.users.values()))}addUser(t){this.users.set(t.userId,t),this.addingUser||this.emit("change",Array.from(this.users.values()))}findUser(t){var o;return(o=this.users.get(t))!=null?o:null}removeUser(t){this.users.delete(t),this.cursors.delete(t),this.emit("change",Array.from(this.users.values()))}updateUsers(t){this.users.clear(),this.addingUser=!0;try{t.forEach(o=>{this.addUser(o)})}finally{this.addingUser=!1}setTimeout(()=>{this.emit("change",Array.from(this.users.values()))},300)}getSimpleCursors(t){const o=new Map;return Array.from(this.cursors.values()).filter(r=>r.range.anchor.blockId===t&&ih(r.range)).forEach(r=>{const i=r.range.focus.offset;let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}),o}getCursors(t){return Array.from(this.cursors.values()).filter(o=>o.range.anchor.blockId===t||o.range.focus.blockId===t)}onUpdateBlockText(t,o,r){if(!t.text)return;this.getCursors(t.id).forEach(l=>{if(ih(l.range)){const{anchor:a,focus:d}=l.range;a.blockId===t.id&&(a.offset=ln.transformCursor(a.offset,o,r)),d.blockId===t.id&&(d.offset=ln.transformCursor(d.offset,o,r))}})}getFixedUserColor(t,o){let r=0;Array.from(t).forEach(s=>{r+=s.charCodeAt(0)});const i=r%this.colors.length;return this.colors[i]}destroy(){this.removeAllListeners()}}const Xt=S("local-doc");class Vg extends ua{constructor(t,o){super();g(this,"doc");g(this,"serviceUrl");t?this.doc=t:this.doc={meta:{},comments:{},blocks:{root:[sr("")]}},this.serviceUrl=(o==null?void 0:o.serverUrl)||""}beginBatchUpdate(){return 0}endBatchUpdate(){return 0}toJSON(){return fe.default(this.doc)}getContainerBlocks(t){return this.doc.blocks[t]}getBlockData(t,o){const r=this.getContainerBlocks(t);m(Xt,r,`no container data: ${t}`);const i=r[o];return m(Xt,i,`no block data: ${o}`),i}localUpdateBlockText(t,o,r){const i=this.getBlockData(t,o);m(Xt,i.text,"no text for data");const s=ln.apply(i.text,r);return i.text=s,m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(l=>{var a;return(a=l.onUpdateBlockText)==null?void 0:a.call(l,t,o,r,!0)}),s}localUpdateBlockData(t,o,r){const i=this.getBlockData(t,o);return r.delete.forEach(s=>delete i[s]),Object.entries(r.insert).forEach(([s,l])=>{i[s]=l}),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,t,o,r,!0)}),i}localInsertBlock(t,o,r){const i=this.getContainerBlocks(t);return m(Xt,i,`no container data: ${t}`),m(Xt,o>=0&&o<=i.length,`invalid block index: ${o}, ${i.length}`),i.splice(o,0,r),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onInsertBlock)==null?void 0:l.call(s,t,o,r,!0)}),r}localDeleteBlock(t,o){const r=this.getContainerBlocks(t);m(Xt,r,`no container data: ${t}`),m(Xt,o>=0&&o<=r.length,`invalid block index: ${o}, ${r.length}`);const i=r[o];return r.splice(o,1),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onDeleteBlock)==null?void 0:l.call(s,t,o,!0)}),i}localInsertChildContainer(t,o){this.doc.blocks[t]=o,m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onInsertChildContainer)==null?void 0:i.call(r,t,o,!0)})}localDeleteChildContainers(t){Xt.debug(`delete child containers: ${t}`),t.forEach(o=>{m(Xt,this.doc.blocks[o],`no child container: ${o}`),delete this.doc.blocks[o]}),t.forEach(o=>{m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,o,!0)})})}uploadResource(t,o){m(Xt,!1,"not implemented")}async addResources(t){return t}buildResourceUrl(t){return t}request(t,o){m(Xt,!1,"not implemented")}broadcastMessage(t){}getServerMeta(){return{serverId:this.serviceUrl}}getUser(){return{permission:"w",userId:"-",displayName:"-",avatarUrl:"-",rainbowIndex:0}}getRemoteUsers(){return new Ih}setDoc(t){this.doc=fe.default(t),this.callbacks.forEach(o=>{var r;return(r=o.onRequestReload)==null?void 0:r.call(o,"change doc")})}destroy(){this.clearCallbacks()}}class bD{constructor(e){this.cleanup=e}destroy(){var e;(e=this.cleanup)==null||e.call(this)}}function Wg(n,e,t){n.addCustom(e,()=>{var i;const o=(i=t())!=null?i:void 0;return new bD(o)})}const J9=S("find-block");function K9(n,e){const t=Ts(e);if(!t){if(no(e))return null;const o=xs(e);return m(J9,o,"no parent block"),K9(n,o)}return Le(n,t)?zl(n,t,{visibleOnly:!0}):t}function X9(n,e){const t=Ds(e);if(!t){if(no(e))return null;const o=xs(e);return m(J9,o,"no parent block"),X9(n,o)}return Le(n,t)?zm(n,t,{visibleOnly:!0}):t}const vD=S("remote-cursor");class yD{constructor(){g(this,"remoteUsers",new Ih)}onCustomMessage(e){const t=e;if(t.type==="onlineUsers"){const o=t;this.handleUpdateUsers(o.users)}else t.type==="caret"?this.handleUpdateCaret(t):vD.debug(`unknown remote message received: ${e}`)}handleUpdateUsers(e){this.remoteUsers.updateUsers(e)}handleUpdateCaret(e){const t=this.remoteUsers.findUser(e.userId);!t||this.remoteUsers.setCursor({oneseditor:"cursor",user:t,range:e.range,time:Date.now()})}destroy(){this.remoteUsers.destroy()}}function kD(n){const{blocks:e,meta:t,comments:o,...r}=n;return{rootBlocks:e,meta:t,comments:o,childBlocks:r}}function wD(n){const{blocks:e,meta:t,comments:o}=n,{root:r,...i}=e;return{blocks:r,meta:t,comments:o,...i}}function Na(n){const{childBlocks:e,meta:t,comments:o,rootBlocks:r}=kD(fe.default(n));return{blocks:{root:r,...e},meta:t,comments:o}}function Ni(n){return n==="root"?"blocks":n}function Jl(n){return n==="blocks"?"root":n}const BD={type:{name:"rich-text",uri:"http://sharejs.org/types/rich-text/v1",create(n){return new on.default(n)},apply(n,e){const t=new on.default(n),o=new on.default(e);return t.compose(o).ops},compose(n,e){const t=new on.default(n),o=new on.default(e);return t.compose(o).ops},diff(n,e){const t=new on.default(n),o=new on.default(e);return t.diff(o).ops},transform(n,e,t){const o=new on.default(n);return new on.default(e).transform(o,t==="left").ops},transformCursor(n,e,t){return e.transformPosition(n,!t)},normalize(n){return n},serialize(n){return n.ops},deserialize(n){return n},transformPresence(n,e,t){if(!n)return null;const o=new on.default(e),r=this.transformCursor(n.index,o,t),i=this.transformCursor(n.index+n.length,o,t);return{...n,index:r,length:i-r}}}};var cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$i={},qg=F3.default.EventEmitter;$i.EventEmitter=qg,$i.mixin=ED;function ED(n){for(var e in qg.prototype)n.prototype[e]=qg.prototype[e]}var e7=["info","warn","error"];function t7(){var n={};e7.forEach(function(e){n[e]=console[e].bind(console)}),this.setMethods(n)}var xD=t7;t7.prototype.setMethods=function(n){n=n||{};var e=this;e7.forEach(function(t){typeof n[t]=="function"&&(e[t]=n[t])})};var ID=xD,TD=new ID,n7=TD;function $s(n,e){this.code=n,this.message=e||"",Error.captureStackTrace?Error.captureStackTrace(this,$s):this.stack=new Error().stack}$s.prototype=Object.create(Error.prototype),$s.prototype.constructor=$s,$s.prototype.name="ShareDBError",$s.CODES={ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT:"ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT",ERR_APPLY_SNAPSHOT_NOT_PROVIDED:"ERR_APPLY_SNAPSHOT_NOT_PROVIDED",ERR_CLIENT_ID_BADLY_FORMED:"ERR_CLIENT_ID_BADLY_FORMED",ERR_CANNOT_PING_OFFLINE:"ERR_CANNOT_PING_OFFLINE",ERR_CONNECTION_SEQ_INTEGER_OVERFLOW:"ERR_CONNECTION_SEQ_INTEGER_OVERFLOW",ERR_CONNECTION_STATE_TRANSITION_INVALID:"ERR_CONNECTION_STATE_TRANSITION_INVALID",ERR_DATABASE_ADAPTER_NOT_FOUND:"ERR_DATABASE_ADAPTER_NOT_FOUND",ERR_DATABASE_DOES_NOT_SUPPORT_SUBSCRIBE:"ERR_DATABASE_DOES_NOT_SUPPORT_SUBSCRIBE",ERR_DATABASE_METHOD_NOT_IMPLEMENTED:"ERR_DATABASE_METHOD_NOT_IMPLEMENTED",ERR_DEFAULT_TYPE_MISMATCH:"ERR_DEFAULT_TYPE_MISMATCH",ERR_DOC_MISSING_VERSION:"ERR_DOC_MISSING_VERSION",ERR_DOC_ALREADY_CREATED:"ERR_DOC_ALREADY_CREATED",ERR_DOC_DOES_NOT_EXIST:"ERR_DOC_DOES_NOT_EXIST",ERR_DOC_TYPE_NOT_RECOGNIZED:"ERR_DOC_TYPE_NOT_RECOGNIZED",ERR_DOC_WAS_DELETED:"ERR_DOC_WAS_DELETED",ERR_INFLIGHT_OP_MISSING:"ERR_INFLIGHT_OP_MISSING",ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION:"ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION",ERR_MAX_SUBMIT_RETRIES_EXCEEDED:"ERR_MAX_SUBMIT_RETRIES_EXCEEDED",ERR_MESSAGE_BADLY_FORMED:"ERR_MESSAGE_BADLY_FORMED",ERR_MILESTONE_ARGUMENT_INVALID:"ERR_MILESTONE_ARGUMENT_INVALID",ERR_OP_ALREADY_SUBMITTED:"ERR_OP_ALREADY_SUBMITTED",ERR_OP_NOT_ALLOWED_IN_PROJECTION:"ERR_OP_NOT_ALLOWED_IN_PROJECTION",ERR_OP_SUBMIT_REJECTED:"ERR_OP_SUBMIT_REJECTED",ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM:"ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM",ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM:"ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM",ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT:"ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT",ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED:"ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED",ERR_OT_OP_BADLY_FORMED:"ERR_OT_OP_BADLY_FORMED",ERR_OT_OP_NOT_APPLIED:"ERR_OT_OP_NOT_APPLIED",ERR_OT_OP_NOT_PROVIDED:"ERR_OT_OP_NOT_PROVIDED",ERR_PRESENCE_TRANSFORM_FAILED:"ERR_PRESENCE_TRANSFORM_FAILED",ERR_PROTOCOL_VERSION_NOT_SUPPORTED:"ERR_PROTOCOL_VERSION_NOT_SUPPORTED",ERR_QUERY_EMITTER_LISTENER_NOT_ASSIGNED:"ERR_QUERY_EMITTER_LISTENER_NOT_ASSIGNED",ERR_SNAPSHOT_READ_SILENT_REJECTION:"ERR_SNAPSHOT_READ_SILENT_REJECTION",ERR_SNAPSHOT_READS_REJECTED:"ERR_SNAPSHOT_READS_REJECTED",ERR_SUBMIT_TRANSFORM_OPS_NOT_FOUND:"ERR_SUBMIT_TRANSFORM_OPS_NOT_FOUND",ERR_TYPE_CANNOT_BE_PROJECTED:"ERR_TYPE_CANNOT_BE_PROJECTED",ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE:"ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE",ERR_UNKNOWN_ERROR:"ERR_UNKNOWN_ERROR"};var Th=$s,$a={},o7=DD;function DD(n,e,t,o){var r=function(s,l,a,d){e(a,s,l,"left"),e(d,l,s,"right")},i=n.transformX=function(s,l){t(s),t(l);for(var a=[],d=0;d<l.length;d++){for(var f=l[d],p=[],A=0;A<s.length;){var v=[];if(r(s[A],f,p,v),A++,v.length===1)f=v[0];else if(v.length===0){for(var B=A;B<s.length;B++)o(p,s[B]);f=null;break}else{for(var D=i(s.slice(A),v),I=0;I<D[0].length;I++)o(p,D[0][I]);for(var _=0;_<D[1].length;_++)o(a,D[1][_]);f=null;break}}f!=null&&o(a,f),s=p}return[s,a]};n.transform=function(s,l,a){if(!(a==="left"||a==="right"))throw new Error("type must be 'left' or 'right'");return l.length===0?s:s.length===1&&l.length===1?e([],s[0],l[0],a):a==="left"?i(s,l)[0]:i(l,s)[1]}}var r7={exports:{}},Hi=r7.exports={name:"text0",uri:"http://sharejs.org/types/textv0",create:function(n){if(n!=null&&typeof n!="string")throw new Error("Initial data must be a string");return n||""}},Gg=function(n,e,t){return n.slice(0,e)+t+n.slice(e)},Zg=function(n){if(typeof n.p!="number")throw new Error("component missing position field");if(typeof n.i=="string"==(typeof n.d=="string"))throw new Error("component needs an i or d field");if(n.p<0)throw new Error("position cannot be negative")},Dh=function(n){for(var e=0;e<n.length;e++)Zg(n[e])};Hi.apply=function(n,e){var t;Dh(e);for(var o=0;o<e.length;o++){var r=e[o];if(r.i!=null)n=Gg(n,r.p,r.i);else{if(t=n.slice(r.p,r.p+r.d.length),r.d!==t)throw new Error("Delete component '"+r.d+"' does not match deleted text '"+t+"'");n=n.slice(0,r.p)+n.slice(r.p+r.d.length)}}return n};var zr=Hi._append=function(n,e){if(!(e.i===""||e.d===""))if(n.length===0)n.push(e);else{var t=n[n.length-1];t.i!=null&&e.i!=null&&t.p<=e.p&&e.p<=t.p+t.i.length?n[n.length-1]={i:Gg(t.i,e.p-t.p,e.i),p:t.p}:t.d!=null&&e.d!=null&&e.p<=t.p&&t.p<=e.p+e.d.length?n[n.length-1]={d:Gg(e.d,t.p-e.p,t.d),p:e.p}:n.push(e)}};Hi.compose=function(n,e){Dh(n),Dh(e);for(var t=n.slice(),o=0;o<e.length;o++)zr(t,e[o]);return t},Hi.normalize=function(n){var e=[];(n.i!=null||n.p!=null)&&(n=[n]);for(var t=0;t<n.length;t++){var o=n[t];o.p==null&&(o.p=0),zr(e,o)}return e};var Qg=function(n,e,t){return e.i!=null?e.p<n||e.p===n&&t?n+e.i.length:n:n<=e.p?n:n<=e.p+e.d.length?e.p:n-e.d.length};Hi.transformCursor=function(n,e,t){for(var o=t==="right",r=0;r<e.length;r++)n=Qg(n,e[r],o);return n};var SD=Hi._tc=function(n,e,t,o){if(Zg(e),Zg(t),e.i!=null)zr(n,{i:e.i,p:Qg(e.p,t,o==="right")});else if(t.i!=null){var r=e.d;e.p<t.p&&(zr(n,{d:r.slice(0,t.p-e.p),p:e.p}),r=r.slice(t.p-e.p)),r!==""&&zr(n,{d:r,p:e.p+t.i.length})}else if(e.p>=t.p+t.d.length)zr(n,{d:e.d,p:e.p-t.d.length});else if(e.p+e.d.length<=t.p)zr(n,e);else{var i={d:"",p:e.p};e.p<t.p&&(i.d=e.d.slice(0,t.p-e.p)),e.p+e.d.length>t.p+t.d.length&&(i.d+=e.d.slice(t.p+t.d.length-e.p));var s=Math.max(e.p,t.p),l=Math.min(e.p+e.d.length,t.p+t.d.length),a=e.d.slice(s-e.p,l-e.p),d=t.d.slice(s-t.p,l-t.p);if(a!==d)throw new Error("Delete ops delete different text in the same region of the document");i.d!==""&&(i.p=Qg(i.p,t),zr(n,i))}return n},LD=function(n){return n.i!=null?{d:n.i,p:n.p}:{i:n.d,p:n.p}};Hi.invert=function(n){n=n.slice().reverse();for(var e=0;e<n.length;e++)n[e]=LD(n[e]);return n},o7(Hi,SD,Dh,zr);var Sh=function(n){return Object.prototype.toString.call(n)=="[object Array]"},MD=function(n){return!!n&&n.constructor===Object},Oo=function(n){return JSON.parse(JSON.stringify(n))},Ie={name:"json0",uri:"http://sharejs.org/types/JSONv0"},Vr={};Ie.registerSubtype=function(n){Vr[n.name]=n},Ie.create=function(n){return n===void 0?null:Oo(n)},Ie.invertComponent=function(n){var e={p:n.p};return n.t&&Vr[n.t]&&(e.t=n.t,e.o=Vr[n.t].invert(n.o)),n.si!==void 0&&(e.sd=n.si),n.sd!==void 0&&(e.si=n.sd),n.oi!==void 0&&(e.od=n.oi),n.od!==void 0&&(e.oi=n.od),n.li!==void 0&&(e.ld=n.li),n.ld!==void 0&&(e.li=n.ld),n.na!==void 0&&(e.na=-n.na),n.lm!==void 0&&(e.lm=n.p[n.p.length-1],e.p=n.p.slice(0,n.p.length-1).concat([n.lm])),e},Ie.invert=function(n){for(var e=n.slice().reverse(),t=[],o=0;o<e.length;o++)t.push(Ie.invertComponent(e[o]));return t},Ie.checkValidOp=function(n){for(var e=0;e<n.length;e++)if(!Sh(n[e].p))throw new Error("Missing path")},Ie.checkList=function(n){if(!Sh(n))throw new Error("Referenced element not a list")},Ie.checkObj=function(n){if(!MD(n))throw new Error("Referenced element not an object (it was "+JSON.stringify(n)+")")};function Ha(n){n.t="text0";var e={p:n.p.pop()};n.si!=null&&(e.i=n.si),n.sd!=null&&(e.d=n.sd),n.o=[e]}function ja(n){n.p.push(n.o[0].p),n.o[0].i!=null&&(n.si=n.o[0].i),n.o[0].d!=null&&(n.sd=n.o[0].d),delete n.t,delete n.o}Ie.apply=function(n,e){Ie.checkValidOp(e),e=Oo(e);for(var t={data:n},o=0;o<e.length;o++){var r=e[o];(r.si!=null||r.sd!=null)&&Ha(r);for(var i=null,s=t,l="data",a=0;a<r.p.length;a++){var d=r.p[a];if(i=s,s=s[l],l=d,i==null)throw new Error("Path invalid")}if(r.t&&r.o!==void 0&&Vr[r.t])s[l]=Vr[r.t].apply(s[l],r.o);else if(r.na!==void 0){if(typeof s[l]!="number")throw new Error("Referenced element not a number");s[l]+=r.na}else if(r.li!==void 0&&r.ld!==void 0)Ie.checkList(s),s[l]=r.li;else if(r.li!==void 0)Ie.checkList(s),s.splice(l,0,r.li);else if(r.ld!==void 0)Ie.checkList(s),s.splice(l,1);else if(r.lm!==void 0){if(Ie.checkList(s),r.lm!=l){var f=s[l];s.splice(l,1),s.splice(r.lm,0,f)}}else if(r.oi!==void 0)Ie.checkObj(s),s[l]=r.oi;else if(r.od!==void 0)Ie.checkObj(s),delete s[l];else throw new Error("invalid / missing instruction in op")}return t.data},Ie.shatter=function(n){for(var e=[],t=0;t<n.length;t++)e.push([n[t]]);return e},Ie.incrementalApply=function(n,e,t){for(var o=0;o<e.length;o++){var r=[e[o]];n=Ie.apply(n,r),t(r,n)}return n};var RD=Ie.pathMatches=function(n,e,t){if(n.length!=e.length)return!1;for(var o=0;o<n.length;o++)if(n[o]!==e[o]&&(!t||o!==n.length-1))return!1;return!0};Ie.append=function(n,e){if(e=Oo(e),n.length===0){n.push(e);return}var t=n[n.length-1];if((e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(Ha(e),Ha(t)),RD(e.p,t.p))if(e.t&&t.t&&e.t===t.t&&Vr[e.t]){if(t.o=Vr[e.t].compose(t.o,e.o),e.si!=null||e.sd!=null){for(var o=e.p,r=0;r<t.o.length-1;r++)e.o=[t.o.pop()],e.p=o.slice(),ja(e),n.push(e);ja(t)}}else t.na!=null&&e.na!=null?n[n.length-1]={p:t.p,na:t.na+e.na}:t.li!==void 0&&e.li===void 0&&e.ld===t.li?t.ld!==void 0?delete t.li:n.pop():t.od!==void 0&&t.oi===void 0&&e.oi!==void 0&&e.od===void 0?t.oi=e.oi:t.oi!==void 0&&e.od!==void 0?e.oi!==void 0?t.oi=e.oi:t.od!==void 0?delete t.oi:n.pop():e.lm!==void 0&&e.p[e.p.length-1]===e.lm||n.push(e);else(e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(ja(e),ja(t)),n.push(e)},Ie.compose=function(n,e){Ie.checkValidOp(n),Ie.checkValidOp(e);for(var t=Oo(n),o=0;o<e.length;o++)Ie.append(t,e[o]);return t},Ie.normalize=function(n){var e=[];n=Sh(n)?n:[n];for(var t=0;t<n.length;t++){var o=n[t];o.p==null&&(o.p=[]),Ie.append(e,o)}return e},Ie.commonLengthForOps=function(n,e){var t=n.p.length,o=e.p.length;if((n.na!=null||n.t)&&t++,(e.na!=null||e.t)&&o++,t===0)return-1;if(o===0)return null;t--,o--;for(var r=0;r<t;r++){var i=n.p[r];if(r>=o||i!==e.p[r])return null}return t},Ie.canOpAffectPath=function(n,e){return Ie.commonLengthForOps({p:e},n)!=null},Ie.transformComponent=function(n,e,t,o){e=Oo(e);var r=Ie.commonLengthForOps(t,e),i=Ie.commonLengthForOps(e,t),s=e.p.length,l=t.p.length;if((e.na!=null||e.t)&&s++,(t.na!=null||t.t)&&l++,i!=null&&l>s&&e.p[i]==t.p[i]){if(e.ld!==void 0){var a=Oo(t);a.p=a.p.slice(s),e.ld=Ie.apply(Oo(e.ld),[a])}else if(e.od!==void 0){var a=Oo(t);a.p=a.p.slice(s),e.od=Ie.apply(Oo(e.od),[a])}}if(r!=null){var d=s==l,a=t;if((e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(Ha(e),a=Oo(t),Ha(a)),a.t&&Vr[a.t]){if(e.t&&e.t===a.t){var f=Vr[e.t].transform(e.o,a.o,o);if(e.si!=null||e.sd!=null)for(var p=e.p,A=0;A<f.length;A++)e.o=[f[A]],e.p=p.slice(),ja(e),Ie.append(n,e);else(!Sh(f)||f.length>0)&&(e.o=f,Ie.append(n,e));return n}}else if(t.na===void 0){if(t.li!==void 0&&t.ld!==void 0){if(t.p[r]===e.p[r])if(d){if(e.ld!==void 0)if(e.li!==void 0&&o==="left")e.ld=Oo(t.li);else return n}else return n}else if(t.li!==void 0)e.li!==void 0&&e.ld===void 0&&d&&e.p[r]===t.p[r]?o==="right"&&e.p[r]++:t.p[r]<=e.p[r]&&e.p[r]++,e.lm!==void 0&&d&&t.p[r]<=e.lm&&e.lm++;else if(t.ld!==void 0){if(e.lm!==void 0&&d){if(t.p[r]===e.p[r])return n;var p=t.p[r],v=e.p[r],B=e.lm;(p<B||p===B&&v<B)&&e.lm--}if(t.p[r]<e.p[r])e.p[r]--;else if(t.p[r]===e.p[r]){if(l<s)return n;if(e.ld!==void 0)if(e.li!==void 0)delete e.ld;else return n}}else if(t.lm!==void 0)if(e.lm!==void 0&&s===l){var v=e.p[r],B=e.lm,D=t.p[r],I=t.lm;if(D!==I)if(v===D)if(o==="left")e.p[r]=I,v===B&&(e.lm=I);else return n;else v>D&&e.p[r]--,v>I?e.p[r]++:v===I&&D>I&&(e.p[r]++,v===B&&e.lm++),(B>D||B===D&&B>v)&&e.lm--,B>I?e.lm++:B===I&&(I>D&&B>v||I<D&&B<v?o==="right"&&e.lm++:B>v?e.lm++:B===D&&e.lm--)}else if(e.li!==void 0&&e.ld===void 0&&d){var v=t.p[r],B=t.lm;p=e.p[r],p>v&&e.p[r]--,p>B&&e.p[r]++}else{var v=t.p[r],B=t.lm;p=e.p[r],p===v?e.p[r]=B:(p>v&&e.p[r]--,(p>B||p===B&&v>B)&&e.p[r]++)}else if(t.oi!==void 0&&t.od!==void 0){if(e.p[r]===t.p[r])if(e.oi!==void 0&&d){if(o==="right")return n;e.od=t.oi}else return n}else if(t.oi!==void 0){if(e.oi!==void 0&&e.p[r]===t.p[r])if(o==="left")Ie.append(n,{p:e.p,od:t.oi});else return n}else if(t.od!==void 0&&e.p[r]==t.p[r]){if(!d)return n;if(e.oi!==void 0)delete e.od;else return n}}}return Ie.append(n,e),n},o7(Ie,Ie.transformComponent,Ie.checkValidOp,Ie.append);var OD=r7.exports;Ie.registerSubtype(OD);var _D=Ie,PD={type:_D};(function(n){n.defaultType=PD.type,n.map={},n.register=function(e){e.name&&(n.map[e.name]=e),e.uri&&(n.map[e.uri]=e)},n.register(n.defaultType)})($a);var _o={};(function(n){n.doNothing=e;function e(){}n.hasKeys=function(t){for(var o in t)return!0;return!1},n.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},n.isValidVersion=function(t){return t===null?!0:n.isInteger(t)&&t>=0},n.isValidTimestamp=function(t){return n.isValidVersion(t)},n.MAX_SAFE_INTEGER=9007199254740991,n.dig=function(){for(var t=arguments[0],o=1;o<arguments.length;o++){var r=arguments[o];t=t[r]||(o===arguments.length-1?void 0:{})}return t},n.digOrCreate=function(){for(var t=arguments[0],o=arguments[arguments.length-1],r=1;r<arguments.length-1;r++){var i=arguments[r];t=t[i]||(t[i]=r===arguments.length-2?o():{})}return t},n.digAndRemove=function(){for(var t=arguments[0],o=[t],r=1;r<arguments.length-1;r++){var i=arguments[r];if(!t.hasOwnProperty(i))break;t=t[i],o.push(t)}for(var r=o.length-1;r>=0;r--){var s=o[r],i=arguments[r+1],l=s[i];(r===o.length-1||!n.hasKeys(l))&&delete s[i]}},n.supportsPresence=function(t){return t&&typeof t.transformPresence=="function"},n.callEach=function(t,o){var r=!1;return t.forEach(function(i){i&&(i(o),r=!0)}),r},n.truthy=function(t){return!!t},n.nextTick=function(t){if(typeof process<"u"&&process.nextTick)return process.nextTick.apply(null,arguments);for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];setTimeout(function(){t.apply(null,o)})},n.clone=function(t){return t===void 0?void 0:JSON.parse(JSON.stringify(t))}})(_o);var i7=Array.isArray,s7=Object.keys,FD=Object.prototype.hasOwnProperty,ND=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var o=i7(e),r=i7(t),i,s,l;if(o&&r){if(s=e.length,s!=t.length)return!1;for(i=s;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(o!=r)return!1;var a=e instanceof Date,d=t instanceof Date;if(a!=d)return!1;if(a&&d)return e.getTime()==t.getTime();var f=e instanceof RegExp,p=t instanceof RegExp;if(f!=p)return!1;if(f&&p)return e.toString()==t.toString();var A=s7(e);if(s=A.length,s!==s7(t).length)return!1;for(i=s;i--!==0;)if(!FD.call(t,A[i]))return!1;for(i=s;i--!==0;)if(l=A[i],!n(e[l],t[l]))return!1;return!0}return e!==e&&t!==t},l7=$i,$D=n7,Wn=Th,Lh=$a,Po=_o,HD=Po.clone,jD=ND,Tn=Wn.CODES,UD=Pe;function Pe(n,e,t){l7.EventEmitter.call(this),this.connection=n,this.collection=e,this.id=t,this.version=null,this.type=null,this.data=void 0,this.inflightFetch=[],this.inflightSubscribe=null,this.pendingFetch=[],this.pendingSubscribe=[],this.subscribed=!1,this.wantSubscribe=!1,this._wantsDestroy=!1,this.inflightOp=null,this.pendingOps=[],this.type=null,this.applyStack=null,this.preventCompose=!1,this.submitSource=!1,this.paused=!1,this._dataStateVersion=0}l7.mixin(Pe),Pe.prototype.destroy=function(n){this._wantsDestroy=!0;var e=this;e.whenNothingPending(function(){e.wantSubscribe?e.unsubscribe(function(t){if(t)return n?n(t):e.emit("error",t);e.connection._destroyDoc(e),n&&n()}):(e.connection._destroyDoc(e),n&&n())})},Pe.prototype._setType=function(n){if(typeof n=="string"&&(n=Lh.map[n]),n)this.type=n;else if(n===null)this.type=n,this._setData(void 0);else{var e=new Wn(Tn.ERR_DOC_TYPE_NOT_RECOGNIZED,"Missing type "+n);return this.emit("error",e)}},Pe.prototype._setData=function(n){this.data=n,this._dataStateVersion++},Pe.prototype.ingestSnapshot=function(n,e){if(!n)return e&&e();if(typeof n.v!="number"){var t=new Wn(Tn.ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION,"Missing version in ingested snapshot. "+this.collection+"."+this.id);return e?e(t):this.emit("error",t)}if(this.type||this.hasWritePending()){if(this.version==null){if(this.hasWritePending())return e&&this.once("no write pending",e);var t=new Wn(Tn.ERR_DOC_MISSING_VERSION,"Cannot ingest snapshot in doc with null version. "+this.collection+"."+this.id);return e?e(t):this.emit("error",t)}return n.v>this.version?this.fetch(e):e&&e()}if(this.version>n.v)return e&&e();this.version=n.v;var o=n.type===void 0?Lh.defaultType:n.type;this._setType(o),this._setData(this.type&&this.type.deserialize?this.type.deserialize(n.data):n.data),this.emit("load"),e&&e()},Pe.prototype.whenNothingPending=function(n){var e=this;Po.nextTick(function(){if(e.hasPending()){e.once("nothing pending",n);return}n()})},Pe.prototype.hasPending=function(){return!!(this.inflightOp||this.pendingOps.length||this.inflightFetch.length||this.inflightSubscribe||this.pendingFetch.length||this.pendingSubscribe.length)},Pe.prototype.hasWritePending=function(){return!!(this.inflightOp||this.pendingOps.length)},Pe.prototype._emitNothingPending=function(){this.hasWritePending()||(this.emit("no write pending"),!this.hasPending()&&this.emit("nothing pending"))},Pe.prototype._emitResponseError=function(n,e){if(n&&n.code===Tn.ERR_SNAPSHOT_READ_SILENT_REJECTION){this.wantSubscribe=!1,e&&e(),this._emitNothingPending();return}if(e){e(n),this._emitNothingPending();return}this._emitNothingPending(),this.emit("error",n)},Pe.prototype._handleFetch=function(n,e){var t=this.pendingFetch;this.pendingFetch=[];var o=this.inflightFetch.shift();if(o&&t.push(o),t.length&&(o=function(r){Po.callEach(t,r)}),n)return this._emitResponseError(n,o);this.ingestSnapshot(e,o),this._emitNothingPending()},Pe.prototype._handleSubscribe=function(n,e){var t=this.inflightSubscribe;this.inflightSubscribe=null;var o=this.pendingFetch;this.pendingFetch=[],t.callback&&o.push(t.callback);var r;if(o.length&&(r=function(i){Po.callEach(o,i)}),n)return this._emitResponseError(n,r);this.subscribed=t.wantSubscribe,this.subscribed?this.ingestSnapshot(e,r):r&&r(),this._emitNothingPending(),this._flushSubscribe()},Pe.prototype._handleOp=function(n,e){if(n)return this.inflightOp?(n.code===Tn.ERR_OP_SUBMIT_REJECTED&&(n=null),this._rollback(n)):this.emit("error",n);if(this.inflightOp&&e.src===this.inflightOp.src&&e.seq===this.inflightOp.seq){this._opAcknowledged(e);return}if(this.version==null||e.v>this.version){this.fetch();return}if(!(e.v<this.version)){if(this.inflightOp){var t=Mh(this.inflightOp,e);if(t)return this._hardRollback(t)}for(var o=0;o<this.pendingOps.length;o++){var t=Mh(this.pendingOps[o],e);if(t)return this._hardRollback(t)}this.version++;try{this._otApply(e,!1)}catch(r){return this._hardRollback(r)}}},Pe.prototype._onConnectionStateChanged=function(){this.connection.canSend?(this.flush(),this._resubscribe()):(this.inflightOp&&(this.pendingOps.unshift(this.inflightOp),this.inflightOp=null),this.subscribed=!1,this.inflightSubscribe&&(this.inflightSubscribe.wantSubscribe?(this.pendingSubscribe.unshift(this.inflightSubscribe),this.inflightSubscribe=null):this._handleSubscribe()),this.inflightFetch.length&&(this.pendingFetch=this.pendingFetch.concat(this.inflightFetch),this.inflightFetch.length=0))},Pe.prototype._resubscribe=function(){if(!this.pendingSubscribe.length&&this.wantSubscribe)return this.subscribe();var n=this.pendingSubscribe.some(function(e){return e.wantSubscribe});!n&&this.pendingFetch.length&&this.fetch(),this._flushSubscribe()},Pe.prototype.fetch=function(n){if(this.connection.canSend){var e=this.connection.sendFetch(this);zD(this.inflightFetch,e,n);return}this.pendingFetch.push(n)},Pe.prototype.subscribe=function(n){var e=!0;this._queueSubscribe(e,n)},Pe.prototype.unsubscribe=function(n){var e=!1;this._queueSubscribe(e,n)},Pe.prototype._queueSubscribe=function(n,e){var t=this.pendingSubscribe[this.pendingSubscribe.length-1]||this.inflightSubscribe,o=t&&t.wantSubscribe===n;if(o){t.callback=VD([t.callback,e]);return}this.pendingSubscribe.push({wantSubscribe:!!n,callback:e}),this._flushSubscribe()},Pe.prototype._flushSubscribe=function(){if(!(this.inflightSubscribe||!this.pendingSubscribe.length)){if(this.connection.canSend){this.inflightSubscribe=this.pendingSubscribe.shift(),this.wantSubscribe=this.inflightSubscribe.wantSubscribe,this.wantSubscribe?this.connection.sendSubscribe(this):(this.subscribed=!1,this.connection.sendUnsubscribe(this));return}if(!this.pendingSubscribe[0].wantSubscribe){this.inflightSubscribe=this.pendingSubscribe.shift();var n=this;Po.nextTick(function(){n._handleSubscribe()})}}};function zD(n,e,t){if(e){var o=n.pop();n.push(function(r){o&&o(r),t&&t(r)})}else n.push(t)}function VD(n){return n=n.filter(Po.truthy),n.length?function(e){Po.callEach(n,e)}:null}Pe.prototype.flush=function(){!this.connection.canSend||this.inflightOp||!this.paused&&this.pendingOps.length&&this._sendOp()};function WD(n){delete n.op,delete n.create,delete n.del}function Mh(n,e){if(n.del)return WD(e);if(e.del)return new Wn(Tn.ERR_DOC_WAS_DELETED,"Document was deleted");if(e.create)return new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already created");if("op"in e){if(n.create)return new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already created");if(n.type.transformX){var t=n.type.transformX(n.op,e.op);n.op=t[0],e.op=t[1]}else{var o=n.type.transform(n.op,e.op,"left"),r=n.type.transform(e.op,n.op,"right");n.op=o,e.op=r}}}Pe.prototype._otApply=function(n,e){if("op"in n){if(!this.type)throw new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Cannot apply op to uncreated document. "+this.collection+"."+this.id);if(this.emit("before op batch",n.op,e),!e&&this.type===Lh.defaultType&&n.op.length>1){this.applyStack||(this.applyStack=[]);for(var t=this.applyStack.length,o=0;o<n.op.length;o++){var r=n.op[o],i={op:[r]};this.emit("before op",i.op,e,n.src);for(var s=t;s<this.applyStack.length;s++){var l=Mh(this.applyStack[s],i);if(l)return this._hardRollback(l)}this._setData(this.type.apply(this.data,i.op)),this.emit("op",i.op,e,n.src)}this.emit("op batch",n.op,e),this._popApplyStack(t);return}this.emit("before op",n.op,e,n.src),this._setData(this.type.apply(this.data,n.op)),this.emit("op",n.op,e,n.src),this.emit("op batch",n.op,e);return}if(n.create){this._setType(n.create.type),this.type.deserialize?this.type.createDeserialized?this._setData(this.type.createDeserialized(n.create.data)):this._setData(this.type.deserialize(this.type.create(n.create.data))):this._setData(this.type.create(n.create.data)),this.emit("create",e);return}if(n.del){var a=this.data;this._setType(null),this.emit("del",a,e);return}},Pe.prototype._sendOp=function(){if(!!this.connection.canSend){var n=this.connection.id;this.inflightOp||(this.inflightOp=this.pendingOps.shift());var e=this.inflightOp;if(!e){var t=new Wn(Tn.ERR_INFLIGHT_OP_MISSING,"No op to send on call to _sendOp");return this.emit("error",t)}if(e.sentAt=Date.now(),e.retries=e.retries==null?0:e.retries+1,e.seq==null){if(this.connection.seq>=Po.MAX_SAFE_INTEGER)return this.emit("error",new Wn(Tn.ERR_CONNECTION_SEQ_INTEGER_OVERFLOW,"Connection seq has exceeded the max safe integer, maybe from being open for too long"));e.seq=this.connection.seq++}this.connection.sendOp(this,e),e.src==null&&(e.src=n)}},Pe.prototype._submit=function(n,e,t){if(e||(e=!0),"op"in n){if(!this.type){var o=new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Cannot submit op. Document has not been created. "+this.collection+"."+this.id);return t?t(o):this.emit("error",o)}this.type.normalize&&(n.op=this.type.normalize(n.op))}try{this._pushOp(n,e,t),this._otApply(n,e)}catch(i){return this._hardRollback(i)}var r=this;Po.nextTick(function(){r.flush()})},Pe.prototype._pushOp=function(n,e,t){if(n.source=e,this.applyStack)this.applyStack.push(n);else{var o=this._tryCompose(n);if(o){o.callbacks.push(t);return}}n.type=this.type,n.callbacks=[t],this.pendingOps.push(n)},Pe.prototype._popApplyStack=function(n){if(n>0){this.applyStack.length=n;return}var e=this.applyStack[0];if(this.applyStack=null,!!e){var t=this.pendingOps.indexOf(e);if(t!==-1)for(var o=this.pendingOps.splice(t),t=0;t<o.length;t++){var e=o[t],r=this._tryCompose(e);r?r.callbacks=r.callbacks.concat(e.callbacks):this.pendingOps.push(e)}}},Pe.prototype._tryCompose=function(n){if(!this.preventCompose){var e=this.pendingOps[this.pendingOps.length-1];if(!(!e||e.sentAt)&&!(this.submitSource&&!jD(n.source,e.source))){if(e.create&&"op"in n)return e.create.data=this.type.apply(e.create.data,n.op),e;if("op"in e&&"op"in n&&this.type.compose)return e.op=this.type.compose(e.op,n.op),e}}},Pe.prototype.submitOp=function(n,e,t){typeof e=="function"&&(t=e,e=null);var o={op:n},r=e&&e.source;this._submit(o,r,t)},Pe.prototype.create=function(n,e,t,o){if(typeof e=="function"?(o=e,t=null,e=null):typeof t=="function"&&(o=t,t=null),e||(e=Lh.defaultType.uri),this.type){var r=new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already exists");return o?o(r):this.emit("error",r)}var i={create:{type:e,data:n}},s=t&&t.source;this._submit(i,s,o)},Pe.prototype.del=function(n,e){if(typeof n=="function"&&(e=n,n=null),!this.type){var t=new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");return e?e(t):this.emit("error",t)}var o={del:!0},r=n&&n.source;this._submit(o,r,e)},Pe.prototype.pause=function(){this.paused=!0},Pe.prototype.resume=function(){this.paused=!1,this.flush()},Pe.prototype.toSnapshot=function(){return{v:this.version,data:HD(this.data),type:this.type.uri}},Pe.prototype._opAcknowledged=function(n){if(this.inflightOp.create)this.version=n.v;else if(n.v!==this.version)return $D.warn("Invalid version from server. Expected: "+this.version+" Received: "+n.v,n),this.fetch();this.version++,this._clearInflightOp()},Pe.prototype._rollback=function(n){var e=this.inflightOp;if("op"in e&&e.type.invert){try{e.op=e.type.invert(e.op)}catch{return this._hardRollback(n)}for(var t=0;t<this.pendingOps.length;t++){var o=Mh(this.pendingOps[t],e);if(o)return this._hardRollback(o)}try{this._otApply(e,!1)}catch(r){return this._hardRollback(r)}this._clearInflightOp(n);return}this._hardRollback(n)},Pe.prototype._hardRollback=function(n){var e=[];this.inflightOp&&e.push(this.inflightOp),e=e.concat(this.pendingOps),this._setType(null),this.version=null,this.inflightOp=null,this.pendingOps=[];var t=this;this.fetch(function(){for(var o=!!e.length,r=0;r<e.length;r++)o=Po.callEach(e[r].callbacks,n)&&o;if(n&&!o)return t.emit("error",n)})},Pe.prototype._clearInflightOp=function(n){var e=this.inflightOp;this.inflightOp=null;var t=Po.callEach(e.callbacks,n);if(this.flush(),this._emitNothingPending(),n&&!t)return this.emit("error",n)};var Hs={};Hs.ACTIONS={initLegacy:"init",handshake:"hs",queryFetch:"qf",querySubscribe:"qs",queryUnsubscribe:"qu",queryUpdate:"q",bulkFetch:"bf",bulkSubscribe:"bs",bulkUnsubscribe:"bu",fetch:"f",subscribe:"s",unsubscribe:"u",op:"op",snapshotFetch:"nf",snapshotFetchByTimestamp:"nt",pingPong:"pp",presence:"p",presenceSubscribe:"ps",presenceUnsubscribe:"pu",presenceRequest:"pr"};var c7=$i,a7=Hs.ACTIONS,qD=_o,GD=Dn;function Dn(n,e,t,o,r,i,s){c7.EventEmitter.call(this),this.action=n,this.connection=e,this.id=t,this.collection=o,this.query=r,this.results=null,i&&i.results&&(this.results=i.results,delete i.results),this.extra=void 0,this.options=i,this.callback=s,this.ready=!1,this.sent=!1}c7.mixin(Dn),Dn.prototype.hasPending=function(){return!this.ready},Dn.prototype.send=function(){if(!!this.connection.canSend){var n={a:this.action,id:this.id,c:this.collection,q:this.query};if(this.options&&(n.o=this.options),this.results){for(var e=[],t=0;t<this.results.length;t++){var o=this.results[t];e.push([o.id,o.version])}n.r=e}this.connection.send(n),this.sent=!0}},Dn.prototype.destroy=function(n){this.connection.canSend&&this.action===a7.querySubscribe&&this.connection.send({a:a7.queryUnsubscribe,id:this.id}),this.connection._destroyQuery(this),n&&qD.nextTick(n)},Dn.prototype._onConnectionStateChanged=function(){this.connection.canSend&&!this.sent?this.send():this.sent=!1},Dn.prototype._handleFetch=function(n,e,t){this.connection._destroyQuery(this),this._handleResponse(n,e,t)},Dn.prototype._handleSubscribe=function(n,e,t){this._handleResponse(n,e,t)},Dn.prototype._handleResponse=function(n,e,t){var o=this.callback;if(this.callback=null,n)return this._finishResponse(n,o);if(!e)return this._finishResponse(null,o);var r=this,i=1,s=function(f){if(f)return r._finishResponse(f,o);--i||r._finishResponse(null,o)};if(Array.isArray(e))i+=e.length,this.results=this._ingestSnapshots(e,s),this.extra=t;else for(var l in e){i++;var a=e[l],d=this.connection.get(a.c||this.collection,l);d.ingestSnapshot(a,s)}s()},Dn.prototype._ingestSnapshots=function(n,e){for(var t=[],o=0;o<n.length;o++){var r=n[o],i=this.connection.get(r.c||this.collection,r.d);i.ingestSnapshot(r,e),t.push(i)}return t},Dn.prototype._finishResponse=function(n,e){if(this.emit("ready"),this.ready=!0,n)return this.connection._destroyQuery(this),e?e(n):this.emit("error",n);e&&e(null,this.results,this.extra)},Dn.prototype._handleError=function(n){this.emit("error",n)},Dn.prototype._handleDiff=function(n){for(var e=0;e<n.length;e++){var t=n[e];t.type==="insert"&&(t.values=this._ingestSnapshots(t.values))}for(var e=0;e<n.length;e++){var t=n[e];switch(t.type){case"insert":var o=t.values;Array.prototype.splice.apply(this.results,[t.index,0].concat(o)),this.emit("insert",o,t.index);break;case"remove":var i=t.howMany||1,r=this.results.splice(t.index,i);this.emit("remove",r,t.index);break;case"move":var i=t.howMany||1,s=this.results.splice(t.from,i);Array.prototype.splice.apply(this.results,[t.to,0].concat(s)),this.emit("move",s,t.from,t.to);break}}this.emit("changed",this.results)},Dn.prototype._handleExtra=function(n){this.extra=n,this.emit("extra",n)};var u7=$i,ZD=Hs.ACTIONS,QD=_o,d7=ar;function ar(n,e){if(u7.EventEmitter.call(this),!e||typeof e!="string")throw new Error("LocalPresence presenceId must be a string");this.presence=n,this.presenceId=e,this.connection=n.connection,this.presenceVersion=0,this.value=null,this._pendingMessages=[],this._callbacksByPresenceVersion={}}u7.mixin(ar),ar.prototype.submit=function(n,e){this.value=n,this.send(e)},ar.prototype.send=function(n){var e=this._message();this._pendingMessages.push(e),this._callbacksByPresenceVersion[e.pv]=n,this._sendPending()},ar.prototype.destroy=function(n){var e=this;this.submit(null,function(t){if(t)return e._callbackOrEmit(t,n);delete e.presence.localPresences[e.presenceId],n&&n()})},ar.prototype._sendPending=function(){if(!!this.connection.canSend){var n=this;this._pendingMessages.forEach(function(e){n.connection.send(e)}),this._pendingMessages=[]}},ar.prototype._ack=function(n,e){var t=this._getCallback(e);this._callbackOrEmit(n,t)},ar.prototype._message=function(){return{a:ZD.presence,ch:this.presence.channel,id:this.presenceId,p:this.value,pv:this.presenceVersion++}},ar.prototype._getCallback=function(n){var e=this._callbacksByPresenceVersion[n];return delete this._callbacksByPresenceVersion[n],e},ar.prototype._callbackOrEmit=function(n,e){if(e)return QD.nextTick(e,n);n&&this.emit("error",n)};var YD=_o,h7=Yg;function Yg(n,e){this.presence=n,this.presenceId=e,this.connection=this.presence.connection,this.value=null,this.presenceVersion=0}Yg.prototype.receiveUpdate=function(n){n.pv<this.presenceVersion||(this.value=n.p,this.presenceVersion=n.pv,this.presence._updateRemotePresence(this))},Yg.prototype.destroy=function(n){delete this.presence._remotePresenceInstances[this.presenceId],delete this.presence.remotePresences[this.presenceId],n&&YD.nextTick(n)};var Jg={exports:{}};(function(n,e){(function(t,o){o(e)})(cr,function(t){function o(k,T){T=T|0;for(var L=Math.max(k.length-T,0),P=Array(L),j=0;j<L;j++)P[j]=k[T+j];return P}var r=function(k){var T=o(arguments,1);return function(){var L=o(arguments);return k.apply(null,T.concat(L))}},i=function(k){return function(){var T=o(arguments),L=T.pop();k.call(this,T,L)}};function s(k){var T=typeof k;return k!=null&&(T=="object"||T=="function")}var l=typeof setImmediate=="function"&&setImmediate,a=typeof process=="object"&&typeof process.nextTick=="function";function d(k){setTimeout(k,0)}function f(k){return function(T){var L=o(arguments,1);k(function(){T.apply(null,L)})}}var p;l?p=setImmediate:a?p=process.nextTick:p=d;var A=f(p);function v(k){return i(function(T,L){var P;try{P=k.apply(this,T)}catch(j){return L(j)}s(P)&&typeof P.then=="function"?P.then(function(j){B(L,null,j)},function(j){B(L,j.message?j:new Error(j))}):L(null,P)})}function B(k,T,L){try{k(T,L)}catch(P){A(D,P)}}function D(k){throw k}var I=typeof Symbol=="function";function _(k){return I&&k[Symbol.toStringTag]==="AsyncFunction"}function R(k){return _(k)?v(k):k}function U(k){return function(T){var L=o(arguments,1),P=i(function(j,H){var Z=this;return k(T,function(J,le){R(J).apply(Z,j.concat(le))},H)});return L.length?P.apply(this,L):P}}var z=typeof cr=="object"&&cr&&cr.Object===Object&&cr,q=typeof self=="object"&&self&&self.Object===Object&&self,oe=z||q||Function("return this")(),me=oe.Symbol,Be=Object.prototype,je=Be.hasOwnProperty,Ue=Be.toString,tt=me?me.toStringTag:void 0;function Yt(k){var T=je.call(k,tt),L=k[tt];try{k[tt]=void 0;var P=!0}catch{}var j=Ue.call(k);return P&&(T?k[tt]=L:delete k[tt]),j}var Wo=Object.prototype,Ft=Wo.toString;function Ln(k){return Ft.call(k)}var br="[object Null]",bn="[object Undefined]",an=me?me.toStringTag:void 0;function vr(k){return k==null?k===void 0?bn:br:an&&an in Object(k)?Yt(k):Ln(k)}var ti="[object AsyncFunction]",ho="[object Function]",z2="[object GeneratorFunction]",V2="[object Proxy]";function W2(k){if(!s(k))return!1;var T=vr(k);return T==ho||T==z2||T==ti||T==V2}var ts=9007199254740991;function tl(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=ts}function nl(k){return k!=null&&tl(k.length)&&!W2(k)}var ni={};function Ne(){}function yr(k){return function(){if(k!==null){var T=k;k=null,T.apply(this,arguments)}}}var ns=typeof Symbol=="function"&&Symbol.iterator,Oc=function(k){return ns&&k[ns]&&k[ns]()};function Gf(k,T){for(var L=-1,P=Array(k);++L<k;)P[L]=T(L);return P}function un(k){return k!=null&&typeof k=="object"}var ol="[object Arguments]";function Zf(k){return un(k)&&vr(k)==ol}var fo=Object.prototype,Qf=fo.hasOwnProperty,q2=fo.propertyIsEnumerable,rl=Zf(function(){return arguments}())?Zf:function(k){return un(k)&&Qf.call(k,"callee")&&!q2.call(k,"callee")},pt=Array.isArray;function il(){return!1}var sl=typeof t=="object"&&t&&!t.nodeType&&t,Yf=sl&&!0&&n&&!n.nodeType&&n,ll=Yf&&Yf.exports===sl,Jf=ll?oe.Buffer:void 0,cl=Jf?Jf.isBuffer:void 0,os=cl||il,Pu=9007199254740991,Fu=/^(?:0|[1-9]\d*)$/;function Nu(k,T){var L=typeof k;return T=T==null?Pu:T,!!T&&(L=="number"||L!="symbol"&&Fu.test(k))&&k>-1&&k%1==0&&k<T}var $u="[object Arguments]",Hu="[object Array]",ju="[object Boolean]",Uu="[object Date]",zu="[object Error]",Vu="[object Function]",G2="[object Map]",Z2="[object Number]",Q2="[object Object]",Kf="[object RegExp]",Xf="[object Set]",Y2="[object String]",J2="[object WeakMap]",K2="[object ArrayBuffer]",X2="[object DataView]",e1="[object Float32Array]",e5="[object Float64Array]",t5="[object Int8Array]",n5="[object Int16Array]",Wu="[object Int32Array]",o5="[object Uint8Array]",qu="[object Uint8ClampedArray]",r5="[object Uint16Array]",i5="[object Uint32Array]",it={};it[e1]=it[e5]=it[t5]=it[n5]=it[Wu]=it[o5]=it[qu]=it[r5]=it[i5]=!0,it[$u]=it[Hu]=it[K2]=it[ju]=it[X2]=it[Uu]=it[zu]=it[Vu]=it[G2]=it[Z2]=it[Q2]=it[Kf]=it[Xf]=it[Y2]=it[J2]=!1;function s5(k){return un(k)&&tl(k.length)&&!!it[vr(k)]}function l5(k){return function(T){return k(T)}}var t1=typeof t=="object"&&t&&!t.nodeType&&t,al=t1&&!0&&n&&!n.nodeType&&n,c5=al&&al.exports===t1,_c=c5&&z.process,n1=function(){try{var k=al&&al.require&&al.require("util").types;return k||_c&&_c.binding&&_c.binding("util")}catch{}}(),o1=n1&&n1.isTypedArray,a5=o1?l5(o1):s5,u5=Object.prototype,d5=u5.hasOwnProperty;function h5(k,T){var L=pt(k),P=!L&&rl(k),j=!L&&!P&&os(k),H=!L&&!P&&!j&&a5(k),Z=L||P||j||H,J=Z?Gf(k.length,String):[],le=J.length;for(var pe in k)(T||d5.call(k,pe))&&!(Z&&(pe=="length"||j&&(pe=="offset"||pe=="parent")||H&&(pe=="buffer"||pe=="byteLength"||pe=="byteOffset")||Nu(pe,le)))&&J.push(pe);return J}var Pc=Object.prototype;function f5(k){var T=k&&k.constructor,L=typeof T=="function"&&T.prototype||Pc;return k===L}function Fc(k,T){return function(L){return k(T(L))}}var m5=Fc(Object.keys,Object),g5=Object.prototype,p5=g5.hasOwnProperty;function r1(k){if(!f5(k))return m5(k);var T=[];for(var L in Object(k))p5.call(k,L)&&L!="constructor"&&T.push(L);return T}function Nc(k){return nl(k)?h5(k):r1(k)}function i1(k){var T=-1,L=k.length;return function(){return++T<L?{value:k[T],key:T}:null}}function C5(k){var T=-1;return function(){var P=k.next();return P.done?null:(T++,{value:P.value,key:T})}}function A5(k){var T=Nc(k),L=-1,P=T.length;return function j(){var H=T[++L];return H==="__proto__"?j():L<P?{value:k[H],key:H}:null}}function b5(k){if(nl(k))return i1(k);var T=Oc(k);return T?C5(T):A5(k)}function mo(k){return function(){if(k===null)throw new Error("Callback was already called.");var T=k;k=null,T.apply(this,arguments)}}function ul(k){return function(T,L,P){if(P=yr(P||Ne),k<=0||!T)return P(null);var j=b5(T),H=!1,Z=0,J=!1;function le(ce,Ae){if(Z-=1,ce)H=!0,P(ce);else{if(Ae===ni||H&&Z<=0)return H=!0,P(null);J||pe()}}function pe(){for(J=!0;Z<k&&!H;){var ce=j();if(ce===null){H=!0,Z<=0&&P(null);return}Z+=1,L(ce.value,ce.key,mo(le))}J=!1}pe()}}function kr(k,T,L,P){ul(T)(k,R(L),P)}function Nt(k,T){return function(L,P,j){return k(L,T,P,j)}}function Gu(k,T,L){L=yr(L||Ne);var P=0,j=0,H=k.length;H===0&&L(null);function Z(J,le){J?L(J):(++j===H||le===ni)&&L(null)}for(;P<H;P++)T(k[P],P,mo(Z))}var v5=Nt(kr,1/0),qo=function(k,T,L){var P=nl(k)?Gu:v5;P(k,R(T),L)};function Go(k){return function(T,L,P){return k(qo,T,R(L),P)}}function Zu(k,T,L,P){P=P||Ne,T=T||[];var j=[],H=0,Z=R(L);k(T,function(J,le,pe){var ce=H++;Z(J,function(Ae,Ge){j[ce]=Ge,pe(Ae)})},function(J){P(J,j)})}var $c=Go(Zu),Qu=U($c);function oi(k){return function(T,L,P,j){return k(ul(L),T,R(P),j)}}var wr=oi(Zu),Yu=Nt(wr,1),Ju=U(Yu);function rs(k,T){for(var L=-1,P=k==null?0:k.length;++L<P&&T(k[L],L,k)!==!1;);return k}function Ku(k){return function(T,L,P){for(var j=-1,H=Object(T),Z=P(T),J=Z.length;J--;){var le=Z[k?J:++j];if(L(H[le],le,H)===!1)break}return T}}var is=Ku();function ss(k,T){return k&&is(k,T,Nc)}function s1(k,T,L,P){for(var j=k.length,H=L+(P?1:-1);P?H--:++H<j;)if(T(k[H],H,k))return H;return-1}function y5(k){return k!==k}function l1(k,T,L){for(var P=L-1,j=k.length;++P<j;)if(k[P]===T)return P;return-1}function dl(k,T,L){return T===T?l1(k,T,L):s1(k,y5,L)}var Hc=function(k,T,L){typeof T=="function"&&(L=T,T=null),L=yr(L||Ne);var P=Nc(k),j=P.length;if(!j)return L(null);T||(T=j);var H={},Z=0,J=!1,le=Object.create(null),pe=[],ce=[],Ae={};ss(k,function(ut,ot){if(!pt(ut)){Ge(ot,[ut]),ce.push(ot);return}var mt=ut.slice(0,ut.length-1),po=mt.length;if(po===0){Ge(ot,ut),ce.push(ot);return}Ae[ot]=po,rs(mt,function(E){if(!k[E])throw new Error("async.auto task `"+ot+"` has a non-existent dependency `"+E+"` in "+mt.join(", "));tn(E,function(){po--,po===0&&Ge(ot,ut)})})}),z5(),xt();function Ge(ut,ot){pe.push(function(){go(ut,ot)})}function xt(){if(pe.length===0&&Z===0)return L(null,H);for(;pe.length&&Z<T;){var ut=pe.shift();ut()}}function tn(ut,ot){var mt=le[ut];mt||(mt=le[ut]=[]),mt.push(ot)}function On(ut){var ot=le[ut]||[];rs(ot,function(mt){mt()}),xt()}function go(ut,ot){if(!J){var mt=mo(function(E,xr){if(Z--,arguments.length>2&&(xr=o(arguments,1)),E){var us={};ss(H,function(_n,Fe){us[Fe]=_n}),us[ut]=xr,J=!0,le=Object.create(null),L(E,us)}else H[ut]=xr,On(ut)});Z++;var po=R(ot[ot.length-1]);ot.length>1?po(H,mt):po(mt)}}function z5(){for(var ut,ot=0;ce.length;)ut=ce.pop(),ot++,rs(V5(ut),function(mt){--Ae[mt]===0&&ce.push(mt)});if(ot!==j)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function V5(ut){var ot=[];return ss(k,function(mt,po){pt(mt)&&dl(mt,ut,0)>=0&&ot.push(po)}),ot}};function ri(k,T){for(var L=-1,P=k==null?0:k.length,j=Array(P);++L<P;)j[L]=T(k[L],L,k);return j}var k5="[object Symbol]";function w5(k){return typeof k=="symbol"||un(k)&&vr(k)==k5}var B5=1/0,Xu=me?me.prototype:void 0,c1=Xu?Xu.toString:void 0;function ed(k){if(typeof k=="string")return k;if(pt(k))return ri(k,ed)+"";if(w5(k))return c1?c1.call(k):"";var T=k+"";return T=="0"&&1/k==-B5?"-0":T}function E5(k,T,L){var P=-1,j=k.length;T<0&&(T=-T>j?0:j+T),L=L>j?j:L,L<0&&(L+=j),j=T>L?0:L-T>>>0,T>>>=0;for(var H=Array(j);++P<j;)H[P]=k[P+T];return H}function x5(k,T,L){var P=k.length;return L=L===void 0?P:L,!T&&L>=P?k:E5(k,T,L)}function td(k,T){for(var L=k.length;L--&&dl(T,k[L],0)>-1;);return L}function I5(k,T){for(var L=-1,P=k.length;++L<P&&dl(T,k[L],0)>-1;);return L}function T5(k){return k.split("")}var D5="\\ud800-\\udfff",S5="\\u0300-\\u036f",L5="\\ufe20-\\ufe2f",st="\\u20d0-\\u20ff",nt=S5+L5+st,M5="\\ufe0e\\ufe0f",R5="\\u200d",O5=RegExp("["+R5+D5+nt+M5+"]");function _5(k){return O5.test(k)}var a1="\\ud800-\\udfff",P5="\\u0300-\\u036f",u1="\\ufe20-\\ufe2f",F5="\\u20d0-\\u20ff",Wt=P5+u1+F5,nd="\\ufe0e\\ufe0f",ii="["+a1+"]",jc="["+Wt+"]",hl="\\ud83c[\\udffb-\\udfff]",Mn="(?:"+jc+"|"+hl+")",od="[^"+a1+"]",rd="(?:\\ud83c[\\udde6-\\uddff]){2}",id="[\\ud800-\\udbff][\\udc00-\\udfff]",d1="\\u200d",sd=Mn+"?",ld="["+nd+"]?",vn="(?:"+d1+"(?:"+[od,rd,id].join("|")+")"+ld+sd+")*",N5=ld+sd+vn,Rn="(?:"+[od+jc+"?",jc,rd,id,ii].join("|")+")",$5=RegExp(hl+"(?="+hl+")|"+Rn+N5,"g");function h1(k){return k.match($5)||[]}function Zo(k){return _5(k)?h1(k):T5(k)}function Uc(k){return k==null?"":ed(k)}var cd=/^\s+|\s+$/g;function at(k,T,L){if(k=Uc(k),k&&(L||T===void 0))return k.replace(cd,"");if(!k||!(T=ed(T)))return k;var P=Zo(k),j=Zo(T),H=I5(P,j),Z=td(P,j)+1;return x5(P,H,Z).join("")}var Br=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ad=/,/,H5=/(=.+)?(\s*)$/,ud=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;function j5(k){return k=k.toString().replace(ud,""),k=k.match(Br)[2].replace(" ",""),k=k?k.split(ad):[],k=k.map(function(T){return at(T.replace(H5,""))}),k}function f1(k,T){var L={};ss(k,function(P,j){var H,Z=_(P),J=!Z&&P.length===1||Z&&P.length===0;if(pt(P))H=P.slice(0,-1),P=P[P.length-1],L[j]=H.concat(H.length>0?le:P);else if(J)L[j]=P;else{if(H=j5(P),P.length===0&&!Z&&H.length===0)throw new Error("autoInject task functions require explicit parameters.");Z||H.pop(),L[j]=H.concat(le)}function le(pe,ce){var Ae=ri(H,function(Ge){return pe[Ge]});Ae.push(ce),R(P).apply(null,Ae)}}),Hc(L,T)}function Qn(){this.head=this.tail=null,this.length=0}function dd(k,T){k.length=1,k.head=k.tail=T}Qn.prototype.removeLink=function(k){return k.prev?k.prev.next=k.next:this.head=k.next,k.next?k.next.prev=k.prev:this.tail=k.prev,k.prev=k.next=null,this.length-=1,k},Qn.prototype.empty=function(){for(;this.head;)this.shift();return this},Qn.prototype.insertAfter=function(k,T){T.prev=k,T.next=k.next,k.next?k.next.prev=T:this.tail=T,k.next=T,this.length+=1},Qn.prototype.insertBefore=function(k,T){T.prev=k.prev,T.next=k,k.prev?k.prev.next=T:this.head=T,k.prev=T,this.length+=1},Qn.prototype.unshift=function(k){this.head?this.insertBefore(this.head,k):dd(this,k)},Qn.prototype.push=function(k){this.tail?this.insertAfter(this.tail,k):dd(this,k)},Qn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},Qn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},Qn.prototype.toArray=function(){for(var k=Array(this.length),T=this.head,L=0;L<this.length;L++)k[L]=T.data,T=T.next;return k},Qn.prototype.remove=function(k){for(var T=this.head;T;){var L=T.next;k(T)&&this.removeLink(T),T=L}return this};function fl(k,T,L){if(T==null)T=1;else if(T===0)throw new Error("Concurrency must not be zero");var P=R(k),j=0,H=[],Z=!1;function J(Ae,Ge,xt){if(xt!=null&&typeof xt!="function")throw new Error("task callback must be a function");if(ce.started=!0,pt(Ae)||(Ae=[Ae]),Ae.length===0&&ce.idle())return A(function(){ce.drain()});for(var tn=0,On=Ae.length;tn<On;tn++){var go={data:Ae[tn],callback:xt||Ne};Ge?ce._tasks.unshift(go):ce._tasks.push(go)}Z||(Z=!0,A(function(){Z=!1,ce.process()}))}function le(Ae){return function(Ge){j-=1;for(var xt=0,tn=Ae.length;xt<tn;xt++){var On=Ae[xt],go=dl(H,On,0);go===0?H.shift():go>0&&H.splice(go,1),On.callback.apply(On,arguments),Ge!=null&&ce.error(Ge,On.data)}j<=ce.concurrency-ce.buffer&&ce.unsaturated(),ce.idle()&&ce.drain(),ce.process()}}var pe=!1,ce={_tasks:new Qn,concurrency:T,payload:L,saturated:Ne,unsaturated:Ne,buffer:T/4,empty:Ne,drain:Ne,error:Ne,started:!1,paused:!1,push:function(Ae,Ge){J(Ae,!1,Ge)},kill:function(){ce.drain=Ne,ce._tasks.empty()},unshift:function(Ae,Ge){J(Ae,!0,Ge)},remove:function(Ae){ce._tasks.remove(Ae)},process:function(){if(!pe){for(pe=!0;!ce.paused&&j<ce.concurrency&&ce._tasks.length;){var Ae=[],Ge=[],xt=ce._tasks.length;ce.payload&&(xt=Math.min(xt,ce.payload));for(var tn=0;tn<xt;tn++){var On=ce._tasks.shift();Ae.push(On),H.push(On),Ge.push(On.data)}j+=1,ce._tasks.length===0&&ce.empty(),j===ce.concurrency&&ce.saturated();var go=mo(le(Ae));P(Ge,go)}pe=!1}},length:function(){return ce._tasks.length},running:function(){return j},workersList:function(){return H},idle:function(){return ce._tasks.length+j===0},pause:function(){ce.paused=!0},resume:function(){ce.paused!==!1&&(ce.paused=!1,A(ce.process))}};return ce}function si(k,T){return fl(k,1,T)}var ls=Nt(kr,1);function Qo(k,T,L,P){P=yr(P||Ne);var j=R(L);ls(k,function(H,Z,J){j(T,H,function(le,pe){T=pe,J(le)})},function(H){P(H,T)})}function zc(){var k=ri(arguments,R);return function(){var T=o(arguments),L=this,P=T[T.length-1];typeof P=="function"?T.pop():P=Ne,Qo(k,T,function(j,H,Z){H.apply(L,j.concat(function(J){var le=o(arguments,1);Z(J,le)}))},function(j,H){P.apply(L,[j].concat(H))})}}var Vc=function(){return zc.apply(null,o(arguments).reverse())},hd=Array.prototype.concat,ml=function(k,T,L,P){P=P||Ne;var j=R(L);wr(k,T,function(H,Z){j(H,function(J){return J?Z(J):Z(null,o(arguments,1))})},function(H,Z){for(var J=[],le=0;le<Z.length;le++)Z[le]&&(J=hd.apply(J,Z[le]));return P(H,J)})},m1=Nt(ml,1/0),Wc=Nt(ml,1),qc=function(){var k=o(arguments),T=[null].concat(k);return function(){var L=arguments[arguments.length-1];return L.apply(this,T)}};function gl(k){return k}function li(k,T){return function(L,P,j,H){H=H||Ne;var Z=!1,J;L(P,function(le,pe,ce){j(le,function(Ae,Ge){Ae?ce(Ae):k(Ge)&&!J?(Z=!0,J=T(!0,le),ce(null,ni)):ce()})},function(le){le?H(le):H(null,Z?J:T(!1))})}}function dn(k,T){return T}var cs=Go(li(gl,dn)),Yo=oi(li(gl,dn)),pl=Nt(Yo,1);function fd(k){return function(T){var L=o(arguments,1);L.push(function(P){var j=o(arguments,1);typeof console=="object"&&(P?console.error&&console.error(P):console[k]&&rs(j,function(H){console[k](H)}))}),R(T).apply(null,L)}}var g1=fd("dir");function p1(k,T,L){L=mo(L||Ne);var P=R(k),j=R(T);function H(J){if(J)return L(J);var le=o(arguments,1);le.push(Z),j.apply(this,le)}function Z(J,le){if(J)return L(J);if(!le)return L(null);P(H)}Z(null,!0)}function md(k,T,L){L=mo(L||Ne);var P=R(k),j=function(H){if(H)return L(H);var Z=o(arguments,1);if(T.apply(this,Z))return P(j);L.apply(null,[null].concat(Z))};P(j)}function C1(k,T,L){md(k,function(){return!T.apply(this,arguments)},L)}function A1(k,T,L){L=mo(L||Ne);var P=R(T),j=R(k);function H(J){if(J)return L(J);j(Z)}function Z(J,le){if(J)return L(J);if(!le)return L(null);P(H)}j(Z)}function ci(k){return function(T,L,P){return k(T,P)}}function Gc(k,T,L){qo(k,ci(R(T)),L)}function Cl(k,T,L,P){ul(T)(k,ci(R(L)),P)}var ai=Nt(Cl,1);function Zc(k){return _(k)?k:i(function(T,L){var P=!0;T.push(function(){var j=arguments;P?A(function(){L.apply(null,j)}):L.apply(null,j)}),k.apply(this,T),P=!1})}function Yn(k){return!k}var ui=Go(li(Yn,Yn)),Al=oi(li(Yn,Yn)),Qc=Nt(Al,1);function b1(k){return function(T){return T==null?void 0:T[k]}}function as(k,T,L,P){var j=new Array(T.length);k(T,function(H,Z,J){L(H,function(le,pe){j[Z]=!!pe,J(le)})},function(H){if(H)return P(H);for(var Z=[],J=0;J<T.length;J++)j[J]&&Z.push(T[J]);P(null,Z)})}function Jn(k,T,L,P){var j=[];k(T,function(H,Z,J){L(H,function(le,pe){le?J(le):(pe&&j.push({index:Z,value:H}),J())})},function(H){H?P(H):P(null,ri(j.sort(function(Z,J){return Z.index-J.index}),b1("value")))})}function Yc(k,T,L,P){var j=nl(T)?as:Jn;j(k,T,R(L),P||Ne)}var Jc=Go(Yc),bl=oi(Yc),Kc=Nt(bl,1);function v1(k,T){var L=mo(T||Ne),P=R(Zc(k));function j(H){if(H)return L(H);P(j)}j()}var Xc=function(k,T,L,P){P=P||Ne;var j=R(L);wr(k,T,function(H,Z){j(H,function(J,le){return J?Z(J):Z(null,{key:le,val:H})})},function(H,Z){for(var J={},le=Object.prototype.hasOwnProperty,pe=0;pe<Z.length;pe++)if(Z[pe]){var ce=Z[pe].key,Ae=Z[pe].val;le.call(J,ce)?J[ce].push(Ae):J[ce]=[Ae]}return P(H,J)})},di=Nt(Xc,1/0),N=Nt(Xc,1),G=fd("log");function V(k,T,L,P){P=yr(P||Ne);var j={},H=R(L);kr(k,T,function(Z,J,le){H(Z,J,function(pe,ce){if(pe)return le(pe);j[J]=ce,le()})},function(Z){P(Z,j)})}var he=Nt(V,1/0),Ee=Nt(V,1);function Ve(k,T){return T in k}function yt(k,T){var L=Object.create(null),P=Object.create(null);T=T||gl;var j=R(k),H=i(function(J,le){var pe=T.apply(null,J);Ve(L,pe)?A(function(){le.apply(null,L[pe])}):Ve(P,pe)?P[pe].push(le):(P[pe]=[le],j.apply(null,J.concat(function(){var ce=o(arguments);L[pe]=ce;var Ae=P[pe];delete P[pe];for(var Ge=0,xt=Ae.length;Ge<xt;Ge++)Ae[Ge].apply(null,ce)})))});return H.memo=L,H.unmemoized=k,H}var qe;a?qe=process.nextTick:l?qe=setImmediate:qe=d;var ea=f(qe);function gd(k,T,L){L=L||Ne;var P=nl(T)?[]:{};k(T,function(j,H,Z){R(j)(function(J,le){arguments.length>2&&(le=o(arguments,1)),P[H]=le,Z(J)})},function(j){L(j,P)})}function yn(k,T){gd(qo,k,T)}function vl(k,T,L){gd(ul(T),k,L)}var pd=function(k,T){var L=R(k);return fl(function(P,j){L(P[0],j)},T,1)},hi=function(k,T){var L=pd(k,T);return L.push=function(P,j,H){if(H==null&&(H=Ne),typeof H!="function")throw new Error("task callback must be a function");if(L.started=!0,pt(P)||(P=[P]),P.length===0)return A(function(){L.drain()});j=j||0;for(var Z=L._tasks.head;Z&&j>=Z.priority;)Z=Z.next;for(var J=0,le=P.length;J<le;J++){var pe={data:P[J],priority:j,callback:H};Z?L._tasks.insertBefore(Z,pe):L._tasks.push(pe)}A(L.process)},delete L.unshift,L};function yl(k,T){if(T=yr(T||Ne),!pt(k))return T(new TypeError("First argument to race must be an array of functions"));if(!k.length)return T();for(var L=0,P=k.length;L<P;L++)R(k[L])(T)}function fi(k,T,L,P){var j=o(k).reverse();Qo(j,T,L,P)}function We(k){var T=R(k);return i(function(P,j){return P.push(function(Z,J){if(Z)j(null,{error:Z});else{var le;arguments.length<=2?le=J:le=o(arguments,1),j(null,{value:le})}}),T.apply(this,P)})}function y1(k){var T;return pt(k)?T=ri(k,We):(T={},ss(k,function(L,P){T[P]=We.call(this,L)})),T}function Cd(k,T,L,P){Yc(k,T,function(j,H){L(j,function(Z,J){H(Z,!J)})},P)}var kl=Go(Cd),Ad=oi(Cd),k1=Nt(Ad,1);function w1(k){return function(){return k}}function mi(k,T,L){var P=5,j=0,H={times:P,intervalFunc:w1(j)};function Z(ce,Ae){if(typeof Ae=="object")ce.times=+Ae.times||P,ce.intervalFunc=typeof Ae.interval=="function"?Ae.interval:w1(+Ae.interval||j),ce.errorFilter=Ae.errorFilter;else if(typeof Ae=="number"||typeof Ae=="string")ce.times=+Ae||P;else throw new Error("Invalid arguments for async.retry")}if(arguments.length<3&&typeof k=="function"?(L=T||Ne,T=k):(Z(H,k),L=L||Ne),typeof T!="function")throw new Error("Invalid arguments for async.retry");var J=R(T),le=1;function pe(){J(function(ce){ce&&le++<H.times&&(typeof H.errorFilter!="function"||H.errorFilter(ce))?setTimeout(pe,H.intervalFunc(le)):L.apply(null,arguments)})}pe()}var Jo=function(k,T){T||(T=k,k=null);var L=R(T);return i(function(P,j){function H(Z){L.apply(null,P.concat(Z))}k?mi(k,H,j):mi(H,j)})};function wl(k,T){gd(ls,k,T)}var Bl=Go(li(Boolean,gl)),Er=oi(li(Boolean,gl)),El=Nt(Er,1);function bd(k,T,L){var P=R(T);$c(k,function(H,Z){P(H,function(J,le){if(J)return Z(J);Z(null,{value:H,criteria:le})})},function(H,Z){if(H)return L(H);L(null,ri(Z.sort(j),b1("value")))});function j(H,Z){var J=H.criteria,le=Z.criteria;return J<le?-1:J>le?1:0}}function xl(k,T,L){var P=R(k);return i(function(j,H){var Z=!1,J;function le(){var pe=k.name||"anonymous",ce=new Error('Callback function "'+pe+'" timed out.');ce.code="ETIMEDOUT",L&&(ce.info=L),Z=!0,H(ce)}j.push(function(){Z||(H.apply(null,arguments),clearTimeout(J))}),J=setTimeout(le,T),P.apply(null,j)})}var B1=Math.ceil,Il=Math.max;function gi(k,T,L,P){for(var j=-1,H=Il(B1((T-k)/(L||1)),0),Z=Array(H);H--;)Z[P?H:++j]=k,k+=L;return Z}function pi(k,T,L,P){var j=R(L);wr(gi(0,k,1),T,j,P)}var E1=Nt(pi,1/0),x1=Nt(pi,1);function I1(k,T,L,P){arguments.length<=3&&(P=L,L=T,T=pt(k)?[]:{}),P=yr(P||Ne);var j=R(L);qo(k,function(H,Z,J){j(T,H,Z,J)},function(H){P(H,T)})}function Tl(k,T){var L=null,P;T=T||Ne,ai(k,function(j,H){R(j)(function(Z,J){arguments.length>2?P=o(arguments,1):P=J,L=Z,H(!Z)})},function(){T(L,P)})}function Dl(k){return function(){return(k.unmemoized||k).apply(null,arguments)}}function Sl(k,T,L){L=mo(L||Ne);var P=R(T);if(!k())return L(null);var j=function(H){if(H)return L(H);if(k())return P(j);var Z=o(arguments,1);L.apply(null,[null].concat(Z))};P(j)}function T1(k,T,L){Sl(function(){return!k.apply(this,arguments)},T,L)}var vd=function(k,T){if(T=yr(T||Ne),!pt(k))return T(new Error("First argument to waterfall must be an array of functions"));if(!k.length)return T();var L=0;function P(H){var Z=R(k[L++]);H.push(mo(j)),Z.apply(null,H)}function j(H){if(H||L===k.length)return T.apply(null,arguments);P(o(arguments,1))}P([])},U5={apply:r,applyEach:Qu,applyEachSeries:Ju,asyncify:v,auto:Hc,autoInject:f1,cargo:si,compose:Vc,concat:m1,concatLimit:ml,concatSeries:Wc,constant:qc,detect:cs,detectLimit:Yo,detectSeries:pl,dir:g1,doDuring:p1,doUntil:C1,doWhilst:md,during:A1,each:Gc,eachLimit:Cl,eachOf:qo,eachOfLimit:kr,eachOfSeries:ls,eachSeries:ai,ensureAsync:Zc,every:ui,everyLimit:Al,everySeries:Qc,filter:Jc,filterLimit:bl,filterSeries:Kc,forever:v1,groupBy:di,groupByLimit:Xc,groupBySeries:N,log:G,map:$c,mapLimit:wr,mapSeries:Yu,mapValues:he,mapValuesLimit:V,mapValuesSeries:Ee,memoize:yt,nextTick:ea,parallel:yn,parallelLimit:vl,priorityQueue:hi,queue:pd,race:yl,reduce:Qo,reduceRight:fi,reflect:We,reflectAll:y1,reject:kl,rejectLimit:Ad,rejectSeries:k1,retry:mi,retryable:Jo,seq:zc,series:wl,setImmediate:A,some:Bl,someLimit:Er,someSeries:El,sortBy:bd,timeout:xl,times:E1,timesLimit:pi,timesSeries:x1,transform:I1,tryEach:Tl,unmemoize:Dl,until:T1,waterfall:vd,whilst:Sl,all:ui,allLimit:Al,allSeries:Qc,any:Bl,anyLimit:Er,anySeries:El,find:cs,findLimit:Yo,findSeries:pl,forEach:Gc,forEachSeries:ai,forEachLimit:Cl,forEachOf:qo,forEachOfSeries:ls,forEachOfLimit:kr,inject:Qo,foldl:Qo,foldr:fi,select:Jc,selectLimit:bl,selectSeries:Kc,wrapSync:v};t.default=U5,t.apply=r,t.applyEach=Qu,t.applyEachSeries=Ju,t.asyncify=v,t.auto=Hc,t.autoInject=f1,t.cargo=si,t.compose=Vc,t.concat=m1,t.concatLimit=ml,t.concatSeries=Wc,t.constant=qc,t.detect=cs,t.detectLimit=Yo,t.detectSeries=pl,t.dir=g1,t.doDuring=p1,t.doUntil=C1,t.doWhilst=md,t.during=A1,t.each=Gc,t.eachLimit=Cl,t.eachOf=qo,t.eachOfLimit=kr,t.eachOfSeries=ls,t.eachSeries=ai,t.ensureAsync=Zc,t.every=ui,t.everyLimit=Al,t.everySeries=Qc,t.filter=Jc,t.filterLimit=bl,t.filterSeries=Kc,t.forever=v1,t.groupBy=di,t.groupByLimit=Xc,t.groupBySeries=N,t.log=G,t.map=$c,t.mapLimit=wr,t.mapSeries=Yu,t.mapValues=he,t.mapValuesLimit=V,t.mapValuesSeries=Ee,t.memoize=yt,t.nextTick=ea,t.parallel=yn,t.parallelLimit=vl,t.priorityQueue=hi,t.queue=pd,t.race=yl,t.reduce=Qo,t.reduceRight=fi,t.reflect=We,t.reflectAll=y1,t.reject=kl,t.rejectLimit=Ad,t.rejectSeries=k1,t.retry=mi,t.retryable=Jo,t.seq=zc,t.series=wl,t.setImmediate=A,t.some=Bl,t.someLimit=Er,t.someSeries=El,t.sortBy=bd,t.timeout=xl,t.times=E1,t.timesLimit=pi,t.timesSeries=x1,t.transform=I1,t.tryEach=Tl,t.unmemoize=Dl,t.until=T1,t.waterfall=vd,t.whilst=Sl,t.all=ui,t.allLimit=Al,t.allSeries=Qc,t.any=Bl,t.anyLimit=Er,t.anySeries=El,t.find=cs,t.findLimit=Yo,t.findSeries=pl,t.forEach=Gc,t.forEachSeries=ai,t.forEachLimit=Cl,t.forEachOf=qo,t.forEachOfSeries=ls,t.forEachOfLimit=kr,t.inject=Qo,t.foldl=Qo,t.foldr=fi,t.select=Jc,t.selectLimit=bl,t.selectSeries=Kc,t.wrapSync=v,Object.defineProperty(t,"__esModule",{value:!0})})})(Jg,Jg.exports);var f7={exports:{}},Kg=f7.exports=function(n,e){if(e||(e=16),n===void 0&&(n=128),n<=0)return"0";for(var t=Math.log(Math.pow(2,n))/Math.log(e),o=2;t===1/0;o*=2)t=Math.log(Math.pow(2,n/o))/Math.log(e)*o;for(var r=t-Math.floor(t),i="",o=0;o<Math.floor(t);o++){var s=Math.floor(Math.random()*e).toString(e);i=s+i}if(r){var l=Math.pow(e,r),s=Math.floor(Math.random()*l).toString(e);i=s+i}var a=parseInt(i,e);return a!==1/0&&a>=Math.pow(2,n)?Kg(n,e):i};Kg.rack=function(n,e,t){var o=function(i){var s=0;do{if(s++>10)if(t)n+=t;else throw new Error("too many ID collisions, use more bits");var l=Kg(n,e)}while(Object.hasOwnProperty.call(r,l));return r[l]=i,l},r=o.hats={};return o.get=function(i){return o.hats[i]},o.set=function(i,s){return o.hats[i]=s,o},o.bits=n||128,o.base=e||16,o};var m7=$i,JD=d7,KD=h7,Rh=_o,Xg=Jg.exports,XD=f7.exports,g7=Hs.ACTIONS,p7=Mt;function Mt(n,e){if(m7.EventEmitter.call(this),!e||typeof e!="string")throw new Error("Presence channel must be provided");this.connection=n,this.channel=e,this.wantSubscribe=!1,this.subscribed=!1,this.remotePresences={},this.localPresences={},this._remotePresenceInstances={},this._subscriptionCallbacksBySeq={},this._wantsDestroy=!1}m7.mixin(Mt),Mt.prototype.subscribe=function(n){this._sendSubscriptionAction(!0,n)},Mt.prototype.unsubscribe=function(n){this._sendSubscriptionAction(!1,n)},Mt.prototype.create=function(n){if(this._wantsDestroy)throw new Error("Presence is being destroyed");n=n||XD();var e=this._createLocalPresence(n);return this.localPresences[n]=e,e},Mt.prototype.destroy=function(n){this._wantsDestroy=!0;var e=this,t=Object.keys(e.localPresences);this.unsubscribe(function(o){if(o)return e._callbackOrEmit(o,n);var r=Object.keys(e._remotePresenceInstances);Xg.parallel([function(i){Xg.each(t,function(s,l){e.localPresences[s].destroy(l)},i)},function(i){if(!e._wantsDestroy)return i();Xg.each(r,function(s,l){e._remotePresenceInstances[s].destroy(l)},i)}],function(i){e._wantsDestroy&&delete e.connection._presences[e.channel],e._callbackOrEmit(i,n)})})},Mt.prototype._sendSubscriptionAction=function(n,e){this.wantSubscribe=!!n;var t=this.wantSubscribe?g7.presenceSubscribe:g7.presenceUnsubscribe,o=this.connection._presenceSeq++;this._subscriptionCallbacksBySeq[o]=e,this.connection.canSend&&this.connection._sendPresenceAction(t,o,this)},Mt.prototype._handleSubscribe=function(n,e){this.wantSubscribe&&(this.subscribed=!0);var t=this._subscriptionCallback(e);this._callbackOrEmit(n,t)},Mt.prototype._handleUnsubscribe=function(n,e){this.subscribed=!1;var t=this._subscriptionCallback(e);this._callbackOrEmit(n,t)},Mt.prototype._receiveUpdate=function(n,e){var t=Rh.dig(this.localPresences,e.id);if(t)return t._ack(n,e.pv);if(n)return this.emit("error",n);var o=this,r=Rh.digOrCreate(this._remotePresenceInstances,e.id,function(){return o._createRemotePresence(e.id)});r.receiveUpdate(e)},Mt.prototype._updateRemotePresence=function(n){this.remotePresences[n.presenceId]=n.value,n.value===null&&this._removeRemotePresence(n.presenceId),this.emit("receive",n.presenceId,n.value)},Mt.prototype._broadcastAllLocalPresence=function(n){if(n)return this.emit("error",n);for(var e in this.localPresences){var t=this.localPresences[e];t.value!==null&&t.send()}},Mt.prototype._removeRemotePresence=function(n){this._remotePresenceInstances[n].destroy(),delete this._remotePresenceInstances[n],delete this.remotePresences[n]},Mt.prototype._onConnectionStateChanged=function(){if(!!this.connection.canSend){this._resubscribe();for(var n in this.localPresences)this.localPresences[n]._sendPending()}},Mt.prototype._resubscribe=function(){var n=[];for(var e in this._subscriptionCallbacksBySeq){var t=this._subscriptionCallback(e);n.push(t)}if(!this.wantSubscribe)return this._callEachOrEmit(n);var o=this;this.subscribe(function(r){o._callEachOrEmit(n,r)})},Mt.prototype._subscriptionCallback=function(n){var e=this._subscriptionCallbacksBySeq[n];return delete this._subscriptionCallbacksBySeq[n],e},Mt.prototype._callbackOrEmit=function(n,e){if(e)return Rh.nextTick(e,n);n&&this.emit("error",n)},Mt.prototype._createLocalPresence=function(n){return new JD(this,n)},Mt.prototype._createRemotePresence=function(n){return new KD(this,n)},Mt.prototype._callEachOrEmit=function(n,e){var t=Rh.callEach(n,e);!t&&e&&this.emit("error",e)};var Ua=d7,C7=Th,eS=_o,A7=C7.CODES,tS=Fo;function Fo(n,e){Ua.call(this,n,e),this.collection=this.presence.collection,this.id=this.presence.id,this._doc=this.connection.get(this.collection,this.id),this._isSending=!1,this._docDataVersionByPresenceVersion={},this._opHandler=this._transformAgainstOp.bind(this),this._createOrDelHandler=this._handleCreateOrDel.bind(this),this._loadHandler=this._handleLoad.bind(this),this._destroyHandler=this.destroy.bind(this),this._registerWithDoc()}Fo.prototype=Object.create(Ua.prototype),Fo.prototype.submit=function(n,e){if(!this._doc.type){if(n===null)return this._callbackOrEmit(null,e);var t={code:A7.ERR_DOC_DOES_NOT_EXIST,message:"Cannot submit presence. Document has not been created"};return this._callbackOrEmit(t,e)}this._docDataVersionByPresenceVersion[this.presenceVersion]=this._doc._dataStateVersion,Ua.prototype.submit.call(this,n,e)},Fo.prototype.destroy=function(n){this._doc.removeListener("op",this._opHandler),this._doc.removeListener("create",this._createOrDelHandler),this._doc.removeListener("del",this._createOrDelHandler),this._doc.removeListener("load",this._loadHandler),this._doc.removeListener("destroy",this._destroyHandler),Ua.prototype.destroy.call(this,n)},Fo.prototype._sendPending=function(){if(!this._isSending){this._isSending=!0;var n=this;this._doc.whenNothingPending(function(){n._isSending=!1,n.connection.canSend&&(n._pendingMessages.forEach(function(e){e.t=n._doc.type.uri,e.v=n._doc.version,n.connection.send(e)}),n._pendingMessages=[],n._docDataVersionByPresenceVersion={})})}},Fo.prototype._registerWithDoc=function(){this._doc.on("op",this._opHandler),this._doc.on("create",this._createOrDelHandler),this._doc.on("del",this._createOrDelHandler),this._doc.on("load",this._loadHandler),this._doc.on("destroy",this._destroyHandler)},Fo.prototype._transformAgainstOp=function(n,e){var t=this,o=this._doc._dataStateVersion;this._pendingMessages.forEach(function(r){var i=t._docDataVersionByPresenceVersion[r.pv];if(!(i>=o))try{r.p=t._transformPresence(r.p,n,e),t._docDataVersionByPresenceVersion[r.pv]=o}catch(l){var s=t._getCallback(r.pv);t._callbackOrEmit(l,s)}});try{this.value=this._transformPresence(this.value,n,e)}catch(r){this.emit("error",r)}},Fo.prototype._handleCreateOrDel=function(){this._pendingMessages.forEach(function(n){n.p=null}),this.value=null},Fo.prototype._handleLoad=function(){this.value=null,this._pendingMessages=[],this._docDataVersionByPresenceVersion={}},Fo.prototype._message=function(){var n=Ua.prototype._message.call(this);return n.c=this.collection,n.d=this.id,n.v=null,n.t=null,n},Fo.prototype._transformPresence=function(n,e,t){var o=this._doc.type;if(!eS.supportsPresence(o))throw new C7(A7.ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE,"Type does not support presence: "+o.name);return o.transformPresence(n,e,t)};var b7={};(function(n){var e=$a,t=Th,o=_o,r=t.CODES;n.checkOp=function(l){if(l==null||typeof l!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"Op must be an object");if(l.create!=null){if(typeof l.create!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"Create data must be an object");var a=l.create.type;if(typeof a!="string")return new t(r.ERR_OT_OP_BADLY_FORMED,"Missing create type");var d=e.map[a];if(d==null||typeof d!="object")return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type")}else if(l.del!=null){if(l.del!==!0)return new t(r.ERR_OT_OP_BADLY_FORMED,"del value must be true")}else if(!("op"in l))return new t(r.ERR_OT_OP_BADLY_FORMED,"Missing op, create, or del");if(l.src!=null&&typeof l.src!="string")return new t(r.ERR_OT_OP_BADLY_FORMED,"src must be a string");if(l.seq!=null&&typeof l.seq!="number")return new t(r.ERR_OT_OP_BADLY_FORMED,"seq must be a number");if(l.src==null&&l.seq!=null||l.src!=null&&l.seq==null)return new t(r.ERR_OT_OP_BADLY_FORMED,"Both src and seq must be set together");if(l.m!=null&&typeof l.m!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"op.m must be an object or null")},n.normalizeType=function(l){return e.map[l]&&e.map[l].uri},n.apply=function(l,a){if(typeof l!="object")return new t(r.ERR_APPLY_SNAPSHOT_NOT_PROVIDED,"Missing snapshot");if(l.v!=null&&a.v!=null&&l.v!==a.v)return new t(r.ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT,"Version mismatch");if(a.create){if(l.type)return new t(r.ERR_DOC_ALREADY_CREATED,"Document already exists");var d=a.create,f=e.map[d.type];if(!f)return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{l.data=f.create(d.data),l.type=f.uri,l.v++}catch(A){return A}}else if(a.del)l.data=void 0,l.type=null,l.v++;else if("op"in a){var p=i(l,a.op);if(p)return p;l.v++}else l.v++};function i(l,a){if(!l.type)return new t(r.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");if(a===void 0)return new t(r.ERR_OT_OP_NOT_PROVIDED,"Missing op");var d=e.map[l.type];if(!d)return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{l.data=d.apply(l.data,a)}catch(f){return new t(r.ERR_OT_OP_NOT_APPLIED,f.message)}}n.transform=function(l,a,d){if(a.v!=null&&a.v!==d.v)return new t(r.ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM,"Version mismatch");if(d.del){if(a.create||"op"in a)return new t(r.ERR_DOC_WAS_DELETED,"Document was deleted")}else{if(d.create&&("op"in a||a.create||a.del)||"op"in d&&a.create)return new t(r.ERR_DOC_ALREADY_CREATED,"Document was created remotely");if("op"in d&&"op"in a){if(!l)return new t(r.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");if(typeof l=="string"&&(l=e.map[l],!l))return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{a.op=l.transform(a.op,d.op,"left")}catch(f){return f}}}a.v!=null&&a.v++},n.applyOps=function(l,a,d){d=d||{};for(var f=0;f<a.length;f++){var p=a[f];if(d._normalizeLegacyJson0Ops)try{s(l,p)}catch{return new t(r.ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED,"Cannot normalize legacy json0 op")}l.v=p.v;var A=n.apply(l,p);if(A)return A}},n.transformPresence=function(l,a,d){var f=this.checkOp(a);if(f)return f;var p=l.t;if(typeof p=="string"&&(p=e.map[p]),!p)return{code:r.ERR_DOC_TYPE_NOT_RECOGNIZED,message:"Unknown type"};if(!o.supportsPresence(p))return{code:r.ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE,message:"Type does not support presence"};if(a.create||a.del){l.p=null,l.v++;return}try{l.p=l.p===null?null:p.transformPresence(l.p,a.op,d)}catch(A){return{code:r.ERR_PRESENCE_TRANSFORM_FAILED,message:A.message||A}}l.v++};function s(l,a){if(l.type===e.defaultType.uri){var d=a.op;if(!!d){var f=l.data;d.length>1&&(f=o.clone(f));for(var p=0;p<d.length;p++){var A=d[p];typeof A.lm=="string"&&(A.lm=+A.lm);for(var v=A.p,B=f,D=0;D<v.length;D++){var I=v[D];Object.prototype.toString.call(B)=="[object Array]"?v[D]=+I:B.constructor===Object&&(v[D]=I.toString()),B=B[I]}p<d.length-1&&(f=e.defaultType.apply(f,[A]))}}}}})(b7);var za=h7,nS=b7,oS=so;function so(n,e){za.call(this,n,e),this.collection=this.presence.collection,this.id=this.presence.id,this.src=null,this.presenceVersion=null,this._doc=this.connection.get(this.collection,this.id),this._pending=null,this._opCache=null,this._pendingSetPending=!1,this._opHandler=this._handleOp.bind(this),this._createDelHandler=this._handleCreateDel.bind(this),this._loadHandler=this._handleLoad.bind(this),this._registerWithDoc()}so.prototype=Object.create(za.prototype),so.prototype.receiveUpdate=function(n){this._pending&&n.pv<this._pending.pv||(this.src=n.src,this._pending=n,this._setPendingPresence())},so.prototype.destroy=function(n){this._doc.removeListener("op",this._opHandler),this._doc.removeListener("create",this._createDelHandler),this._doc.removeListener("del",this._createDelHandler),this._doc.removeListener("load",this._loadHandler),za.prototype.destroy.call(this,n)},so.prototype._registerWithDoc=function(){this._doc.on("op",this._opHandler),this._doc.on("create",this._createDelHandler),this._doc.on("del",this._createDelHandler),this._doc.on("load",this._loadHandler)},so.prototype._setPendingPresence=function(){if(!this._pendingSetPending){this._pendingSetPending=!0;var n=this;this._doc.whenNothingPending(function(){if(n._pendingSetPending=!1,!!n._pending){if(n._pending.pv<n.presenceVersion)return n._pending=null;if(n._pending.v>n._doc.version)return n._doc.fetch();!n._catchUpStalePresence()||(n.value=n._pending.p,n.presenceVersion=n._pending.pv,n._pending=null,n.presence._updateRemotePresence(n))}})}},so.prototype._handleOp=function(n,e,t){var o=t===this.src;this._transformAgainstOp(n,o),this._cacheOp(n,o),this._setPendingPresence()},za.prototype._handleCreateDel=function(){this._cacheOp(null),this._setPendingPresence()},za.prototype._handleLoad=function(){this.value=null,this._pending=null,this._opCache=null,this.presence._updateRemotePresence(this)},so.prototype._transformAgainstOp=function(n,e){if(!!this.value){try{this.value=this._doc.type.transformPresence(this.value,n,e)}catch(t){return this.presence.emit("error",t)}this.presence._updateRemotePresence(this)}},so.prototype._catchUpStalePresence=function(){if(this._pending.v>=this._doc.version)return!0;if(!this._opCache)return this._startCachingOps(),this._doc.fetch(),this.presence.subscribe(),!1;for(;this._opCache[this._pending.v];){var n=this._opCache[this._pending.v],e=n.op,t=n.isOwnOp;e===null?(this._pending.p=null,this._pending.v++):nS.transformPresence(this._pending,e,t)}var o=this._pending.v>=this._doc.version;return o&&this._stopCachingOps(),o},so.prototype._startCachingOps=function(){this._opCache=[]},so.prototype._stopCachingOps=function(){this._opCache=null},so.prototype._cacheOp=function(n,e){this._opCache&&(n=n?{op:n}:null,this._opCache[this._doc.version-1]={op:n,isOwnOp:e})};var v7=p7,rS=tS,iS=oS;function Kl(n,e,t){var o=Kl.channel(e,t);v7.call(this,n,o),this.collection=e,this.id=t}var sS=Kl;Kl.prototype=Object.create(v7.prototype),Kl.channel=function(n,e){return n+"."+e},Kl.prototype._createLocalPresence=function(n){return new rS(this,n)},Kl.prototype._createRemotePresence=function(n){return new iS(this,n)};var lS=cS;function cS(n,e,t,o,r){this.id=n,this.v=e,this.type=t,this.data=o,this.m=r}var aS=lS,y7=$i,k7=Va;function Va(n,e,t,o,r){if(y7.EventEmitter.call(this),typeof r!="function")throw new Error("Callback is required for SnapshotRequest");this.requestId=e,this.connection=n,this.id=o,this.collection=t,this.callback=r,this.sent=!1}y7.mixin(Va),Va.prototype.send=function(){!this.connection.canSend||(this.connection.send(this._message()),this.sent=!0)},Va.prototype._onConnectionStateChanged=function(){this.connection.canSend?this.sent||this.send():this.sent=!1},Va.prototype._handleResponse=function(n,e){if(this.emit("ready"),n)return this.callback(n);var t=e.meta?e.meta:null,o=new aS(this.id,e.v,e.type,e.data,t);this.callback(null,o)};var w7=k7,uS=_o,dS=Hs.ACTIONS,hS=ep;function ep(n,e,t,o,r,i){if(w7.call(this,n,e,t,o,i),!uS.isValidVersion(r))throw new Error("Snapshot version must be a positive integer or null");this.version=r}ep.prototype=Object.create(w7.prototype),ep.prototype._message=function(){return{a:dS.snapshotFetch,id:this.requestId,c:this.collection,d:this.id,v:this.version}};var B7=k7,fS=_o,mS=Hs.ACTIONS,gS=tp;function tp(n,e,t,o,r,i){if(B7.call(this,n,e,t,o,i),!fS.isValidTimestamp(r))throw new Error("Snapshot timestamp must be a positive integer or null");this.timestamp=r}tp.prototype=Object.create(B7.prototype),tp.prototype._message=function(){return{a:mS.snapshotFetchByTimestamp,id:this.requestId,c:this.collection,d:this.id,ts:this.timestamp}};var pS=UD,CS=GD,AS=p7,E7=sS,bS=hS,vS=gS,x7=$i,Xl=Th,et=Hs.ACTIONS,I7=$a,No=_o,Wa=n7,qa=Xl.CODES;function T7(n){return n.readyState===0||n.readyState===1?"connecting":"disconnected"}var yS=we;function we(n){x7.EventEmitter.call(this),this.collections={},this.nextQueryId=1,this.nextSnapshotRequestId=1,this.queries={},this._presences={},this._snapshotRequests={},this.seq=1,this._presenceSeq=1,this.id=null,this.agent=null,this.debug=!1,this.state=T7(n),this.bindToSocket(n)}x7.mixin(we),we.prototype.bindToSocket=function(n){this.socket&&(this.socket.close(),this.socket.onmessage=null,this.socket.onopen=null,this.socket.onerror=null,this.socket.onclose=null),this.socket=n;var e=T7(n);this._setState(e),this.canSend=!1;var t=this;n.onmessage=function(o){try{var r=typeof o.data=="string"?JSON.parse(o.data):o.data}catch{Wa.warn("Failed to parse message",o);return}t.debug&&Wa.info("RECV",JSON.stringify(r));var i={data:r};if(t.emit("receive",i),!!i.data)try{t.handleMessage(i.data)}catch(s){No.nextTick(function(){t.emit("error",s)})}},n.readyState===1&&t._initializeHandshake(),n.onopen=function(){t._setState("connecting"),t._initializeHandshake()},n.onerror=function(o){t.emit("connection error",o)},n.onclose=function(o){o==="closed"||o==="Closed"?t._setState("closed",o):o==="stopped"||o==="Stopped by server"?t._setState("stopped",o):t._setState("disconnected",o)}},we.prototype.handleMessage=function(n){var e=null;switch(n.error&&(e=D7(n.error,n),delete n.error),n.a){case et.initLegacy:return this._handleLegacyInit(n);case et.handshake:return this._handleHandshake(e,n);case et.queryFetch:var t=this.queries[n.id];t&&t._handleFetch(e,n.data,n.extra);return;case et.querySubscribe:var t=this.queries[n.id];t&&t._handleSubscribe(e,n.data,n.extra);return;case et.queryUnsubscribe:return;case et.queryUpdate:var t=this.queries[n.id];if(!t)return;if(e)return t._handleError(e);n.diff&&t._handleDiff(n.diff),n.hasOwnProperty("extra")&&t._handleExtra(n.extra);return;case et.bulkFetch:return this._handleBulkMessage(e,n,"_handleFetch");case et.bulkSubscribe:case et.bulkUnsubscribe:return this._handleBulkMessage(e,n,"_handleSubscribe");case et.snapshotFetch:case et.snapshotFetchByTimestamp:return this._handleSnapshotFetch(e,n);case et.fetch:var o=this.getExisting(n.c,n.d);o&&o._handleFetch(e,n.data);return;case et.subscribe:case et.unsubscribe:var o=this.getExisting(n.c,n.d);o&&o._handleSubscribe(e,n.data);return;case et.op:var o=this.getExisting(n.c,n.d);o&&o._handleOp(e,n);return;case et.presence:return this._handlePresence(e,n);case et.presenceSubscribe:return this._handlePresenceSubscribe(e,n);case et.presenceUnsubscribe:return this._handlePresenceUnsubscribe(e,n);case et.presenceRequest:return this._handlePresenceRequest(e,n);case et.pingPong:return this._handlePingPong(e);default:Wa.warn("Ignoring unrecognized message",n)}};function D7(n,e){var t=new Error(n.message);return t.code=n.code,e&&(t.data=e),t}we.prototype._handleBulkMessage=function(n,e,t){if(e.data)for(var o in e.data){var r=e.data[o],i=this.getExisting(e.c,o);i&&(n?i[t](n):r.error?i[t](D7(r.error)):i[t](null,r))}else if(Array.isArray(e.b))for(var s=0;s<e.b.length;s++){var o=e.b[s],i=this.getExisting(e.c,o);i&&i[t](n)}else if(e.b)for(var o in e.b){var i=this.getExisting(e.c,o);i&&i[t](n)}else Wa.error("Invalid bulk message",e)},we.prototype._reset=function(){this.agent=null},we.prototype._setState=function(n,e){if(this.state!==n){if(n==="connecting"&&this.state!=="disconnected"&&this.state!=="stopped"&&this.state!=="closed"||n==="connected"&&this.state!=="connecting"){var t=new Xl(qa.ERR_CONNECTION_STATE_TRANSITION_INVALID,"Cannot transition directly from "+this.state+" to "+n);return this.emit("error",t)}this.state=n,this.canSend=n==="connected",(n==="disconnected"||n==="stopped"||n==="closed")&&this._reset(),this.startBulk();for(var o in this.queries){var r=this.queries[o];r._onConnectionStateChanged()}for(var i in this.collections){var s=this.collections[i];for(var o in s)s[o]._onConnectionStateChanged()}for(var l in this._presences)this._presences[l]._onConnectionStateChanged();for(var o in this._snapshotRequests){var a=this._snapshotRequests[o];a._onConnectionStateChanged()}this.endBulk(),this.emit(n,e),this.emit("state",n,e)}},we.prototype.startBulk=function(){this.bulk||(this.bulk={})},we.prototype.endBulk=function(){if(this.bulk)for(var n in this.bulk){var e=this.bulk[n];this._sendBulk("f",n,e.f),this._sendBulk("s",n,e.s),this._sendBulk("u",n,e.u)}this.bulk=null},we.prototype._sendBulk=function(n,e,t){if(!!t){var o=[],r={},i=0,s;for(var l in t){var a=t[l];a==null?o.push(l):(r[l]=a,s=l,i++)}if(o.length===1){var l=o[0];this.send({a:n,c:e,d:l})}else o.length&&this.send({a:"b"+n,c:e,b:o});if(i===1){var d=r[s];this.send({a:n,c:e,d:s,v:d})}else i&&this.send({a:"b"+n,c:e,b:r})}},we.prototype._sendActions=function(n,e,t){if(this._addDoc(e),this.bulk){var o=this.bulk[e.collection]||(this.bulk[e.collection]={}),r=o[n]||(o[n]={}),i=r.hasOwnProperty(e.id);return r[e.id]=t,i}else{var s={a:n,c:e.collection,d:e.id,v:t};this.send(s)}},we.prototype.sendFetch=function(n){return this._sendActions(et.fetch,n,n.version)},we.prototype.sendSubscribe=function(n){return this._sendActions(et.subscribe,n,n.version)},we.prototype.sendUnsubscribe=function(n){return this._sendActions(et.unsubscribe,n)},we.prototype.sendOp=function(n,e){this._addDoc(n);var t={a:et.op,c:n.collection,d:n.id,v:n.version,src:e.src,seq:e.seq,x:{}};"op"in e&&(t.op=e.op),e.create&&(t.create=e.create),e.del&&(t.del=e.del),n.submitSource&&(t.x.source=e.source),this.send(t)},we.prototype.send=function(n){this.debug&&Wa.info("SEND",JSON.stringify(n)),this.emit("send",n),this.socket.send(JSON.stringify(n))},we.prototype.ping=function(){if(!this.canSend)throw new Xl(qa.ERR_CANNOT_PING_OFFLINE,"Socket must be CONNECTED to ping");var n={a:et.pingPong};this.send(n)},we.prototype.close=function(){this.socket.close()},we.prototype.getExisting=function(n,e){if(this.collections[n])return this.collections[n][e]},we.prototype.get=function(n,e){var t=this.collections[n]||(this.collections[n]={}),o=t[e];return o||(o=t[e]=new pS(this,n,e),this.emit("doc",o)),o._wantsDestroy=!1,o},we.prototype._destroyDoc=function(n){!n._wantsDestroy||(No.digAndRemove(this.collections,n.collection,n.id),n.emit("destroy"))},we.prototype._addDoc=function(n){var e=this.collections[n.collection];e||(e=this.collections[n.collection]={}),e[n.id]!==n&&(e[n.id]=n)},we.prototype._createQuery=function(n,e,t,o,r){var i=this.nextQueryId++,s=new CS(n,this,i,e,t,o,r);return this.queries[i]=s,s.send(),s},we.prototype._destroyQuery=function(n){delete this.queries[n.id]},we.prototype.createFetchQuery=function(n,e,t,o){return this._createQuery(et.queryFetch,n,e,t,o)},we.prototype.createSubscribeQuery=function(n,e,t,o){return this._createQuery(et.querySubscribe,n,e,t,o)},we.prototype.hasPending=function(){return!!(this._firstDoc(Oh)||this._firstQuery(Oh)||this._firstSnapshotRequest())};function Oh(n){return n.hasPending()}we.prototype.hasWritePending=function(){return!!this._firstDoc(kS)};function kS(n){return n.hasWritePending()}we.prototype.whenNothingPending=function(n){var e=this._firstDoc(Oh);if(e){e.once("nothing pending",this._nothingPendingRetry(n));return}var t=this._firstQuery(Oh);if(t){t.once("ready",this._nothingPendingRetry(n));return}var o=this._firstSnapshotRequest();if(o){o.once("ready",this._nothingPendingRetry(n));return}No.nextTick(n)},we.prototype._nothingPendingRetry=function(n){var e=this;return function(){No.nextTick(function(){e.whenNothingPending(n)})}},we.prototype._firstDoc=function(n){for(var e in this.collections){var t=this.collections[e];for(var o in t){var r=t[o];if(n(r))return r}}},we.prototype._firstQuery=function(n){for(var e in this.queries){var t=this.queries[e];if(n(t))return t}},we.prototype._firstSnapshotRequest=function(){for(var n in this._snapshotRequests)return this._snapshotRequests[n]},we.prototype.fetchSnapshot=function(n,e,t,o){typeof t=="function"&&(o=t,t=null);var r=this.nextSnapshotRequestId++,i=new bS(this,r,n,e,t,o);this._snapshotRequests[i.requestId]=i,i.send()},we.prototype.fetchSnapshotByTimestamp=function(n,e,t,o){typeof t=="function"&&(o=t,t=null);var r=this.nextSnapshotRequestId++,i=new vS(this,r,n,e,t,o);this._snapshotRequests[i.requestId]=i,i.send()},we.prototype._handleSnapshotFetch=function(n,e){var t=this._snapshotRequests[e.id];!t||(delete this._snapshotRequests[e.id],t._handleResponse(n,e))},we.prototype._handleLegacyInit=function(n){if(n.protocolMinor)return this._initializeHandshake();this._initialize(n)},we.prototype._initializeHandshake=function(){this.send({a:et.handshake,id:this.id})},we.prototype._handleHandshake=function(n,e){if(n)return this.emit("error",n);this._initialize(e)},we.prototype._handlePingPong=function(n){if(n)return this.emit("error",n);this.emit("pong")},we.prototype._initialize=function(n){if(this.state==="connecting"){if(n.protocol!==1)return this.emit("error",new Xl(qa.ERR_PROTOCOL_VERSION_NOT_SUPPORTED,"Unsupported protocol version: "+n.protocol));if(I7.map[n.type]!==I7.defaultType)return this.emit("error",new Xl(qa.ERR_DEFAULT_TYPE_MISMATCH,n.type+" does not match the server default type"));if(typeof n.id!="string")return this.emit("error",new Xl(qa.ERR_CLIENT_ID_BADLY_FORMED,"Client id must be a string"));this.id=n.id,this._setState("connected")}},we.prototype.getPresence=function(n){var e=this,t=No.digOrCreate(this._presences,n,function(){return new AS(e,n)});return t._wantsDestroy=!1,t},we.prototype.getDocPresence=function(n,e){var t=E7.channel(n,e),o=this,r=No.digOrCreate(this._presences,t,function(){return new E7(o,n,e)});return r._wantsDestroy=!1,r},we.prototype._sendPresenceAction=function(n,e,t){this._addPresence(t);var o={a:n,ch:t.channel,seq:e};return this.send(o),o.seq},we.prototype._addPresence=function(n){No.digOrCreate(this._presences,n.channel,function(){return n})},we.prototype._handlePresenceSubscribe=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._handleSubscribe(n,e.seq)},we.prototype._handlePresenceUnsubscribe=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._handleUnsubscribe(n,e.seq)},we.prototype._handlePresence=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._receiveUpdate(n,e)},we.prototype._handlePresenceRequest=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._broadcastAllLocalPresence(n,e)};var S7=yS,wS=$a;const _h={err:1001,msg:"user auth error",name:"AuthError"},BS={err:1002,msg:"you don't have required permission",name:"PermissionError"},np={err:1003,msg:"Too many user connected",name:"MaxUserError"},Ga={err:1004,msg:"document server changed, reload it",name:"RequestReloadError"},ES={err:1005,msg:"app id must be at least 2 chars, doc id must be at least 5 chars",name:"DocIdError"},xS={err:1028,msg:"upload file ext not allowed",name:"FileExtError"},Za="x-live-editor-token",Ph="x-live-editor-base-url",gn=S("auth-connection");function IS(n){try{n()}catch(e){gn.error(e)}}class TS{constructor(e,t){g(this,"connection");g(this,"ws");g(this,"retryCount");g(this,"events",new _3.EventEmitter);g(this,"token",null);g(this,"resourceToken",null);this.url=e,this.reauthFunc=t,this.retryCount=0}getBaseURL(){const e=new URL(this.url);return`${e.protocol==="wss:"?"https:":"http:"}//${e.host}${e.pathname}`}getBase64BaseURL(){return ws(this.getBaseURL())}async auth(e){m(gn,e.token,"no auth token");const t=`${this.getBaseURL()}/auth`,o=await window.fetch(t,{method:"GET",headers:{[Za]:e.token,[Ph]:this.getBase64BaseURL()},credentials:"include"});if(o.status!==200)throw new Error("http auth error");return this.token=e.token,await o.json()}async logout(){if(!this.token)return;const e=`${this.getBaseURL()}/logout`;await window.fetch(e,{method:"GET",headers:{[Ph]:ws(this.getBaseURL())}})}async init(e){const t=await this.auth(e);this.resourceToken=t.read,this.ws=new DB.default(this.url,void 0,{maxReconnectionDelay:2500,minReconnectionDelay:1e3}),this.connection=Object.create(S7.prototype),m(gn,this.connection,"no this.connection"),this.ws,this.connection._initializeHandshake=function(){this.send({a:"hs",id:this.id,auth:e})};const o=this.connection.handleMessage.bind(this.connection);this.connection.handleMessage=r=>{var s;const i=r;if(this.connection&&(this.connection.lastReceiveTime=Date.now()),"err"in i||i.a==="pong")this.handleMessage(i);else{Object.prototype.hasOwnProperty.call(i,"a")&&i.a!=="init"&&i.a!=="hs"&&(this.retryCount=0);try{o(i)}catch(l){if((l==null?void 0:l.type)==="writeConflict"){this.emitWriteConflictError(l,i);return}if((s=l==null?void 0:l.message)!=null&&s.startsWith("Cannot invert subtype")){this.emitWriteConflictError(l,i);return}throw l}}},S7.apply(this.connection,[this.ws])}async handleAuthError(){if(this.reauthFunc&&this.retryCount<5){this.retryCount+=1,gn.info(`retrying re-auth attempt no. ${this.retryCount}`);try{if(this.connection){const e=await this.reauthFunc();await this.auth(e),this.connection._initializeHandshake=function(){this.send({a:"hs",id:this.id,auth:e})}}}catch(e){gn.error(e),setTimeout(()=>this.handleAuthError(),0)}}else gn.error("auth error, cannot retry anymore"),this.emitAuthError(),this.end(!1)}emitAuthError(){const e=new Error(_h.msg);e.code=_h.err,this.events.emit("error",e)}emitRequestReloadError(){const e=new Error(Ga.msg);e.code=Ga.err,this.events.emit("requestReloadError",e)}emitWriteConflictError(e,t){e.orgMsg=t,this.events.emit("writeConflictError",e)}emitMaxUsersError(){this.events.emit("maxUsersError"),this.end(!1)}handleMessage(e){const t=e;if(t.a==="pong")return;const o=t.err;if(o===_h.err)gn.warn("auth error"),this.handleAuthError();else if(o===np.err)gn.warn(np.msg),this.emitMaxUsersError();else if(o===Ga.err){gn.warn(Ga.msg);try{this.emitRequestReloadError()}catch(r){gn.error(`error occurred while process reload error: ${JSON.stringify(r)}`)}finally{this.end(!1)}}else gn.error(`unknown message received: ${JSON.stringify(t)}`),this.emitAuthError()}get(e,t){return m(gn,this.connection,"no this.connection"),this.connection.get(e,t)}addEventListener(e,t){e==="error"?this.events.addListener(e,t):(m(gn,this.ws,"no this.ws"),this.ws.addEventListener(e,t))}onWriteConflictError(e){this.events.addListener("writeConflictError",e)}onMaxUsersError(e){m(gn,this.events.listenerCount("maxUsersError")===0,"too many maxUserError listener"),this.events.addListener("maxUsersError",e)}onRequestReloadError(e){m(gn,this.events.listenerCount("requestReloadError")===0,"to many requestReloadError listener"),this.events.addListener("requestReloadError",e)}end(e){var t;this.reauthFunc=void 0,this.events.removeAllListeners(),IS(()=>{var o;return(o=this.connection)==null?void 0:o.close()}),this.connection=void 0,(t=this.ws)==null||t.close(),this.ws=void 0,e&&this.logout()}}S("utils/file");function DS(){function n(){return new Promise(e=>{const t=new FileReader;t.onload=()=>{e(t.result)},t.readAsArrayBuffer(this)})}File.prototype.arrayBuffer=File.prototype.arrayBuffer||n,Blob.prototype.arrayBuffer=Blob.prototype.arrayBuffer||n}DS();async function SS(n){const t=n.size,o=Math.floor((t+102400-1)/102400),r=new SB.Hash;for(let s=0;s<o;s++){const l=s*102400;let a=l+102400;a>t&&(a=t);const f=await n.slice(l,a,n.type).arrayBuffer();r.update(new Uint8Array(f))}const i=r.digest();return ws(i)}const ur=S("sharedb-doc/client");class LS{constructor(e,t,o){g(this,"connection");g(this,"auth");g(this,"doc",null);g(this,"reauthFunc");g(this,"clientId",K());g(this,"getDoc",async()=>{const e=o=>new Promise((r,i)=>{o.fetch(s=>{s?i(s):r()})});m(ur,!this.doc,"This websocket has opened a doc."),await this.connection.init(this.auth);const t=this.connection.get(this.auth.appId,this.auth.docId);return this.doc=t,await e(t),ur.debug(t),t});this.auth=e;const r=`${t}/${this.auth.appId}/${this.auth.docId}`;wS.register(Ld.type),this.connection=new TS(r,o),this.reauthFunc=o}editorServer(){const e=this.apiServer(),t=`/${this.auth.appId}/${this.auth.docId}`;return m(ur,e.endsWith(t),`invalid api server: ${e}, ${t}`),e.substr(0,e.length-t.length)}close(e){this.connection.end(e),this.doc=null}on(e,t){this.connection.addEventListener(e,o=>{(e==="error"||this.doc)&&t(o)})}onWriteConflictError(e){this.connection.onWriteConflictError(e)}onMaxUsersError(e){this.connection.onMaxUsersError(e)}onRequestReloadError(e){this.connection.onRequestReloadError(e)}async authOnly(){await this.connection.auth(this.auth)}getResourceToken(){return this.connection.resourceToken}hasDocContainer(){return!!this.doc}apiServer(){const e=this.connection.url;if(e.startsWith("ws://"))return`http://${e.substring(5)}`;if(e.startsWith("wss://"))return`https://${e.substring(6)}`;throw new Error(`invalid server url: ${e}`)}async getFileUrlByHash(e,t,o,r,i){try{const s=`${e}/${t}`,l=await this.request(s,{method:"post",headers:{...i},data:{name:o,size:r}});return l.data&&Array.isArray(l.data)&&l.data.length===1?l.data[0]:""}catch{return""}}async getFileUrlsByHashes(e){const o=`${this.apiServer()}/resources`;let r=[];e.forEach(l=>{const a=l.split("|");r.push(...a)}),r=Array.from(new Set(r));const i=r.map(l=>this.getFileUrlByHash(o,l,"",0,{[Za]:this.connection.token}));return await Promise.all(i)}async uploadFile(e,t,o,r,i){let s=t.size;if(s===0)throw new Error("file is empty");s+=500;const l=v=>{ur.info(`on progress: ${v.loaded}`);let B=v.loaded*100/s;B>100&&(B=100),r(B)},a=await SS(t),d=await this.getFileUrlByHash(e,a,t.name,t.size,o);if(d)return r(-1),d;let f=e;i!=null&&i.thumbnail&&(f+="/thumbnail");const p=new FormData;p.append("file-size",`${t.size}`),p.append("file-hash",a),p.append("file",t,t.name);const A=await this.request(f,{method:"post",data:p,withCredentials:!0,headers:{...o},onUploadProgress:l});return ur.info(A),r(100),Array.isArray(A.data)?A.data[0]:A.data}async uploadResource(e,t=()=>{},o){const i=`${this.apiServer()}/resources`;m(ur,this.connection.token,"no connection token");const s=await this.uploadFile(i,e,{[Za]:this.connection.token},t,o);return m(ur,s,"no result"),s}async request(e,t){var i,s;let o=this.connection.token,r;for(let l=0;l<2;l++){const a=t||{};a.url=e,a.headers||(a.headers={}),m(ur,o,"no token"),a.headers={...a.headers,[Za]:o,[Ph]:this.connection.getBase64BaseURL()};try{return await IB.default(e,a)}catch(d){if(r=d,((i=d==null?void 0:d.response)==null?void 0:i.status)===403&&this.reauthFunc){const f=await this.reauthFunc();if(await this.connection.auth(f),!f.token)throw d;o=f.token;continue}throw(s=d.response)!=null&&s.data&&(d.responseData=d.response.data),d}}throw m(ur,r,"no error"),r}async getVersions(){const t=`${this.apiServer()}/versions`,r=(await this.request(t)).data.versions;return r.forEach(i=>{i.extra&&(i.extra=JSON.parse(i.extra))}),r}async getVersion(e){const o=`${this.apiServer()}/versions/${e}`,r=await this.request(o);return JSON.parse(r.data.data)}async getLatestVersion(){const t=`${this.apiServer()}/versions/latest`,o=await this.request(t);return JSON.parse(o.data.data)}async getVersionOps(e,t){let r=`${this.apiServer()}/versions/before/${e}?withOp=true`;t!==void 0&&t!==0&&(r+=`&from=${t}`);const i=await this.request(r),s=i.data.ops,l=TB.default(s,f=>!!f.create);let a=null;l!==-1&&(a=s[l],s.splice(0,l+1));let d;return a?(m(ur,a.create,"no createDoc.create"),d=a.create.data):d=JSON.parse(i.data.data),d.blocks||(d.blocks=[]),{doc:d,ops:i.data.ops}}async updateVersionExtra(e,t,o){const i=`${this.apiServer()}/versions/${e}/tags/${t}`;await this.request(i,{method:"post",data:{extra:JSON.stringify(o)}})}async revertVersion(e){const o=`${this.apiServer()}/versions/revert/${e}`;await this.request(o,{method:"post",data:{}})}async createVersion(e,t){const r=`${this.apiServer()}/versions`;return(await this.request(r,{method:"post",data:{publish:t,tag:e}})).data}async recognizeLink(e){const o=`${this.apiServer()}/resources/external/${ws(e)}`;return(await this.request(o)).data}buildResourceUrl(e,t){if(!e)return"";if(e.startsWith("https:")||e.startsWith("http:")||e.startsWith("file:")||e.startsWith("data:")||e.startsWith("blob:"))return e;let r=`${this.apiServer()}/resources/${encodeURIComponent(e)}`;const i=[];if(t!=null&&t.withToken&&i.push(`token=${this.getResourceToken()}`),t!=null&&t.downloadFileName&&i.push(`&fileName=${encodeURIComponent(t.downloadFileName)}`),i.length>0){const s=i.join("&");r+=`?${s}`}return r}}function MS(){return{blocks:[{id:K(),type:"text",text:[]}],comments:{},meta:{}}}const op=S("block-ids");class RS{constructor(){g(this,"ids",new Map)}onInsertBlock(e){const t=Array.from(this.ids.keys()).sort((r,i)=>i-r);for(let r=0;r<t.length;r++){const i=t[r];if(i>=e){const s=this.ids.get(i);m(op,s!==void 0,"old id is not exists"),this.ids.delete(i),this.ids.set(i+1,s)}}const o=K();this.ids.set(e,o)}onDeleteBlock(e){this.ids.delete(e);const t=Array.from(this.ids.keys()).sort((o,r)=>o-r);for(let o=0;o<t.length;o++){const r=t[o];if(r>e){const i=this.ids.get(r);m(op,i!==void 0,"old id is not exists"),this.ids.delete(r),this.ids.set(r-1,i)}}}getId(e){let t=this.ids.get(e);return t||(t=K(),this.ids.set(e,t)),t}getById(e){return Array.from(this.ids.entries()).find(([,t])=>t===e)}}class OS{constructor(){g(this,"ids",new Map)}getContainerIds(e){let t=this.ids.get(e);return t||(t=new RS,this.ids.set(e,t)),t}onInsertBlock(e,t){this.getContainerIds(e).onInsertBlock(t)}onDeleteBlock(e,t){this.getContainerIds(e).onDeleteBlock(t)}getBlockId(e,t){return this.getContainerIds(e).getId(t)}getBlockIndexById(e){const t=Array.from(this.ids.entries());for(let o=0;o<t.length;o++){const r=t[o],i=r[1].getById(e);if(i)return{containerId:r[0],blockIndex:i[0]}}return m(op,!1,"fault error: failed to get block index"),{containerId:"error",blockIndex:-1}}}class L7{constructor(e=new Set,t=new Map){this.deletedKeys=e,this.insertedValues=t}insert(e,t){this.insertedValues.set(e,t)}delete(e){this.deletedKeys.add(e)}toDocBlockDelta(){const e={};return this.insertedValues.forEach((t,o)=>{e[o]=t}),{insert:e,delete:Array.from(this.deletedKeys)}}}const Fh=S("op-parse-handler");class _S{constructor(e,t){g(this,"actions",[]);this.outerHandler=e,this.local=t}pushActions(e){if(!e.containerId){this.actions.push(e);return}const o={...e,containerId:(r=>r==="blocks"?"root":r)(e.containerId)};this.actions.push(o)}onDeleteBlock(e,t){this.pushActions({type:"deleteBlock",containerId:e,blockIndex:t})}onInsertBlock(e,t,o){this.pushActions({type:"insertBlock",containerId:e,blockIndex:t,data:o})}onDeleteBlockData(e,t,o){this.pushActions({type:"deleteBlockData",containerId:e,blockIndex:t,key:o})}onInsertBlockData(e,t,o,r){this.pushActions({type:"insertBlockData",containerId:e,blockIndex:t,key:o,value:r})}onUpdateBlockText(e,t,o){this.pushActions({type:"updateBlockText",containerId:e,blockIndex:t,richTextData:o})}onDeleteContainer(e){this.pushActions({type:"deleteContainer",containerId:e})}onCreateContainer(e,t){this.pushActions({type:"createContainer",containerId:e,data:t})}onDeleteComment(e){this.pushActions({type:"deleteComment",commentId:e})}onCreateComment(e){this.pushActions({type:"createComment",commentId:e})}onUpdateComment(e){this.pushActions({type:"updateComment",commentId:e})}end(){const e=this.actions,t=new Set,o=new Map,r=new OS,i=e.filter(s=>s.type==="deleteBlock"||s.type==="deleteBlockData");for(const s of i)if(s.type==="deleteBlock"){const l=s,a=r.getBlockId(l.containerId,l.blockIndex);r.onDeleteBlock(l.containerId,l.blockIndex);const d=o.get(a);d&&(Fh.debug(`ignore update object data before delete block: ${JSON.stringify(d)}`),o.delete(a));const f=`${l.containerId}-${l.blockIndex}`;t.add(f),this.outerHandler.onDeleteBlock(l.containerId,l.blockIndex,this.local)}else if(s.type==="deleteBlockData"){const l=s,a=`${l.containerId}-${l.blockIndex}`;if(t.has(a)){Fh.warn("delete block data after delete block, ignore it");continue}const d=r.getBlockId(l.containerId,l.blockIndex);let f=o.get(d);f||(f=new L7,o.set(d,f)),f.delete(l.key)}else m(Fh,!1,`invalid action type, ${s.type}`);this.actions.forEach(s=>{if(s.type==="deleteContainer"){const l=s;this.outerHandler.onDeleteContainer(l.containerId,this.local)}else if(s.type==="deleteComment"){const l=s;this.outerHandler.onDeleteComment(l.commentId,this.local)}}),this.actions.forEach(s=>{if(s.type==="createContainer"){const l=s;this.outerHandler.onCreateContainer(l.containerId,l.data,this.local)}}),this.actions.forEach(s=>{if(s.type==="insertBlock"){const l=s;this.outerHandler.onInsertBlock(l.containerId,l.blockIndex,l.data,this.local)}else if(s.type==="insertBlockData"){const l=s,a=r.getBlockId(l.containerId,l.blockIndex);let d=o.get(a);d||(d=new L7,o.set(a,d)),d.insert(l.key,l.value)}else if(s.type==="updateBlockText"){const l=s;this.outerHandler.onUpdateBlockText(l.containerId,l.blockIndex,l.richTextData,this.local)}else if(s.type==="createComment"){const l=s;this.outerHandler.onCreateComment(l.commentId,this.local)}else if(s.type==="updateComment"){const l=s;this.outerHandler.onUpdateComment(l.commentId,this.local)}}),Array.from(o.entries()).forEach(([s,l])=>{const{containerId:a,blockIndex:d}=r.getBlockIndexById(s);Fh.debug(`update block data: ${a}, ${d}, ${JSON.stringify(l.toDocBlockDelta())}`),this.outerHandler.onUpdateBlockData(a,d,l.toDocBlockDelta(),this.local)})}}const Rt=S("op-parser");class M7{}class rp{constructor(e){g(this,"key");this.key=e}}function PS(n,e,t){const o=e.concat(),r=o[0];if(typeof r!="number"||(o.shift(),o.length===1))return!1;const i=o[0];if(typeof i!="object"||!i.i||Object.keys(i).length!==1)return!1;for(let l=1;l<o.length;l++){const a=o[l];if(!Array.isArray(a)||a.length!==2||typeof a[0]!="string")return!1;const f=a[1];if(typeof f!="object"||f.i===void 0||Object.keys(f).length!==1)return!1}const s=i.i;m(Rt,s.id,"block id is required"),m(Rt,s.type,"block type is required");for(let l=1;l<o.length;l++){const a=o[l],d=a[0],f=a[1];s[d]=f.i}return t.onInsertBlock(n,r,s),!0}function ip(n,e,t,o){if(t==="upsert"&&PS(n,e,o))return;m(Rt,Array.isArray(e),`invalid block op: ${n}, ${JSON.stringify(e)}`);const r=e.concat(),i=r[0];r.shift();const s=[];for(;r.length>0;){const l=r[0];if(l==="text"){const a=r[1];if(m(Rt,typeof a=="object",`invalid block op: ${n}, ${JSON.stringify(e)}`),m(Rt,a.et==="rich-text",`invalid block op: ${n}, ${JSON.stringify(e)}`),r.splice(0,2),t==="upsert"){const f=a.e;o.onUpdateBlockText(n,i,f)}m(Rt,r.length===0,`invalid block ops.length !== 0, ${JSON.stringify(r)}`)}else if(Array.isArray(l)){m(Rt,l.length===2,`invalid block op: data.length !== 2, ${JSON.stringify(l)}`);const a=l[0];m(Rt,typeof a=="string",`invalid block op: key ${JSON.stringify(a)}`);const d=l[1];if(a==="text"){if(m(Rt,typeof d=="object",`invalid opData type, ${JSON.stringify(d)}`),d.i&&t==="upsert"&&o.onInsertBlockData(n,i,a,d.i),d.r&&t==="remove"&&o.onDeleteBlockData(n,i,a),d.et==="rich-text"&&t==="upsert"){const p=d.e;o.onUpdateBlockText(n,i,p)}}else t==="remove"&&d.r&&s.push(new rp(a)),t==="upsert"&&d.i&&o.onInsertBlockData(n,i,a,d.i);r.shift()}else if(typeof l=="object"){const a=l;t==="remove"&&a.r&&s.push(new M7),t==="upsert"&&a.i&&o.onInsertBlock(n,i,a.i),r.shift()}else{m(Rt,typeof l=="string","data is not string"),m(Rt,l!=="text","data !== 'text'"),m(Rt,r.length===2,`invalid block op: ops.length !== 2, ${JSON.stringify(r)}`);const a=l,d=r[1];t==="remove"&&d.r&&s.push(new rp(a)),t==="upsert"&&d.i&&o.onInsertBlockData(n,i,a,d.i),r.splice(0,2)}}s.reverse(),s.forEach(l=>{l instanceof M7?o.onDeleteBlock(n,i):l instanceof rp?o.onDeleteBlockData(n,i,l.key):m(Rt,!1,`invalid action type: ${typeof l}, ${JSON.stringify(l)}`)})}function FS(n,e,t){Rt.warn(`unsupported meta op, ${JSON.stringify(n)}`)}function NS(n,e,t){const o=n[1],r=n[2];m(Rt,o,`invalid comment op, no commentId: ${JSON.stringify(n)}`),m(Rt,r,`invalid comment op, no actions: ${JSON.stringify(n)}`),typeof r=="string"?Rt.error(`unknown comment op, ${JSON.stringify(n)}`):r.i&&r.r?e==="upsert"&&t.onUpdateComment(o):r.i?e==="upsert"&&t.onCreateComment(o):r.r?e==="remove"&&t.onDeleteComment(o):Rt.error(`unknown comment op, ${JSON.stringify(n)}`)}function sp(n,e,t){const o=n[0];if(Array.isArray(o)){o.forEach(s=>{sp(s,e,t)});return}const r=o;if(m(Rt,typeof r=="string",`invalid container id: ${JSON.stringify(n)}`),r==="meta"){FS(n);return}if(r==="comments"){NS(n,e,t);return}const i=r;if(Array.isArray(n[1]))e==="remove"?n.slice(1).reverse().forEach(s=>{ip(i,s,e,t)}):n.slice(1).forEach(s=>{ip(i,s,e,t)});else if(typeof n[1]=="object"){const s=n[1];s.r&&e==="remove"&&t.onDeleteContainer(i),s.i&&e==="upsert"&&t.onCreateContainer(i,s.i)}else m(Rt,typeof n[1]=="number",`invalid ops[1], not a number: ${JSON.stringify(n)}`),ip(i,n.slice(1),e,t)}function R7(n,e,t){const o=new _S(e,t);for(let r=0;r<2;r++){const i=r===0?"remove":"upsert",s=fe.default(n),l=s[0];Array.isArray(l)?s.forEach(a=>{sp(a,i,o)}):sp(s,i,o)}o.end()}const $S=S("sharedb-comments");function lp(n){const e=n.blocks;m($S,e,"no comment blocks");const t={blocks:{root:e},meta:{},comments:{}};return Object.entries(n).forEach(([o,r])=>{Array.isArray(r)&&(t.blocks[o]=r)}),fe.default(t)}function O7(n){const{id:e,groupId:t,userId:o,displayName:r,avatarUrl:i,abstract:s,created:l,modified:a}=n;return{id:e,groupId:t,userId:o,displayName:r,avatarUrl:i,abstract:s,created:l,modified:a}}function cp(n,e){const t=wD(e),{comments:o,meta:r,blocks:i,...s}=t,l={...n,blocks:i,...s},a=fe.default(l);return delete a.children,a}const ct=S("sharedb-doc/doc-container"),_7="ot-json1";Ld.type.registerSubtype(BD.type),Ld.type.name=_7,Ld.type.invert=null;class Qa extends ua{constructor(t,o,r=!0){super();g(this,"doc");g(this,"client");g(this,"localPresence");g(this,"remoteCaretHandler",new yD);g(this,"batching",0);g(this,"status","clean");g(this,"disableLogout");g(this,"destroyed",!1);g(this,"handleNothingPending",()=>{this.setStatus("clean")});g(this,"handleCreate",()=>{this.handleReload("doc created")});g(this,"handleDel",()=>{});g(this,"handleReload",t=>{this.callbacks.forEach(o=>{var r;return(r=o.onRequestReload)==null?void 0:r.call(o,t)})});g(this,"handleReset",async t=>{const o=new Error(`reset doc: ${t}`);o.code="ResetDoc",this.callbacks.forEach(r=>{var i;return(i=r.onError)==null?void 0:i.call(r,o)}),this.destroy()});g(this,"handleWriteConflictError",t=>{this.handleReset(`write conflict: ${t.message}, ${JSON.stringify(t.orgMsg)}`)});g(this,"insertObject",async(t,o,r)=>{const i=[t,o,{i:r}];return this.submitOp(i)});g(this,"deleteObject",async(t,o)=>{const r=[t,o,{r:!0}];return this.submitOp(r)});g(this,"replaceObject",async(t,o,r)=>{const i=[t,o,{r:!0,i:r}];return this.submitOp(i)});g(this,"updateObject",async(t,o,r)=>{const i=this.data()[t][o],s=[t,o];return Object.entries(r).forEach(([l,a])=>{if(!la.default(i[l],a))if(i[l]===void 0){if(a!=null){const d={i:a};s.push([l,d])}}else if(a==null){const d={r:!0};s.push([l,d])}else{const d={r:!0,i:a};s.push([l,d])}}),Object.entries(i).forEach(([l,a])=>{if((r[l]===void 0||r[l]===null)&&a!==void 0){const d={r:!0};s.push([l,d])}}),s.length<=2?Promise.resolve():this.submitOp(s)});g(this,"broadcastMessage",async t=>{const o={type:"custom",data:t,clientId:this.client.clientId};this.localPresence&&this.localPresence.submit(o)});g(this,"data",()=>this.doc.data);g(this,"submitOp",async t=>new Promise((o,r)=>{if(this.destroyed){ct.warn("submit op after destroyed");return}this.setStatus("dirty"),this.doc.submitOp(t,{},i=>{i?(ct.error(`invalid op, ${i.message}, ${JSON.stringify(t)}`),r(i),ct.error("Transform detected write conflict, reload editor"),this.handleReset("write conflict")):o()}),this.doc.data||(ct.error("no data after submit op, may be the submitted op is invalid"),this.handleReset(`invalid op, ${JSON.stringify(t)}`))}));g(this,"createDoc",async t=>new Promise((o,r)=>{this.doc.create(t,_7,i=>{i?r(i):o()})}));g(this,"submitInsertChildContainer",async(t,o)=>{const r=[Ni(t),{i:o}];return this.submitOp(r)});g(this,"submitDeleteChildContainer",async t=>{const o=[Ni(t),{r:!0}];return this.submitOp(o)});g(this,"submitInsertBlock",async(t,o,r)=>{const i=[Ni(t),o,{i:r}];return this.submitOp(i)});g(this,"submitDeleteBlock",async(t,o)=>{const r=[Ni(t),o,{r:!0}];return this.submitOp(r)});g(this,"submitUpdateBlockData",async(t,o,r)=>{if(r.delete.length===0&&Object.keys(r.insert).length===0)return Promise.resolve();const i=[Ni(t),o],s=new Set(r.delete);Object.entries(r.insert).forEach(([a,d])=>{if(s.has(a)){const f={r:!0,i:d};i.push([a,f])}});const l=new Set(Object.keys(r.insert));return r.delete.forEach(a=>{if(l.has(a))return;const d={r:!0};i.push([a,d])}),Object.entries(r.insert).forEach(([a,d])=>{if(s.has(a))return;const f={i:d};i.push([a,f])}),this.submitOp(i)});g(this,"submitUpdateRichText",async(t,o,r)=>{const i=[Ni(t),o,"text",{e:r,et:"rich-text"}];return this.submitOp(i)});g(this,"handleOp",(t,o,r)=>{if(this.destroyed){ct.warn("handleOp: destroyed");return}R7(t,this,!!o)});this.client=t,this.doc=o,this.doc.preventCompose=!0,this.disableLogout=r,this.registerCallback(this.remoteCaretHandler)}beginBatchUpdate(){return this.doc.preventCompose=!1,this.batching++,this.batching}endBatchUpdate(){return this.batching--,m(ct,this.batching>=0,"invalid call beginBatchUpdate/endBatchUpdate"),this.batching===0&&(this.doc.preventCompose=!0),this.batching}static async load(t){try{const o=new LS(t.auth,t.serverUrl,t.reauthFunc),r=await o.getDoc(),i=new Qa(o,r,t.disableLogout);if(r.type===null){if(t.autoCreateDoc===!1){const s=new Error("doc not exists");throw s.code="DocNotExists",s}await i.createDoc(t.templateData||MS())}return await i.initPresence(),await i.subscribe(),i.initEvents(),i}catch(o){throw ct.error(o),ct.error(`failed to load doc: ${JSON.stringify(o)}`),o}}setStatus(t){this.status!==t&&(this.status=t,this.callbacks.forEach(o=>{var r;return(r=o.onStatusChanged)==null?void 0:r.call(o,t)}))}initEvents(){this.doc.on("nothing pending",this.handleNothingPending),this.doc.on("create",this.handleCreate),this.doc.on("del",this.handleDel),this.client.onWriteConflictError(this.handleWriteConflictError)}clearEvents(){this.doc.off("nothing pending",this.handleNothingPending),this.doc.off("create",this.handleCreate),this.doc.off("del",this.handleDel)}initPresence(){return new Promise((t,o)=>{if(this.localPresence)t();else{const r=this.doc.connection.getPresence(`${this.doc.collection}:${this.doc.id}`);r.on("receive",(i,s)=>{this.onCustomMessage(s)}),r.subscribe(i=>{i?o(i):(this.localPresence=r.create(K()),t())})}})}subscribe(){return new Promise((t,o)=>{this.doc.subscribe(r=>{r?o(r):(this.doc.on("op",this.handleOp),t())})})}toJSON(){return Na(this.data())}getContainerBlocks(t){const o=this.data();m(ct,o,"no doc data");const r=o[Ni(t)];return m(ct,r,`no container data: ${t}`),fe.default(r)}getBlockData(t,o){const r=this.data();m(ct,r,"no doc data");const i=r[Ni(t)];m(ct,i,`no container data: ${t}`);const s=i[o];return m(ct,s,`no block data: ${o}`),fe.default(s)}localInsertBlock(t,o,r){return this.submitInsertBlock(t,o,r),this.getBlockData(t,o)}localDeleteBlock(t,o){const r=this.getBlockData(t,o);return this.submitDeleteBlock(t,o),r}localUpdateBlockText(t,o,r){const i=this.getBlockData(t,o);m(ct,i.text,"no block text");const s=fe.default(i.text);this.submitUpdateRichText(t,o,r);const l=ln.apply(s,r);return m(ct,l,"no block text"),l}localUpdateBlockData(t,o,r){const i=fe.default(this.getBlockData(t,o));return this.submitUpdateBlockData(t,o,r),i}localInsertChildContainer(t,o){this.submitInsertChildContainer(t,o)}localDeleteChildContainers(t){this.beginBatchUpdate(),t.forEach(o=>{this.submitDeleteChildContainer(o)}),this.endBatchUpdate()}getComments(){return Object.values(this.data().comments).map(o=>O7(o))}getComment(t){return this.data().comments[t]}getCommentDoc(t){const o=this.data().comments[t];return lp(o)}localCreateComment(t,o){const r=cp(t,o),s=["comments",r.id,{i:r}];return this.submitOp(s)}localDeleteComment(t){const o=["comments",t,{r:!0}];return this.submitOp(o)}localUpdateComment(t,o){const r=cp(t,o),i=["comments",t.id,{r:!0,i:r}];return this.submitOp(i)}destroy(){var t;this.destroyed=!0,this.clearEvents(),this.clearCallbacks(),this.doc.destroy(),(t=this.localPresence)==null||t.destroy(),this.client.close(!this.disableLogout),this.remoteCaretHandler.destroy()}onDeleteBlock(t,o,r){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(i=>{var s;return(s=i.onDeleteBlock)==null?void 0:s.call(i,Jl(t),o,r)})}onInsertBlock(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onInsertBlock)==null?void 0:l.call(s,Jl(t),o,r,i)})}onUpdateBlockData(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,Jl(t),o,r,i)})}onUpdateBlockText(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockText)==null?void 0:l.call(s,Jl(t),o,r,i)})}onDeleteContainer(t,o){m(ct,this.callbacks.length>0,"no callbacks"),m(ct,t!=="root","should not delete root container in doc"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,Jl(t),o)})}onCreateContainer(t,o,r){m(ct,this.callbacks.length>0,"no callbacks"),m(ct,t!=="root","should not create root container in doc"),this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,Jl(t),o,r)})}onDeleteComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteComment)==null?void 0:i.call(r,t,o)})}onCreateComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onCreateComment)==null?void 0:i.call(r,t,o)})}onUpdateComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onUpdateComment)==null?void 0:i.call(r,t,o)})}onCustomMessage(t){const o=t;(o==null?void 0:o.type)==="custom"&&(o==null?void 0:o.clientId)!==this.client.clientId?this.callbacks.forEach(r=>{var i;return(i=r.onCustomMessage)==null?void 0:i.call(r,o.data)}):(o==null?void 0:o.type)==="onlineUsers"&&setTimeout(()=>{const r={type:"custom",data:t,clientId:"-"};this.onCustomMessage(r)})}async addResources(t){return await this.client.getFileUrlsByHashes(t)}async uploadResource(t,o){var i;return{resourceId:await this.client.uploadResource(t,(i=o==null?void 0:o.onProgress)!=null?i:()=>{})}}buildResourceUrl(t,o){return this.client.buildResourceUrl(t,o)}request(t,o){return this.client.request(t,o)}getUser(){const t=this.client.clientId,{permission:o,userId:r,displayName:i,avatarUrl:s}=this.client.auth;return{permission:o,clientId:t,userId:r,displayName:i,avatarUrl:s,rainbowIndex:0}}getRemoteUsers(){return this.remoteCaretHandler.remoteUsers}getVersionHelper(){return this}getVersions(){return this.client.getVersions()}async getVersion(t){const o=await this.client.getVersion(t);return Na(o)}async getLatestVersion(){const t=await this.client.getLatestVersion();return Na(t)}async getHistoryData(t,o){const{doc:r,ops:i}=await this.client.getVersionOps(t,o),s=i.map(l=>({user:l.meta.createdBy,data:l}));return{doc:Na(r),historyData:s}}async getVersionData(t,o){const{doc:r,ops:i}=await this.client.getVersionOps(t,o);return{doc:Na(r),versionData:i}}async updateVersionExtra(t,o,r){await this.client.updateVersionExtra(t,o,r)}revertVersion(t){return this.client.revertVersion(t)}createVersion(t,o){return this.client.createVersion(t,o)}async recognizeLink(t){return this.client.recognizeLink(t)}parseHistoryData(t,o){R7(t.data.op,o,!0)}getServerMeta(){return{appId:this.client.auth.appId,docId:this.client.auth.docId,serverId:this.client.apiServer()}}}S("remote-cursor");class P7{constructor(e){g(this,"handleDocSelectionChange",()=>{this.broadcastCaretPos()});g(this,"broadcastCaretPos",qt.default(()=>{const e={type:"caret",userId:this.editor.doc.getUser().userId,range:this.editor.selection.range.toDocRange()};this.editor.doc.broadcastMessage(e)},300));g(this,"handleRemoteCaretsChanged",e=>{e.forEach(t=>{const o=this.editor.findBlockById(t);o&&this.editor.reloadBlock(o)})});this.editor=e,this.editor.addListener("selectionChanged",this.handleDocSelectionChange),this.editor.doc.getRemoteUsers().addListener("remote-carets-change",this.handleRemoteCaretsChanged)}destroy(){this.editor.removeListener("selectionChanged",this.handleDocSelectionChange),this.editor.doc.getRemoteUsers().removeListener("remote-carets-change",this.handleRemoteCaretsChanged)}}const F7=S("remote-cursor-decorator");class ap{decorateText(e,t,o){const r=e.doc.getRemoteUsers();if(!r)return{};const i=new Map,{containerId:s,blockIndex:l}=t[t.length-1];m(F7,typeof s=="string","invalid path containerId"),m(F7,typeof l=="number","invalid path blockIndex");const a=e.doc.getBlockData(s,l),d=rn(o);return r.getSimpleCursors(a.id).forEach((p,A)=>{A>d&&(A=d);const v=p.map(D=>({id:K(),type:"remote-cursor",name:D.user.displayName,time:D.time,rainbowIndex:D.user.rainbowIndex})),B=i.get(A);B?B.push(...v):i.set(A,v)}),{insertions:i}}}class N7 extends Dt.TypedEmitter{constructor(e){super(),this.editor=e,this.editor.doc.registerCallback(this)}handleChild(e,t,o){if(Xe(Fr(this.editor,e)))return;const r=this.editor.getBlockByIndex(e,t),i=re(this.editor.getContainerById(e));i&&this.emit("change",this.editor,i,r,o)}onUpdateBlockData(e,t){this.handleChild(e,t,"data-change")}onUpdateBlockText(e,t){this.handleChild(e,t,"text-change")}destroy(){this.editor.doc.unregisterCallback(this)}}function HS(n,e){n.addCustom("child-block-tracker",()=>new N7(n)).addListener("change",e)}function jS(n,e){n.addCustom("child-block-tracker",()=>new N7(n)).removeListener("change",e)}const Tte="",US={colorPalette:{colorDesc:"\u5B57\u4F53\u989C\u8272",backgroundDesc:"\u80CC\u666F\u989C\u8272",reset:"\u6062\u590D\u9ED8\u8BA4",name:"\u6587\u672C\u989C\u8272"},search:{emptyTips:"\u6682\u65E0\u641C\u7D22\u7ED3\u679C"}},zS={colorPalette:{colorDesc:"Text Color",name:"Text Color",backgroundDesc:"Background Color",reset:"Reset"},search:{emptyTips:"\u6682\u65E0\u641C\u7D22\u7ED3\u679C"}},VS={colorPalette:{colorDesc:"\u30D5\u30A9\u30F3\u30C8\u306E\u8272",backgroundDesc:"\u80CC\u666F\u8272",reset:"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u623B\u3059",name:"\u30C6\u30AD\u30B9\u30C8\u306E\u8272"},search:{emptyTips:"\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093"}};O.mergeLang({"zh-CN":US,"en-US":zS,"js-JP":VS});const Dte="";S("button");function ji(n,e,t,o,r){const i=w("button",["editor-button"],null);return i.setAttribute("data-button-id",n),r&&i.setAttribute(`data-editor-tooltip-${r}`,e),t?typeof t=="string"?t.startsWith("<")?i.innerHTML=t:i.innerText=t:i.appendChild(t):i.innerText=e,o&&(o.indexOf("checked")!==-1&&W(i,"checked"),o.indexOf("disabled")!==-1&&(i.disabled=!0)),i}function $7(n,e,t){t?n.setAttribute(`data-editor-tooltip-${t}`,e):n.innerText=e}const Ste="",ec=S("ui-command-bar-base"),WS={itemElementTag:"div",tippyArrow:!1},j2=class extends Dt.TypedEmitter{constructor(t,o,r){var i,s;super();g(this,"content");g(this,"items");g(this,"subBar",null);g(this,"parentItem",null);g(this,"closeable",null);g(this,"closeReason",null);g(this,"options");g(this,"id");g(this,"header",null);g(this,"footer",null);g(this,"handleDocumentKeydown",t=>{if(!!this.isVisible&&!t.isComposing&&!Ul(t.target)){if(this.subBar){this.subBar.handleDocumentKeydown(t);return}if(this.items.length!==0){if(t.key==="Escape"){this.close("cancelBar");return}if(t.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),t.preventDefault(),t.stopPropagation()}else if(t.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),t.preventDefault(),t.stopPropagation()}else if(t.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(t.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(t.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return;const r=this.items[o],i=this.getItemElementById(r.id);i&&this.emit("click",this,r,i)}}}});g(this,"handleDocumentMouseDown",t=>{if(t.target instanceof Element&&!this.isInCommandBar(t.target)){const o=this.listeners("closing");for(let r=0;r<o.length;r++)if(o[r](this,t)===!1)return;this.close("clickBackground")}});g(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),mC(this.id)});g(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&W(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&fC(this.id)});g(this,"lastEnterPauseTime",0);g(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});g(this,"handleItemMouseEnter",t=>{if(Date.now()-this.lastEnterPauseTime<100)return;const o=this.getParentCommandItemElement(t.target);if(!o)return;const r=this.getItemElementId(o),i=this.getItemById(r);if(this.selectItem(r),i.manualShowChildren)return;const s=i.childrenMenuId||"";this.showSubCommandBar(s)});g(this,"handleItemMouseLeave",t=>{var r,i;const o=this.getParentCommandItemElement(t.target);!o||((i=(r=this.subBar)==null?void 0:r.parentItem)==null?void 0:i.id)!==this.getItemElementId(o)&&(te(o,"selected"),this.emit("selectionChange",this,""))});g(this,"handleItemClick",t=>{const o=this.getParentCommandItemElement(t.target);if(!o)return;const r=this.getItemElementId(o),i=this.items.find(s=>s.id===r);if(!!i&&!(i.states&&i.states.indexOf("disabled")!==-1)){if(i.children&&i.children.length>0&&i.manualShowChildren){this.showSubCommandBar(i.childrenMenuId);return}i.element||(this.emit("click",this,i,o),this.options.autoClose&&this.close("clickItem"))}});g(this,"handleWheel",t=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const o=t.target;if(!o||!(o instanceof Node))return;const r=o instanceof HTMLElement?o:o.parentElement;if(!r)return;const i=wo(r);if(!Ke(this.content,i)){t.stopPropagation(),t.preventDefault();return}t.deltaY<0?i.scrollTop===0&&(t.stopPropagation(),t.preventDefault()):t.deltaY>0&&i.scrollTop+i.clientHeight>=i.scrollHeight&&(t.stopPropagation(),t.preventDefault())});this.id=(i=r==null?void 0:r.id)!=null?i:K(),this.options={...WS,...r},this.items=t,this.parentItem=(s=r==null?void 0:r.parentItem)!=null?s:null,this.closeable=o!=null?o:null,this.content=this.createCommandBarContent(t)}close(t){this.closeReason=t,this.subBar&&this.subBar.close(t),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(t,o){this.emit("click",this,t,o)}createPopperOptions(){var r,i;const t={modifiers:[]},o=this.options.overflowBoundary;return o&&((r=t==null?void 0:t.modifiers)==null||r.push({name:"flip",options:{boundary:o,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((i=t==null?void 0:t.modifiers)==null||i.push({name:"preventOverflow",options:{padding:this.options.padding}})),t}destroy(){var t;this.close(null),this.removeAllListeners(),(t=this.subBar)==null||t.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(t){var r;this.subBar&&t.findIndex(s=>{var l,a;return s.id===((a=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:a.id)})===-1&&((r=this.subBar)==null||r.destroy(),this.subBar=null),this.items=t;const o=this.createCommandBarContent(t);this.content.innerHTML="",Array.from(o.children).forEach(i=>{this.content.appendChild(i)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const t=this.getSelectedItem();return t?this.items.indexOf(t):-1}getPrevItemIndex(t){if(t<=0)return this.items.length-1;let o=t-1;for(;;){const r=this.items[o],i=r.type,l=!(r.states&&r.states.indexOf("disabled")!==-1);if(i!=="separator"&&i!=="section"&&l)return o;if(o-=1,o<=0)return this.items.length-1}}getNextItemIndex(t){let o=t+1;for(;;){if(!this.items[o])return this.getNextItemIndex(-1);const r=this.items[o],i=r.type,l=!(r.states&&r.states.indexOf("disabled")!==-1);if(i!=="separator"&&i!=="section"&&l)return o;if(o+=1,o>this.items.length-1)return 0}}clearSelectedItem(){const t=this.getSelectedItem();if(!t)return;const o=this.getItemElementById(t.id);o&&te(o,"selected")}selectItem(t){const o=this.getSelectedItem();if(o){if(o.id===t)return;const i=o.id,s=this.getItemElementById(i);s&&te(s,"selected")}const r=this.getItemElementById(t);r?(W(r,"selected"),this.emit("selectionChange",this,r.getAttribute("data-id")||""),r.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(t){var s,l;const o=this.getSelectedItem();if(!o)return;if(this.subBar){if(((s=this.subBar.parentItem)==null?void 0:s.id)===o.id){o.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!o.children)return;const r=this.getItemElementById(o.id);if(!r)return;const i=j2.createSubCommandBar(o,(l=this.closeable)!=null?l:this,t?{id:t}:{});this.subBar=i,this.subBar.on("click",(a,d,f)=>{this.emit("click",a,d,f)}),this.subBar.on("close",()=>{var a;(a=this.subBar)==null||a.destroy(),this.subBar=null,te(r,"active")}),o.beforePopup&&o.beforePopup(i),this.subBar.manualShow(r,this.getSubBarOptions(o)),W(r,"active")}isInCommandBar(t){if(!t||!(t instanceof Node))return!1;const o=this.getCommandBarRoot();return o&&Ke(o,t)||Ke(this.content,t)?!0:this.subBar?this.subBar.isInCommandBar(t):!1}createCommandItem(t){var i,s,l,a;let o=(i=this.options.itemElementTag)!=null?i:"div";t.element&&(o="div");const r=w(o,["command-item"],null);return r.setAttribute("data-id",t.id),t.type==="separator"?r.classList.add("separator"):t.type==="section"?(r.classList.add("section","text"),t.element&&(typeof t.element=="function"?r.appendChild(t.element(t)):r.appendChild(t.element))):((s=t.states)!=null&&s.includes("selected")&&r.classList.add("selected"),(l=t.states)!=null&&l.includes("checked")&&r.classList.add("checked"),(a=t.states)!=null&&a.includes("disabled")&&r.classList.add("disabled"),r.onclick=this.handleItemClick,r.onmouseenter=this.handleItemMouseEnter,r.onmouseleave=this.handleItemMouseLeave,t.element?typeof t.element=="function"?r.appendChild(t.element(t)):r.appendChild(t.element):r.classList.add("standard")),this.initItemElement(t,r),r}getItemById(t){const o=this.items.find(r=>r.id===t);return m(ec,o,`can not find command item for id: ${t}`),o}getSelectedItem(){const t=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(t){const o=this.getItemElementId(t),r=this.items.find(i=>i.id===o);return m(ec,r,`can not find command item for id: ${o}`),r}return null}getItemElementId(t){const o=t.getAttribute("data-id");return m(ec,o,"no data-id attribute"),o}getItemElementById(t){const o=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${t}"]`);return m(ec,o,`no exists command item, id=${t}`),o}getParentCommandItemElement(t){if(!t||!(t instanceof Element))return null;if(xe(t,"command-item"))return t;const o=t.closest(".command-item");return o||null}createCommandBarContent(t){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const o=w("div",["editor-command-bar-root"],null);if(this.options.header){const i=w("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&i.appendChild(s)}else this.header||i.appendChild(this.options.header);this.header=i,this.header&&o.appendChild(this.header)}const r=w("div",["editor-command-bar"],o);if(t.forEach(i=>{var l;const s=this.createCommandItem(i);r.appendChild(s),i.element&&i.setCloseable&&i.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const i=w("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&i.appendChild(s)}else this.footer||i.appendChild(this.options.footer);this.footer=i,this.footer&&o.appendChild(this.footer)}return this.initCommandBarElement(r),o.addEventListener("wheel",this.handleWheel,{passive:!1}),o}getSubBarOptions(t){var o;return{placement:(o=t.childrenPlacement)!=null?o:"right-start"}}static registerManualCommandBar(t,o){this.commandBarCreators.set(t,o)}static createSubCommandBar(t,o,r){var l;m(ec,t.children&&t.children.length>0,"no item children");const i=(l=t.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(i);return m(ec,s,`no creator for command type: ${i}`),s(t,o,r)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let Ui=j2;g(Ui,"commandBarCreators",new Map),S("ui-command-bar");class Nh extends Ui{constructor(){super(...arguments);g(this,"tippyInstance",null)}manualShow(t,o){var r,i;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=LB.default(t,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(r=o==null?void 0:o.placement)!=null?r:"bottom-start",maxWidth:650,arrow:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:o==null?void 0:o.theme,getReferenceClientRect:o==null?void 0:o.getReferenceClientRect,offset:(i=o==null?void 0:o.offset)!=null?i:[0,0],popperOptions:this.createPopperOptions()}),o!=null&&o.point){const{x:s,y:l}=o.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(s,l,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(t){var o;super.close(t),this.isVisible&&((o=this.tippyInstance)==null||o.hide())}destroy(){var t;(t=this.tippyInstance)==null||t.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var t,o;return(o=(t=this.tippyInstance)==null?void 0:t.state.isVisible)!=null?o:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const H7=S("ui-base");class Ya extends Nh{constructor(e,t){var i;const r=[{id:(i=t==null?void 0:t.id)!=null?i:`popup-${K()}`,name:"",element:e}];super(r,void 0,{disablePageScroll:!0})}initCommandBarElement(e){W(e,"popper")}initItemElement(e,t){}get popupContent(){const e=this.items[0];m(H7,e,"no dialog item");const t=typeof e.element=="function"?e.element(e):e.element;return m(H7,t,"no item element"),t}}const zi=S("filterable-list");function j7(n){var t,o;const e=w("div",["list-item"],null);return e.setAttribute("data-id",n.id),e.appendChild(w("div",["list-item-text"],null,n.name)),(t=n.states)!=null&&t.includes("selected")&&W(e,"selected"),(o=n.states)!=null&&o.includes("disabled")&&W(e,"disabled"),e}function U7(n){const e=w("div",["list-root"],null);return n.forEach(t=>{e.appendChild(j7(t))}),n.length||e.appendChild(j7({id:"placeholder",states:["disabled"],name:O.t("search.emptyTips")})),e}function z7(n,e){let t=n;return e&&(t=n.map(o=>({...o,states:o.id===e?["selected"]:void 0}))),t}function qS(n,e){const t=w("div",["filterable-list"],null),o=w("div",["filter"],t),r=w("div",["filter-container"],o),i=w("input",["filter-input"],r);e&&e.placeholder&&(i.placeholder=e.placeholder);const s=w("div",["list"],t),l=U7(z7(n,e==null?void 0:e.initialSelectedId));return s.appendChild(l),t}function V7(n,e,t){const o=n.querySelector(".list");m(zi,o,"no list root");const r=U7(z7(e,t)),i=o.querySelector(".list-root");if(m(zi,i,"no exists menu"),ma(i,r),t){const s=o.querySelector(".list-item.selected");s&&(m(zi,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class GS{constructor(e,t){g(this,"root");g(this,"visibleItems");g(this,"selectedId");g(this,"filter","");g(this,"onSelected",null);g(this,"handleKeydown",e=>{this.processKeyDown(e)});g(this,"handleInputChanged",()=>{const e=this.root.querySelector(".filter-input");m(zi,e,"no input");const t=e.value.toLocaleLowerCase();this.setFilter(t)});g(this,"handleClick",e=>{this.processClick(e)});var o;this.items=e,this.options=t,this.root=qS(e,t),this.bindEvents(),this.selectedId=(o=t==null?void 0:t.initialSelectedId)!=null?o:"",this.visibleItems=e}bindEvents(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.addEventListener("keyup",this.handleInputChanged),e.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.removeEventListener("keyup",this.handleInputChanged),e.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(e=>e.id===this.selectedId):-1}setSelectedId(e){this.selectedId=e,V7(this.root,this.visibleItems,e)}focus(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.focus()}reset(){this.setFilter("");const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.value=""}setFilter(e){this.filter!==e&&(this.filter=e,this.visibleItems=this.items.filter(t=>t.name.toLocaleLowerCase().includes(e)),V7(this.root,this.visibleItems,this.selectedId))}processClick(e){var s,l;const t=e.target;if(!(t instanceof HTMLElement))return;const o=t.closest(".list-item");if(!o)return;const r=(s=o.getAttribute("data-id"))!=null?s:"",i=(l=this.visibleItems.find(a=>a.id===r))!=null?l:null;this.onSelected&&this.onSelected(this,i)}processKeyDown(e){var t;if(e.key==="ArrowUp"){let o=this.getSelectedIndex();o===-1?o=this.visibleItems.length-1:o>0&&(o-=1);let r="";o!==-1&&(r=this.visibleItems[o].id),this.setSelectedId(r);return}if(e.key==="ArrowDown"){let o=this.getSelectedIndex();o===-1?o=0:o<this.visibleItems.length-1&&(o+=1);let r="";o!==-1&&(r=this.visibleItems[o].id),this.setSelectedId(r);return}if(e.key==="Enter"){const o=(t=this.visibleItems.find(r=>r.id===this.selectedId))!=null?t:null;this.onSelected&&this.onSelected(this,o)}}}class ZS extends GS{constructor(t,o,r){super(t,r);g(this,"popup");g(this,"onShow",null);g(this,"onHide",null);g(this,"custom",null);g(this,"handleShow",()=>{this.onShow&&this.onShow(this)});g(this,"handleHide",()=>{this.onHide&&this.onHide(this)});g(this,"handleShown",()=>{this.focus()});this.popup=new Ya(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(t){this.reset(),this.popup.manualShow(t,{theme:"dropdown-list"}),this.focus()}processKeyDown(t){super.processKeyDown(t),(t.key==="Esc"||t.key==="Enter")&&this.popup.close("cancelBar")}processClick(t){super.processClick(t);const o=t.target;!(o instanceof HTMLElement)||!o.closest(".list-item")||this.popup.close("clickItem")}}const Lte="",Mte="";function QS(n,e){const t=document.createElement("div");t.classList.add("toast","show"),e!=null&&e.theme&&t.setAttribute("data-theme",e.theme),e!=null&&e.id&&t.setAttribute("data-id",e.id),e!=null&&e.html?t.innerHTML=n:t.textContent=n,e!=null&&e.position&&(t.style.left=`${e.position.x}px`,t.style.top=`${e.position.y}px`,t.classList.add("positioned")),document.body.appendChild(t),setTimeout(()=>{t.classList.remove("show"),setTimeout(()=>{t.remove()},500)},(e==null?void 0:e.duration)||3e3)}const W7=`<?xml version="1.0" ?>
27
+ `)}const $I=S("get-text-position");function ql(n,e){const t=e!=null?e:n.selection.range.start;t instanceof $t||m($I,!1,`invalid insert pos type: ${typeof t}`);const{blockId:o}=t,r=n.getBlockById(o),i=be(r),s=ne(r),l=ae(s),{offset:a}=t;return{block:r,container:s,containerId:l,blockIndex:i,offset:a}}const Da=S("insert-text");function C6(n,e,t,o){var s;const r=n.doc.getBlockData(e,t);if(m(Da,r,"no block data"),m(Da,r.text,"no block text"),rn(r.text)===0)return m(Da,o===0,"invalid text offset"),n.editorCommandProviders.getEmptyBlockTextAttributes(n,r.id);if(o===0)return;const i=jt(r.text,o-1,1).middle;if(!((s=i[0].attributes)!=null&&s.box))return i[0].attributes}function HI(n,e,t){const o=ne(e),r=ae(o),i=be(e);return C6(n,r,i,t)}function A6(n,e,t,o,r){const i=ne(e),s=ae(i),l=be(e),a=HI(n,e,t),d=th(t,o,a!=null?a:null);return n.doc.localUpdateBlockText(s,l,d,r),mn(n,e)}function b6(n,e,t,o){const r=ne(e),i=ae(r),s=be(e),l=th(t," ",o);return n.doc.localUpdateBlockText(i,s,l),mn(n,e)}function Ag(n,e,t,o,r){const i=n.doc.getBlockData(t,o);m(Da,i,"no block data"),m(Da,i.text,"no block text");const s=C6(n,t,o,r),l=th(r,e,s!=null?s:null);return n.doc.localUpdateBlockText(t,o,l),mn(n,n.getBlockById(i.id))}function bg(n,e){n.selection.range.isCollapsed()||n.clearSelectedContents();const{containerId:t,blockIndex:o,offset:r}=ql(n);Ag(n,e,t,o,r)}const hh=S("update-composition-text");function v6(n){const e=n.selection.range.start;e instanceof $t||m(hh,!1,`invalid insert pos type: ${typeof e}`);const{blockId:t}=e,o=n.getBlockById(t);m(hh,ee(n,o),"not a text kind block");const r=ne(o),i=ae(r),s=be(o),l=n.doc.getBlockData(i,s);m(hh,l,"no block data in doc"),m(hh,l.text,"no text data in text block");const a=Re(o);Jd(n,Di(o),t,a,l.text)}function y6(n){Ax(n)}function Gl(n,e,t,o,r,i){return n.doc.localInsertBlock(e,t,o,r,i),n.getBlockById(o.id)}const Sa=S("delete-block-text");function vg(n,e,t,o,r){if(!n.isBlockWritable(e))return Sa.error("block is not writable"),0;m(Sa,ee(n,e),"block is not a text kind block");const i=ne(e),s=ae(i),l=be(e),a=n.doc.getBlockData(s,l);m(Sa,a,"no block data in doc"),m(Sa,a.text,"no text data in text block");let d=t;sn(e,t)||(d=Ri(e,d));let f=t+o;m(Sa,f<=ue(n,e),`invalid offset and count: ${t}, ${o}`),sn(e,f)||(f=Os(e,f));const p=f-d,A=S4(d,p);return n.doc.localUpdateBlockText(s,l,A,r),p}const yg=S("break-text-block");function k6(n,e){const o=n.getBlockData(e).quoted;return o?{quoted:o}:{}}function Zl(n,e,t,o){m(yg,ee(n,e),`block is not a text kind block: ${Se(e)}`),m(yg,t>=0&&t<=ue(n,e),`invalid offset: ${t}`);const r=ne(e),i=ae(r),s=be(e),l=o!=null&&o.copyBlockAttributes?k6(n,e):{};if(!(o!=null&&o.forceInsertAfter)&&(t===0||t===ue(n,e))){const v=t===0?s:s+1,B={...sr(""),...l,...o==null?void 0:o.newBlockData},D=bt(n,e.id,0),I=Gl(n,i,v,B,D);return{block:e,newBlock:I}}m(yg,sn(e,t),"not a valid offset");const a=mn(n,e),{right:d}=xn(a,t),f=rn(d);f>0&&vg(n,e,t,f);const p={...sr(d),...l,...o==null?void 0:o.newBlockData},A=Gl(n,i,s+1,p,bt(n,p.id,0));return{block:e,newBlock:A}}const jI=S("prepare-insert-new-block");function UI(n,e,t){if(e&&t!==void 0&&t!==null){const d=n.getContainerById(e),f=At(d);return m(jI,t>=0&&t<=f.length,`invalid blockIndex: ${t}`),{containerId:e,blockIndex:t}}const o=n.selection.range.start;if(!o.isSimple())return null;const r=n.getBlockById(o.blockId);if(e=ae(ne(r)),t=be(r),!ee(n,r))return{containerId:e,blockIndex:t+1};const s=o.offset;if(s===0||s===ue(n,r))return{containerId:e,blockIndex:s===0?t:t+1};const a=Zl(n,r,s).newBlock;return{containerId:e,blockIndex:be(a)}}const zI=S("auto-insert-block");function w6(n,e,t,o,r,i){const s=UI(n,t,o);m(zI,s,`not an valid insert position: ${n.selection.range}`);const l={blockId:e.id,offset:0},a={anchor:l,focus:l};return Gl(n,s.containerId,s.blockIndex,e,r!=null?r:a,i)}const VI=S("delete-block");function fh(n,e,t){e.children&&(t.push(...e.children),e.children.forEach(o=>{n.getChildContainerData(o).forEach(i=>{fh(n,i,t)})}))}function mh(n,e,t){const o=ne(e),r=ae(o),i=be(e),s=n.doc.getBlockData(r,i);return m(VI,s,"no block data in doc"),n.doc.localDeleteBlock(r,i,Ht(n,{anchor:t.start,focus:t.end})),s}function kg(n,e,t){return n.undoManager.runInGroup(()=>{const o=ne(e);Bo(o)===1&&n.insertTextBlock("",ae(o),0);let r=t?Si(n,t):null;if(!r){const l=n.selection.range;f6(e,l)?r=m6(n,e):r=l}const i=mh(n,e,r),s=[];return fh(n,i,s),s.length>0&&n.doc.localDeleteChildContainers(s),i})}function WI(n,e){const t=[e];n.doc.getContainerBlocks(e).forEach(r=>{fh(n,r,t)}),n.doc.localDeleteChildContainers(t)}function B6(n,e){const t=[...e];e.forEach(o=>{n.doc.getContainerBlocks(o).forEach(i=>{fh(n,i,t)})}),n.doc.localDeleteChildContainers(t)}const wg=S("merge-text-block");function E6(n,e,t){m(wg,ee(n,e),"only text block can be merged"),m(wg,ee(n,t),"only text block can be merged");const o=_i(n,e),r=_i(n,t),i=o.text,s=r.text;m(wg,i&&s,"block data has no text");const l=ne(e),a=ae(l),d=be(e),f=ue(n,e),p=Ag(n,s,a,d,f),A=bt(n,e,rn(i));return kg(n,t,A),p}const lr=S("clear-selected-contents");function gh(n,e){m(lr,ee(n,e.block),"not a text kind block");const{start:t,end:o}=e;m(lr,t.isSimple(),"not a simple block position"),m(lr,o.isSimple(),"not a simple block position");const r=t.offset,i=o.offset;m(lr,r<=i,`invalid delete text offset: ${r}, ${i}`),r!==i&&n.deleteTextFromBlock(e.block,r,i-r)}function x6(n,e,t){const o=ae(e),r=At(e),i=t.focus?void 0:n.selection.range.toDocRange(),s=n.insertTextBlock("",o,0,{newRange:i});t.focus&&n.selection.selectBlock(s,0),r.reverse().forEach(l=>{n.deleteBlock(l)})}function qI(n,e){const{block:t,start:o,end:r}=e;if(ee(n,t)){gh(n,e);return}if(Lt(t)||o.isSimple()){m(lr,r.isSimple(),"invalid range");const s=ne(t),l=be(t),a=n.insertTextBlock("",ae(s),l);n.selection.selectBlock(a,0),n.deleteBlock(t);return}m(lr,Le(n,t),"invalid block kind"),m(lr,!o.isSimple()&&!r.isSimple(),"invalid range"),Ms(n,t,o,r),n.selection.range.getSelectedContainers().forEach((s,l)=>{x6(n,s,{focus:l===0})})}function GI(n){if(!n.isWritable())return;const e=n.selection.range;if(e.isCollapsed())return;const t=e.getSelectedBlocks();if(m(lr,t.length>0,"no selected block"),t.length===1){qI(n,t[0]);return}const o=t[0],r=o.block,i=ne(r);m(lr,t.length>1,"no selected block");const s=t[t.length-1],l=s.block;if(ee(n,r)){gh(n,o);const f=bt(n,o.block,o.start.offset);if(t.slice(1,t.length-1).reverse().forEach(A=>n.deleteBlock(A.block)),ee(n,l)){gh(n,s),n.mergeTextBlock(r,l,{focus:!0}),n.selection.setRange(f);return}n.deleteBlock(l),n.selection.setRange(f);return}if(ee(n,l)){gh(n,s),t.slice(0,t.length-1).reverse().forEach(f=>n.deleteBlock(f.block)),n.selection.selectBlock(s.block,0);return}if(t.length===Bo(i)){x6(n,i,{focus:!0});return}const a=lt(r),d=Ze(l);m(lr,a||d,"no prev or next block"),t.forEach(f=>n.deleteBlock(f.block))}function Bg(n){n.selection.range.isCollapsed()||n.undoManager.runInGroup(()=>{n.emit("beforeClearSelection",n);try{n.doc.beginBatchUpdate(),GI(n)}finally{n.doc.endBatchUpdate()}n.emit("afterClearSelection",n)})}const ZI=S("core");function I6(n,e,t){const o=ne(e),r=ae(o),i=be(e);return n.doc.localUpdateBlockText(r,i,t),setTimeout(()=>{n.selection.updateSelection(null)}),mn(n,e)}function T6(n,e,t){if(!n.isBlockWritable(e)){ZI.error("block is not writable");return}const o=n.getBlockText(e),r=ln.diff(o,t);I6(n,e,r)}function ph(n,e,t){const o=mn(n,e),r=typeof t=="string"?Oi(t):t,i=ln.diff(o,r);return I6(n,e,i)}const La=S("update-block-data");function Ch(n,e,t,o){const r=ne(e),i=ae(r),s=be(e),l=n.doc.getBlockData(i,s),a={insert:{},delete:[]},d=new Set(Object.keys(l)),f=new Set(Object.keys(t));return d.forEach(A=>{if(!f.has(A)){if(A==="id"||A==="type"||A==="text")return;La.debug(`delete key: ${A}`),a.delete.push(A)}}),Object.entries(t).forEach(([A,v])=>{m(La,A!=="id"&&A!=="type",`invalid block data delta, ${A}`);const B=l[A];if(v==null){B!=null&&(La.debug(`delete key: ${A}`),a.delete.push(A));return}B!==v&&(la.default(B,v)||A==="text"&&ln.diff(B,v).length===0||(d.has(A)?(La.debug(`replace key: ${A}`),a.delete.push(A)):La.debug(`insert key: ${A}`),a.insert[A]=v))}),n.doc.localUpdateBlockData(i,s,a,o),_i(n,e)}function D6(n,e,t,o){const i={...n.getBlockData(e),embedData:t};return n.updateBlockData(e,i,o)}function Eg(n,e,t){if(!Le(n,e)||!(t!=null&&t.tryFocusToChildSimpleBlock)){n.selection.selectBlock(e,0);return}const r=jn(n,e).getChildContainers(n,e)[0],i=St(r);Eg(n,i,t)}function Fs(n){const e=[];let t={};return n.forEach(o=>{e.push(...o.blocks.root);const{root:r,...i}=o.blocks;t={...t,...i}}),{blocks:{...t,root:e},meta:{},comments:{}}}const Ma=S("clone-block");function Pi(n,e,t,o){const r=n.getBlockClass(t.type);if(r.blockToDoc)return r.blockToDoc(e,t,(f,p)=>(m(Ma,t!==p,"invalid child block"),Pi(n,f,t,o)));let i={};const s=new Map,l=fe.default(t);l.children&&(l.children=l.children.map(f=>{const p=K(),A=e.blocks[f];m(Ma,Array.isArray(A),"invalid child blocks");const v=A.map(_=>Pi(n,e,_,o)),B=Fs(v),{root:D,...I}=B.blocks;return i={...i,...I},i[p]=B.blocks.root,s.set(f,p),p}));const a=Array.from(s.entries()),d=f=>{for(const p of a){const[A,v]=p;{const B=`${A}/`;if(f.startsWith(B)){const D=f.substring(B.length),I=`${v}/${D}`;return Ma.debug(`replace key: ${f} -> ${I}`),I}}{const B=`${A}_`;if(f.startsWith(B)){const D=f.substring(B.length),I=`${v}_${D}`;return Ma.debug(`replace key: ${f} -> ${I}`),I}}}return f};return Array.from(Object.entries(l)).forEach(([f,p])=>{const A=d(f);A!==f&&delete l.key,l[A]=p}),l.id=K(),o&&(o.blockIdMap.set(t.id,l.id),s.forEach((f,p)=>o.containerIdMap.set(p,f))),{blocks:{root:[l],...i},meta:{},comments:{}}}function xg(n,e,t,o){const r=e.blocks[t];m(Ma,Array.isArray(r),"invalid child blocks");const i=r.map(l=>Pi(n,e,l,o));return Fs(i)}function Ig(n,e,t){const o=e.blocks.root.map(r=>Pi(n.editorBlocks,e,r,t));return fe.default(Fs(o))}const S6=S("insert-doc");function L6(n,e,t,o,r){if(Le(n,e)){S6.warn("failed to insert doc into a complex block");return}const i=Ig(n,o,r),s=ne(e),l=be(e),a=ae(s);n.doc.beginBatchUpdate(),n.undoManager.runInGroup(()=>{var R,U,z;Object.entries(i.blocks).forEach(([q,oe])=>{q!=="root"&&n.doc.localInsertChildContainer(q,oe)});const d=i.blocks.root;if(Lt(e)){n.deleteBlock(e);let q;d.reverse().forEach(oe=>{const me=n.insertBlock(a,l,oe);q||(q=me)}),q&&n.selection.selectBlock(q,ue(n,q));return}if(m(S6,ee(n,e),"not a text block"),dt(n,e)){const q=a==="root"&&n.getBlockByIndex(a,0)===e,oe=be(e);let me;d.forEach((Be,je)=>{const Ue=n.insertBlock(a,oe+je,Be);je===d.length-1&&(me=Ue)}),me&&n.selection.selectBlock(me,ue(n,me)),q&&n.deleteBlock(e);return}if(d.length===1){const q=d[0];if(Ca(n,q.type)){n.insertTextToBlock(e,t,(R=q.text)!=null?R:[]);return}n.breakTextBlock(e,t),n.insertBlock(a,l+1,q);return}const f=t===ue(n,e),p=t===0,A=d[0],v=d[d.length-1];let B;!f&&!p?B=n.breakTextBlock(e,t,{forceInsertAfter:!0}):B=e;const D=p?l:l+1;f?(B=n.insertBlock(a,l+1,v),n.selection.selectBlock(B,ue(n,B))):(n.selection.selectBlock(B,0),Ca(n,v.type)?n.insertTextToBlock(B,0,(U=v.text)!=null?U:[]):n.insertBlock(a,D,v));const I=n.selection.range;let _=D;Ca(n,A.type)?p?(n.insertBlock(a,D,A),_+=1):n.insertTextToBlock(e,t,(z=A.text)!=null?z:[]):(n.insertBlock(a,D,A),_+=1),d.slice(1,d.length-1).reverse().forEach(q=>{n.insertBlock(a,_,q)}),n.selection.setRange(I)}),n.doc.endBatchUpdate()}function Tg(n,e,t,o,r){const i=Ig(n,o,r),s=ae(e),l=[];return n.undoManager.runInGroup(()=>{Object.entries(i.blocks).forEach(([d,f])=>{d!=="root"&&n.doc.localInsertChildContainer(d,f)}),i.blocks.root.reverse().forEach(d=>{const f=n.insertBlock(s,t,d);l.push(f)})}),l}function M6(n,e,t){const o=Bo(e);Tg(n,e,o,t);for(let r=0;r<o;r++){const i=St(e);n.deleteBlock(i)}}const Ra=S("add-text-attribute");function QI(n,e,t,o){const{start:r,end:i}=t;m(Ra,r.blockId===i.blockId&&r.blockId===ie(e),"invalid range"),m(Ra,o,"invalid attribute name");const s=n.getBlockText(e),l=Wl(r.offset,i.offset-r.offset,s,o,void 0,{ignoreValue:!0});return n.setBlockText(e,l),l}function R6(n,e,t,o,r){const{start:i,end:s}=t;m(Ra,i.blockId===s.blockId&&i.blockId===ie(e),"invalid range"),m(Ra,o,"invalid attribute name");const l=n.getBlockText(e),a=wa(i.offset,s.offset-i.offset,l,o,r);return n.setBlockText(e,a),a}function Ql(n,e,t,o,r){const{start:i,end:s}=t;m(Ra,i.blockId===s.blockId&&i.blockId===ie(e),"invalid range");const l=n.getBlockText(e),a=$4(i.offset,s.offset-i.offset,l,o,r);return n.setBlockText(e,a),a}function O6(n,e,t,o){const r=So(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{r.forEach(i=>{const{block:s,start:l,end:a}=i;if(!ee(n,s))return;if(dt(n,s)){o(n,ie(s),e,t);return}const d=Ht(n,{anchor:l,focus:a});e==="color"||e==="backgroundColor"?Ql(n,s,d,e,t):(Ql(n,s,d,"color",null),Ql(n,s,d,"backgroundColor",null))})})}function _6(n,e,t){const o=So(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{o.forEach(r=>{const{block:i,start:s,end:l}=r;if(!ee(n,i))return;if(dt(n,i)){(e==="clearColor"||e==="clearAll")&&t(n,ie(i),"color",null),(e==="clearBackground"||e==="clearAll")&&t(n,ie(i),"backgroundColor",null);return}const a=Ht(n,{anchor:s,focus:l});(e==="clearColor"||e==="clearAll")&&Ql(n,i,a,"color",null),(e==="clearBackground"||e==="clearAll")&&Ql(n,i,a,"backgroundColor",null)})})}function Dg(n,e){const t=So(n,{simpleBlockOnly:!0}).filter(s=>ee(n,s.block));if(t.length===0)return[null,null];const o=s=>{if(ue(n,s.block)===0)return e(n,ie(s.block));const l=s.start,a=s.end,d=n.getBlockText(s.block);return U4(l.offset,a.offset-l.offset,d)};let[r,i]=o(t[0]);return r===null&&i===null?[r,i]:(t.forEach(s=>{const[l,a]=o(s);l===null||r===null?r=null:r=l===r?r:null,a===null||i===null?i=null:i=a===i?i:null}),[r,i])}const Vn=S("adjust-selection-pos");function P6(n){const e=[];for(;n;){const t=ne(n);if(e.unshift(t),Xe(t))return e;const o=re(t);m(Vn,o,"child container has not parent container"),n=o}m(Vn,!1,"should not come here: getParentContainers")}function F6(n,e){for(;e;){const t=ne(e);if(t===n)return e;const o=re(t);m(Vn,o,"could not find parent block for a child container"),e=o}m(Vn,!1,"no parent block in specified container")}function YI(n,e){const t=P6(n),o=P6(e);m(Vn,t.length>0&&o.length>0,"block has not parent container"),m(Vn,t[0]===o[0],"root container does not equal");let r=t[0];for(let l=1;l<t.length||o.length;l++)if(t[l]!==o[l]){r=t[l-1];break}const i=F6(r,n),s=F6(r,e);return{parentContainer:r,newBlock1:i,newBlock2:s}}function N6(n,e){let t=re(e);for(m(Vn,t,"element is not in a block");t;){const o=ne(t);m(Vn,To(o),"not a child container");const r=re(o);if(m(Vn,r,"child container has not parent block"),r===n)return o;t=r}m(Vn,!1,"failed to find parent container in complex block")}function Ah(n,e,t){const o=n.getBlockById(e.blockId),r=n.getBlockById(t.blockId);if(o===r)return e instanceof $t&&t instanceof $t?{anchor:e,focus:t}:e instanceof Do&&t instanceof Do?Qd(n,o,e,t):null;const i=ne(o),s=ne(r);if(i===s)return e instanceof Do&&(e=se(o,0,"home")),t instanceof Do&&(t=se(r,ue(n,r),"end")),m(Vn,e instanceof $t,"not valid position type"),m(Vn,t instanceof $t,"not valid position type"),{anchor:e,focus:t};if(o.contains(s))return null;if(r.contains(i)){if(e instanceof $t&&t instanceof Do){const B=n.getContainerById(t.childContainerId);if(B===i)return{anchor:t,focus:t};const D=re(i);if(D&&D===re(B)){const I=ht(D,ae(i)),_=ht(D,ae(B));return Qd(n,D,I,_)}}return null}const l=Pd(o,r)>0,{newBlock1:a,newBlock2:d}=YI(o,r);if(a===d){const B=a,D=N6(B,o),I=N6(B,r);return e=ht(a,ae(D)),t=ht(a,ae(I)),Vn.debug(`select in complex block: ${D.id}, ${I.id}`),Qd(n,B,e,t)}let f=l?ue(n,a):0;a===o&&e instanceof $t&&(f=e.offset);let A=l?0:ue(n,d);return d===r&&t instanceof $t&&(A=t.offset),e=se(a,f,l?"end":"home"),t=se(d,A,l?"home":"end"),{anchor:e,focus:t}}const JI=S("move-complex-block-position");function KI(n,e,t){const o=n.getBlockById(e.blockId);m(JI,Le(n,o),"is not a complex block");const r=jn(n,o),i=n.getContainerById(e.childContainerId),s=r.getNextContainer(n,o,i,t,{noWrap:!0});return s?ht(o,ae(s)):null}const Oa=S("move-simple-block-position");function $6(n,e){const t=En(n,e,{visibleOnly:!0});m(Oa,t.length>0,"complex block has not any child container");const o=t[0];return St(o)}function H6(n,e){const t=En(n,e,{visibleOnly:!0});m(Oa,t.length>0,"complex block has not any child container");const o=t[t.length-1];return Gt(o)}function j6(n,e,t){const o=t?$6(n,e):H6(n,e);return Le(n,o)?j6(n,o,t):o}function XI(n,e){const t=n.getBlockById(e.blockId);return Le(n,t)&&e.offset===0?$6(n,t):Ds(t)}function eT(n,e){const t=n.getBlockById(e.blockId);return Le(n,t)&&e.offset===1?H6(n,t):Ts(t)}function Sg(n){return n==="ArrowLeft"||n==="ArrowUp"}function Lg(n,e,t){const o=ne(e);if(Xe(o))return null;const r=re(o);m(Oa,r,"child container has not parent block"),m(Oa,Le(n,r),"is not a complex block");const i=jn(n,r).getNextContainer(n,r,o,t);return i?Sg(t)?Gt(i):St(i):Lg(n,r,t)}function tT(n,e,t){const o=ne(e);if(Xe(o))return null;const r=re(o);if(m(Oa,r,"child container has not parent block"),Sg(t)){const l=lt(r);if(l)return l}else{const l=Ze(r);if(l)return l}const i=Lg(n,r,t);if(i)return i;let s=r;for(;!Xe(ne(s));)s=re(ne(s));return Sg(t)?lt(s):Ze(s)}function nT(n,e,t){return!Le(n,e)||jn(n,e).enableKeyboardSelect?e:j6(n,e,t==="ArrowDown"||t==="ArrowRight")}function oT(n,e,t){const o=n.getBlockById(e.blockId),i=Qe(n,o).moveCaret(n,o,e,t);if(i)return i;let s=t==="ArrowDown"||t==="ArrowRight"?XI(n,e):eT(n,e);if(s||(s=Lg(n,o,t),s||(s=tT(n,o,t))),!s){if(t==="ArrowDown"||t==="ArrowRight"){if(n.readonly||!Xe(ne(o)))return null;const l=n.insertTextBlock("",ae(n.rootContainer),Bo(n.rootContainer));return se(l,0,"home")}return null}if(s=nT(n,s,t),ee(n,s)){const l=n.selection.getSuggestedCaretX();if(t==="ArrowDown")return Sx(n,s,o,e,l);if(t==="ArrowUp")return Dx(n,s,o,e,l)}return t==="ArrowLeft"||t==="ArrowUp"?se(s,ue(n,s),"end"):t==="ArrowRight"||t==="ArrowDown"?se(s,0,"home"):null}function rT(n,e,t){if(e==="ArrowLeft")return t.start;const o=t.end,r=n.getBlockById(o.blockId);if(ee(n,r))return o;const i=Ze(r);if(i)return se(i,0,"home");if(!Xe(ne(r))||n.readonly)return o;const s=n.insertTextBlock("",ae(n.rootContainer),Bo(n.rootContainer));return se(s,0,"home")}function iT(n,e,t){const o=n.selection.range;let r;if(o instanceof Zt)t==="move"&&!o.isCollapsed()&&(e==="ArrowLeft"||e==="ArrowRight")?r=rT(n,e,o):r=oT(n,o.getFocusedPos(),e);else if(r=KI(n,o.focus,e),t==="move"){const i=r!=null?r:o.focus,s=n.getContainerById(i.childContainerId);if(e==="ArrowLeft"||e==="ArrowUp"){const l=Gt(s);r=se(l,0,"home")}else{const l=St(s);r=se(l,ue(n,l),"end")}}return r?t==="move"?{anchor:r,focus:r}:Ah(n,o.anchor,r):null}function Fi(n,e,t){const o=iT(n,e,t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),(e==="ArrowLeft"||e==="ArrowRight")&&n.selection.updateLastCaretRect(),!0}function U6(n){return Fi(n,"ArrowLeft","move"),!0}function z6(n){return Fi(n,"ArrowRight","move"),!0}function V6(n){return Fi(n,"ArrowUp","move"),!0}function W6(n){if(Fi(n,"ArrowDown","move")||n.readonly)return!0;const e=n.getFocusedBlock(),t=ne(e);if(Xe(t)||Gt(t)!==e)return!0;const o=n.rootContainer;return n.insertTextBlock("",ae(o),Bo(o)),!0}function q6(n){return Fi(n,"ArrowDown","select"),!0}function G6(n){return Fi(n,"ArrowLeft","select"),!0}function Z6(n){return Fi(n,"ArrowRight","select"),!0}function Q6(n){return Fi(n,"ArrowUp","select"),!0}const Y6=S("word-offset");function Mg(n,e){const t=n.selection.range.focus;m(Y6,t.isSimple(),"invalid range type");const o=n.getBlockById(t.blockId);if(dt(n,o))return se(o,0,"home");if(t.offset===0||!ee(n,o)){const s=lt(o);if(!s)return null;const l=se(s,ue(n,s),"end");if(e==="select"&&ee(n,s)){const a=ug(n,s,l.offset);return se(s,a,"normal")}return l}const r=ug(n,o,t.offset);return se(o,r,"normal")}function Rg(n,e){const t=n.selection.range.focus;m(Y6,t.isSimple(),"invalid range type");const o=n.getBlockById(t.blockId);if(dt(n,o))return se(o,0,"end");if(t.offset===ue(n,o)||!ee(n,o)){const s=Ze(o);if(!s)return null;const l=se(s,0,"home");if(e==="select"&&ee(n,s)){const a=dg(n,s,l.offset);return se(s,a,"end")}return l}const r=dg(n,o,t.offset);return se(o,r,"normal")}function J6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Mg(n,"move");return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function K6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Rg(n,"move");return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function X6(n){if(!n.selection.range.focus.isSimple())return!1;const t=Mg(n,"select");return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function e9(n){if(!n.selection.range.focus.isSimple())return!1;const t=Rg(n,"select");return t?(n.selection.setSelection(n.selection.range.anchor,t),n.selection.updateLastCaretRect(),!0):!1}S("find-block");function Og(n,e){if(!Le(n,e))return e;const o=jn(n,e).getChildContainers(n,e)[0],i=At(o)[0];return Og(n,i)}function _g(n,e){if(!Le(n,e))return e;const t=jn(n,e).getChildContainers(n,e),o=t[t.length-1],r=At(o),i=r[r.length-1];return _g(n,i)}function t9(n){const e=_g(n,Gt(n.rootContainer)),t=se(e,ue(n,e),"end");return n.selection.setSelection(t),!0}function n9(n){const e=Og(n,n.getFirstBlock()),t=se(e,0,"home");return n.selection.setSelection(t),!0}function o9(n){const e=Og(n,n.getFirstBlock()),t=se(e,0,"home");return n.selection.setSelection(n.selection.getAnchorPos(),t),!0}function Pg(n){const e=_g(n,Gt(n.rootContainer)),t=se(e,ue(n,e),"end");return n.selection.setSelection(n.selection.getAnchorPos(),t),!0}const r9=S("line-offset");function i9(n){const e=n.selection.range.focus;m(r9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId);if(e.offset===0||!ee(n,t))return se(t,0,"home");let r=E4(t,e).start;const{next:i}=qd(t,r);return i&&oo(i)&&pa(i)==="br"&&(r+=1),se(t,r,"home")}function s9(n){const e=n.selection.range.focus;m(r9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId);if(e.offset===ue(n,t)||!ee(n,t))return se(t,ue(n,t),"end");const o=E4(t,e);return se(t,o.end,"end")}function l9(n){if(!n.selection.range.focus.isSimple())return!1;const t=i9(n);return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function c9(n){if(!n.selection.range.focus.isSimple())return!1;const t=s9(n);return t?(n.selection.setSelection(n.selection.getAnchorPos(),t),n.selection.updateLastCaretRect(),!0):!1}function a9(n){if(!n.selection.range.focus.isSimple())return!1;const t=i9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function u9(n){if(!n.selection.range.focus.isSimple())return!1;const t=s9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}const d9=S("find-block-position");function sT(n,e,t,o){m(d9,Le(n,e),"is not a complex block");const r=jn(n,e).getChildContainers(n,e);m(d9,r.length>0,"complex block has not any child container");const i=Io(n,t,o),s=i.left+i.width/2,l=i.top+i.height/2,a=m4(n,e,s,l);return Fg(n,a,t,o)}function Fg(n,e,t,o){if(Le(n,e))return sT(n,e,t,o);const r=ie(e);let i=Number.MAX_SAFE_INTEGER;const s=Io(n,t,o),l=s.left+s.width/2,a=s.top+s.height/2;let d=se(r,0,"home");const f=ue(n,e);for(let p=0;p<=f;p++){const A=se(r,p,"normal"),v=Io(n,e,A),B=tr(v,l,a);B<i&&(i=B,d=A)}return d}const h9=S("page-offset");function lT(n,e){const t=u6(n)*.9,r=e.getBoundingClientRect().bottom-t;if(r<LI(n))return n.getFirstBlock();const i=lt(e);if(!i)return n.getFirstBlock();let s=i;for(;s;){if(s.getBoundingClientRect().y<r)return s;s=lt(s)}return n.getFirstBlock()}function cT(n,e){const t=u6(n)*.9,o=e.getBoundingClientRect(),r=MI(n),i=o.top+t;if(i>r)return n.getLastBlock();const s=Ze(e);if(!s)return n.getLastBlock();let l=s;for(;l;){if(l.getBoundingClientRect().bottom>i)return l;l=Ze(l)}return n.getLastBlock()}function f9(n){const e=n.selection.range.focus;m(h9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId),o=lT(n,t);let r;return o===n.getFirstBlock()?r=se(o,0,"home"):r=Fg(n,o,t,e),r}function m9(n){const e=n.selection.range.focus;m(h9,e.isSimple(),"invalid range type");const t=n.getBlockById(e.blockId),o=cT(n,t);let r;return o===n.getLastBlock()?r=se(o,ue(n,o),"end"):r=Fg(n,o,t,e),r}function g9(n){if(!n.selection.range.focus.isSimple())return!1;const t=f9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function p9(n){if(!n.selection.range.focus.isSimple())return!1;const t=m9(n);return t?(n.selection.setSelection(t),n.selection.updateLastCaretRect(),!0):!1}function C9(n){if(!n.selection.range.focus.isSimple())return!1;const t=f9(n);if(!t)return!1;const o=Ah(n,n.selection.getAnchorPos(),t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),n.selection.updateLastCaretRect(),!0}function A9(n){if(!n.selection.range.focus.isSimple())return!1;const t=m9(n);if(!t)return!1;const o=Ah(n,n.selection.getAnchorPos(),t);if(!o)return!1;const{anchor:r,focus:i}=o;return n.selection.setSelection(r,i),n.selection.updateLastCaretRect(),!0}const _a=S("select-all");function b9(n,e){const t=St(n),o=Gt(n);return e.start.offset===0&&e.start.blockId===ie(t)&&e.end.offset===ue(e.getEditor(),o)&&e.end.blockId===ie(o)}function aT(n,e){const t=e.getEditor(),o=jn(t,n).getChildContainers(t,n),r=o[0],i=o[o.length-1],s=ie(n);return e.start.blockId===s&&e.start.childContainerId===ae(r)&&e.end.blockId===s&&e.end.childContainerId===ae(i)}function uT(n,e){m(_a,e,"no parent block"),m(_a,Le(n,e),"not a complex block");const t=jn(n,e).getChildContainers(n,e),o=t[0],r=t[t.length-1];n.selection.setRange(Ht(n,{anchor:ht(e,ae(o)),focus:ht(e,ae(r))}))}function v9(n,e){const t=ne(e);Ng(n,t)}function y9(n){const e=n.getFocusedBlock(),t=n.selection.range;if(t.start.isSimple()){if(t.start.blockId===t.end.blockId&&ee(n,e)){const r=t.start,i=t.end,s=ue(n,e);if(r.offset>0||i.offset<s)return n.selection.selectBlock(e,0,s),!1}return W(n.rootContainer,"select-all"),v9(n,St(n.rootContainer)),!1}return m(_a,!t.isSimple(),"invalid range type"),aT(e,t)?(v9(n,e),!1):(m(_a,e,"no parent block"),m(_a,Le(n,e),"not a complex block"),uT(n,e),!0)}function Ng(n,e){const t=At(e),o=t[0],r=t[t.length-1],i=se(o,0,"home"),s=se(r,ue(n,r),"end");n.selection.setSelection(i,s,{noScroll:!0})}function k9(n){Pg(n),n.focus()}const $g=S("selected-block-to-doc");function w9(n,e,t){!e.children||e.children.forEach(o=>{const r=n.getChildContainerData(o);r.forEach(i=>{w9(n,i,t)}),t.blocks[o]=fe.default(r)})}function bh(n,e){const t=Qe(n,e.block);if(t.selectionToDoc)return t.selectionToDoc(n,e);const o=fe.default(_i(n,e.block));if(ee(n,e.block)){const i=e.start,s=e.end;if(m($g,o.text,"no block text"),i.offset===s.offset)return{blocks:{root:[{...o,text:[]}]},meta:{},comments:{}};const{middle:l}=jt(o.text,i.offset,s.offset-i.offset);return{blocks:{root:[{...o,text:l}]},meta:{},comments:{}}}if(Lt(e.block))return{blocks:{root:[o]},meta:{},comments:{}};m($g,Le(n,e.block),"not complex block"),m($g,o.children,"no children");const r={blocks:{root:[o]},meta:{},comments:{}};return w9(n,o,r),r}function Hg(n,e){const t=se(e,0,"normal"),o=se(e,ue(n,e),"end");return bh(n,{block:e,start:t,end:o})}const dT=S("block-to-doc");function hT(n,e){m(dT,e.length>0,"invalid params, no blocks");const t=e.map(o=>Hg(n,o));return Fs(t)}function vh(n){const t=n.selection.range.getSelectedBlocks().map(o=>bh(n,o));return Fs(t)}function B9(n,e){const t=n.getContainerById(e),i=At(t).map(s=>({start:se(s,0,"home"),end:se(s,ue(n,s),"end"),block:s})).map(s=>bh(n,s));return Fs(i)}const yh=S("editor-selection");class fT{constructor(e){g(this,"editor");g(this,"caret");g(this,"_range");g(this,"lastCaretRect");g(this,"handleBlockDelete",(e,t,o,r)=>{if(o||r.child)return;const i=this.range;if(f6(t,i)){yh.debug("adjust selection because remote deleted current block");const s=m6(e,t);this.setRange(s,{noScroll:!0})}});this.editor=e;const t=e.getFirstBlock(),o=ie(t);this.caret=new TI(e);const r=se(o,0,"normal");this._range=Ht(e,{anchor:r,focus:r}),this.lastCaretRect=null,this.editor.addListener("blockDeleted",this.handleBlockDelete),setTimeout(()=>{this.updateFocusedBlock(null)})}destroy(){this.caret.destroy()}get range(){return this._range}get focusedBlock(){return this.getFocusedBlock()}get startBlock(){return this.getStartBlock()}get endBlock(){return this.getEndBlock()}getFocusedBlock(){const e=this.range.focus;return this.editor.getBlockById(e.blockId)}getStartBlock(){const e=this.range.start;return this.editor.getBlockById(e.blockId)}getEndBlock(){const e=this.range.end;return this.editor.getBlockById(e.blockId)}selectBlock(e,t,o){const r=se(e,t,"normal");let i;o&&(i=se(e,o,"normal")),this.setSelection(r,i)}setSelection(e,t,o){if(t||(t=e),this.verifyPos(e),this.verifyPos(t),!this.selectionChanging(e,t))return this.range;const r=Ht(this.editor,{anchor:e,focus:t});if(this.range.isEqual(r))return this.range;const i=this._range;return this._range=r,this.selectionChanged(),this.updateFocusedBlock(i),xe(this.editor.rootContainer,"select-all")&&(!r.isSimple()||!PI(this.editor,r))&&te(this.editor.rootContainer,"select-all"),o!=null&&o.noScroll||this.scrollIntoView(),this.range}setRange(e,t){return this.setSelection(e.anchor,e.focus,t)}updateSelection(){this.caret.update(),DI(this.editor)}getFocusedPos(){return this.range.focus}getAnchorPos(){return this.range.anchor}selectionChanging(e,t){return!0}selectionChanged(){this.updateSelection(),this.editor.emit("selectionChanged",this.editor)}updateLastCaretRect(){const e=this.range.focus;if(!Nr(e))return;const t=this.editor.getBlockById(e.blockId);this.lastCaretRect=Io(this.editor,t,e)}getSuggestedCaretX(){var e;return(e=this.lastCaretRect)==null?void 0:e.x}scrollIntoView(){_I(this.editor)}verifyPos(e){const t=this.editor.getBlockById(e.blockId);if(e.isSimple())e.offset>=0&&e.offset<=ue(this.editor,t)||m(yh,!1,"invalid block position, out of range");else{const o=e.childContainerId;!!this.editor.getContainerById(o)||m(yh,!1,"invalid complex block position, no container found")}}updateFocusedBlock(e){if(e&&this.range.start.blockId===e.start.blockId)return;let t;e&&e.start.blockId===e.end.blockId&&(t=this.editor.findBlockById(e.start.blockId));let o;(this.range.isCollapsed()||!this.range.isSimple()||this.range.start.blockId===this.range.end.blockId)&&(o=this.editor.getBlockById(this.range.start.blockId));let r=!1;t&&xe(t,"focused")&&(te(t,"focused"),r=!0),this.removeAllBlockFocusedClass(),o&&this.setBlockFocused(o)&&(r=!0),r&&this.editor.emit("focusBlockChanged",this.editor,o!=null?o:null,t!=null?t:null)}verify(){this.verifyPos(this._range.start),this.verifyPos(this._range.end)}to(e){const t=vh(this.editor);return e==="text"?Ia(this.editor,t):e==="markdown"?Ta(this.editor,t):p6(this.editor,t)}removeAllBlockFocusedClass(){this.editor.rootContainer.querySelectorAll('div[data-type="editor-block"].focused, div[data-type="editor-block"].child-focused').forEach(e=>{te(e,"focused"),te(e,"child-focused")})}setBlockFocused(e){if(xe(e,"focused"))return!1;W(e,"focused");let t=ne(e);for(;To(t);){const o=re(t);m(yh,o,"parent block not found"),W(o,"child-focused"),t=ne(o)}return!0}}function mT(n){const e=n.selection.range.focus;if(!e.isSimple())return;const t=n.findBlockById(e.blockId);!t||n.selection.selectBlock(t,0,ue(n,t))}function gT(n){const e=n.selection.range.focus;if(!e.isSimple())return;const t=n.findBlockById(e.blockId);if(!t||!ee(n,t))return;let o=Mg(n,"select"),r=Rg(n,"select");if(!o||!r)return;const i=e.blockId;o.blockId!==i&&(o=se(t,0,"home")),r.blockId!==i&&(r=se(t,ue(n,t),"end")),n.selection.setSelection(o,r)}class pT{constructor(e){g(this,"editor");g(this,"startPos",null);g(this,"lastCaretRect");g(this,"mouseDownEvent",null);g(this,"handleMouseDown",e=>{this.mouseDownEvent=e;const t=C4(this.editor,e.x,e.y);if(t){if(t instanceof or)return;const o=this.editor.selection.range;if(e.shiftKey&&o.isSimple()){const r=o.anchor;this.editor.selection.setSelection(r,t.focus),this.startPos=t.start}else this.editor.selection.setSelection(t.anchor,t.focus),this.startPos=t.start;this.editor.selection.updateLastCaretRect()}});g(this,"handleMouseMove",e=>{if(!this.startPos||!this.mouseDownEvent||Math.abs(this.mouseDownEvent.x-e.x)<3&&Math.abs(this.mouseDownEvent.y-e.y)<3)return;const t=Yd(this.editor,e.x,e.y);if(!t)return;const o=Ah(this.editor,this.startPos,t.end);if(!o)return;const{anchor:r,focus:i}=o;this.editor.selection.setSelection(r,i)});g(this,"handleMouseUp",e=>{this.startPos=null});this.editor=e,this.startPos=null,this.lastCaretRect=new DOMRect}isSelecting(){return this.startPos!==null}stopSelection(){this.startPos=null}handleDblClick(e){gT(this.editor)}handleTripleClick(e){mT(this.editor)}}function CT(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.undo(),!0)}function AT(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.redo(),!0)}const E9=S("delete-text");function x9(n,e,t,o){const r=o!=null?o:n.selection.range.start;r instanceof $t||m(E9,!1,`invalid insert pos type: ${typeof r}`);const{blockId:i}=r,s=n.getBlockById(i);m(E9,ee(n,s),"block is not a text kind block");let{offset:l}=r;if(e==="backward"){if(l-t<0)return 0;if(!sn(s,l-t)){const a=Ri(s,l);t=l-a}}else if(e==="forward"&&l+t>ue(n,s))return 0;return e==="backward"&&(l-=t),n.deleteTextFromBlock(s,l,t)}function I9(n,e){if(n.getBlockData(e).quoted){const t={quoted:null};return n.updateBlockData(e,t),!0}return!1}const bT=S("handle-backspace");function jg(n,e){if(!dt(n,e))return;const t=ne(e);Bo(t)!==1&&n.deleteBlock(e)}function vT(n,e){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const t=n.selection.range.start,o=n.getBlockById(t.blockId);if(ee(n,o))if(t.offset===0){if(I9(n,o))return;const r=lt(o);if(r){if(!n.isBlockWritable(r))return;if(ee(n,r))n.mergeTextBlock(r,o,{focus:!0});else if(Le(n,r)){jg(n,o);const i=zl(n,r);i?n.selection.selectBlock(i,ue(n,i)):n.selection.selectBlock(r,0,ue(n,r))}else jg(n,o),m(bT,Lt(r),"prev block is not embed block"),n.selection.selectBlock(r,1)}else{const i=ne(o);if(To(i)){const s=d4(n,i);if(s){if(!n.isBlockWritable(s))return;jg(n,o),n.selection.selectBlock(s,ue(n,s))}}}}else x9(n,"backward",1,null),n.selection.updateLastCaretRect();else{const r=be(o),i=ne(o);n.insertTextBlock("",ae(i),r),n.deleteBlock(o)}}function yT(n,e){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const t=n.selection.range.start,o=n.getBlockById(t.blockId);if(ee(n,o))if(t.offset===ue(n,o)){const r=Ze(o);if(r){if(!n.isBlockWritable(r))return;ee(n,r)?n.mergeTextBlock(o,r,{focus:!0}):dt(n,o)?n.deleteBlock(o,bt(n,r,0)):n.deleteBlock(r)}}else x9(n,"forward",1,null);else{const r=be(o),i=ne(o);n.insertTextBlock("",ae(i),r),n.deleteBlock(o)}}function kT(n){const{range:e}=n.selection,{start:t,end:o}=e,r=n.getBlockById(t.blockId),i=n.getBlockById(o.blockId);if(r!==i||!Le(n,r))return!1;if(Nr(t))return!0;const s=Ms(n,r,t,o),l=En(n,r);return s.length===l.length}function wT(n,e){if(kT(n)){const o=n.getFocusedBlock(),r=be(o),i=ae(ne(o));n.insertTextBlock("",i,r+1);return}n.selection.range.isCollapsed()||n.clearSelectedContents();const t=n.getFocusedBlock();if(ee(n,t)){if(dt(n,t)&&I9(n,t))return;const o=n.selection.range.start,r=n.breakTextBlock(t,o.offset,{copyBlockAttributes:!0});o.offset!==0?n.selection.selectBlock(r,0):n.selection.scrollIntoView()}else{const o=n.insertTextBlock();n.selection.selectBlock(o,0)}}function BT(n,e){const t=n.selection.range.getSelectedBlocks()[0],{block:o}=t;if(!ee(n,o))return!1;const r=t.end;return n.insertBoxToBlock(o,r.offset,{type:"br",id:K(),box:!0,created:Date.now()}),!0}const ET=S("input-handler-actions");function xT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(wT(n),!0))}function IT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(yT(n),!0))}function TT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(vT(n),!0))}function DT(n,e){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(BT(n),!0))}function ST(n){return n.readonly||!n.isWritable()||!window.isSecureContext?!1:(navigator.clipboard.readText().then(e=>{n.input.handlePasteText(e)}).catch(e=>{ET.error(e)}),!0)}const kh={ArrowDown:W6,ArrowUp:V6,ArrowLeft:U6,ArrowRight:z6,"Shift+ArrowDown":q6,"Shift+ArrowUp":Q6,"Shift+ArrowLeft":G6,"Shift+ArrowRight":Z6,"CtrlOrCmd+ArrowLeft":J6,"CtrlOrCmd+ArrowRight":K6,"CtrlOrCmd+Shift+ArrowLeft":X6,"CtrlOrCmd+Shift+ArrowRight":e9,"CtrlOrCmd+ArrowUp":n9,"CtrlOrCmd+ArrowDown":t9,"CtrlOrCmd+Shift+ArrowUp":o9,"CtrlOrCmd+Shift+ArrowDown":Pg,"CtrlOrCmd+A":y9,Home:a9,End:u9,"Shift+Home":l9,"Shift+End":c9,PageUp:g9,PageDown:p9,"Shift+PageUp":C9,"Shift+PageDown":A9,"CtrlOrCmd+Z":CT,"CtrlOrCmd+Shift+Z":AT,Enter:xT,Delete:IT,Backspace:TT,"Shift+Enter":DT,"CtrlOrCmd+Shift+V":ST};function T9(n,e){return n.shortcuts.handleKeyboardEvents(n,e)!==void 0}function D9(n,e,t){if(e.type==="embed"){const i=e.embedData,s=i.src;if(s&&typeof s=="string"){const l=t.get(s);l&&(i.src=l)}return}const o=e.text;o&&o.forEach(i=>{if(i.attributes&&i.attributes.src&&typeof i.attributes.src=="string"){const s=t.get(i.attributes.src);s&&(i.attributes.src=s)}});const r=e.children;r&&r.forEach(i=>{n.blocks[i].forEach(l=>{D9(n,l,t)})})}function S9(n,e,t){if(t.size===0)return;e.blocks.root.forEach(r=>{const i=n.editorBlocks.getBlockClass(r.type);i.replaceResources?i.replaceResources(r,t):D9(e,r,t)})}async function LT(n,e){const t=e.filter(i=>i.indexOf(":")===-1),o=await n.doc.addResources(t),r=new Map;if(t.length!==o.length)return r;for(let i=0;i<t.length;i++)r.set(t[i],o[i]);return r}function MT(n,e){var i,s;const o=e.meta.serverId;if(!o||typeof o!="string")return!1;const r=(s=(i=n.doc).getServerMeta)==null?void 0:s.call(i);return!(!r||r.serverId!==o)}async function RT(n,e){const o=e.meta.resources;if(!o||Object.keys(o).length===0)return;let r=new Map;if(MT(n,e)){const s=Array.from(Object.keys(o));r=await LT(n,s),S9(n,e,r)}const i=new Map;Object.entries(o).forEach(([s,l])=>{r.get(s)===void 0&&s!==l&&i.set(s,l)}),i.size!==0&&S9(n,e,i)}async function OT(n,e,t){await RT(n,e),n.undoManager.runInGroup(()=>{const{start:o,end:r}=n.selection.range,i=n.getBlockById(o.blockId);if(o.blockId===r.blockId&&Lt(i)){const s=ne(i),l=n.getBlockIndex(i),[a]=n.insertDocAt(s,l+1,e,t);a&&n.selection.selectBlock(a,ue(n,a))}else{n.clearSelectedContents();const{block:s,offset:l}=ql(n);n.insertDoc(s,l,e,t)}})}const _T=["text/x-ones-editor-doc","image/*","text/office-html","text/html","text/plain","text/markdown","*"];function PT(n){let e;for(const t of _T)if(e=n[t],e)break;return e||null}function L9(n,e,t){if(e.type==="embed"){const s=e.embedData.src;if(s&&typeof s=="string")for(const l of s.split("|"))t.add(l);return}const o=e.text;o&&o.forEach(i=>{i.attributes&&i.attributes.src&&typeof i.attributes.src=="string"&&t.add(i.attributes.src)});const r=e.children;r&&r.forEach(i=>{n.blocks[i].forEach(l=>{L9(n,l,t)})})}function FT(n,e){const t=new Set;return e.blocks.root.forEach(r=>{const i=n.editorBlocks.getBlockClass(r.type);i.getResources?i.getResources(r).forEach(s=>{t.add(s)}):L9(e,r,t)}),Array.from(t)}function wh(n,e){return`<!doctype html><html><head><meta charset="utf8" />${`<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${ws(JSON.stringify(e))}::ones-editor-doc" />`}</head><body>${n}</body></html>`}function Bh(n,e){var i,s,l;const t=(l=(s=(i=n.doc).getServerMeta)==null?void 0:s.call(i))!=null?l:{},o=FT(n,e),r={};o.forEach(a=>{const d=n.doc.buildResourceUrl(a,{withToken:!0});r[a]=d}),e.meta={...t,resources:r}}function NT(n,e,t){if(e.preventDefault(),e.stopPropagation(),!e.clipboardData)return;let o=vh(n);const r=t==null?void 0:t(n,e,o);if(r===!0)return;typeof r=="object"&&r!==null&&(o=r),Bh(n,o);const i=dh(n,o),s=Ta(n,o),l=wh(i,o);e.clipboardData.setData("text/html",l),e.clipboardData.setData("text/plain",s),e.clipboardData.setData("text/x-ones-editor-doc",JSON.stringify(o))}async function Eh(n,e){const t=Hg(n,e);Bh(n,t);const o=dh(n,t),r=Ta(n,t),i=wh(o,t);return bm([{type:"text/plain",data:new Blob([r],{type:"text/plain"})},{type:"text/html",data:new Blob([i],{type:"text/html"})}])}class $T{constructor(e){g(this,"editor");g(this,"handlers",[]);g(this,"onPasteText",async e=>{const t=new DataTransfer;t.setData("text/plain",e);const o=await this.editor.dataConverter.fromData(this.editor,t);o&&this.pasteDocs(o,null)});this.editor=e}onInsertText(e,t){if(!ee(this.editor,this.editor.getFocusedBlock()))return;const{containerId:o,blockIndex:r,offset:i}=ql(this.editor);this.handleBeforeInsertText(o,r,i,t)||(this.defaultInsertText(this.editor,o,r,i,t),this.handleAfterInsertText(o,r,i,t),this.editor.selection.updateLastCaretRect())}onKeyDown(e){if(this.handleBeforeKeyDown(e))return!0;const t=this.defaultHandleKeydown(this.editor,e);return this.handleAfterKeyDown(e)?!0:t}onChanged(e){for(let t=0;t<this.handlers.length;t++){const o=this.handlers[t];o.handleChanged&&o.handleChanged(this.editor,e)}}onRemoteChanged(e){for(let t=0;t<this.handlers.length;t++){const o=this.handlers[t];o.handleRemoteChanged&&o.handleRemoteChanged(this.editor,e)}}onCompositionStart(e){this.editor.updateCompositionText("",!1);const{containerId:t,blockIndex:o,offset:r}=ql(this.editor);for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];s.handleCompositionStart&&s.handleCompositionStart(this.editor,t,o,r)}}onUpdateCompositionText(e,t,o){this.editor.updateCompositionText(t,o),this.editor.selection.caret.update();const{containerId:r,blockIndex:i,offset:s}=ql(this.editor);for(let l=0;l<this.handlers.length;l++){const a=this.handlers[l];a.handleUpdateCompositionText&&a.handleUpdateCompositionText(this.editor,r,i,s,o)}this.editor.selection.updateLastCaretRect()}onCopy(e){NT(this.editor,e,(t,o,r)=>{for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleBeforeCopy){const l=s.handleBeforeCopy(this.editor,o,r);if(l===!0)return!0;if(typeof l=="object"&&l!=null)return l}}})}onCut(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeCut&&r.handleBeforeCut(this.editor,e)===!0)return}if(this.onCopy(e),this.editor.selection.range.isCollapsed()){const o=this.editor.selection.focusedBlock;Lt(o)&&this.editor.deleteBlock(o)}else Bg(this.editor)}onPaste(e){if(e.preventDefault(),e.stopPropagation(),!e.clipboardData)return;this.editor.dataConverter.fromData(this.editor,e.clipboardData).then(async o=>{o&&this.pasteDocs(o,e)})}onFocus(){W(this.editor.rootElement,"active")}onBlur(){te(this.editor.rootElement,"active")}addHandler(e){this.handlers.push(e)}removeHandler(e){const t=this.handlers.indexOf(e);t!==-1&&this.handlers.splice(t)}handleBeforeInsertText(e,t,o,r){for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleBeforeInsertText&&s.handleBeforeInsertText(this.editor,e,t,o,r))return!0}return!1}handleAfterInsertText(e,t,o,r){for(let i=0;i<this.handlers.length;i++){const s=this.handlers[i];if(s.handleAfterInsertText&&s.handleAfterInsertText(this.editor,e,t,o,r))return!0}return!1}handleBeforeKeyDown(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeKeyDown&&r.handleBeforeKeyDown(this.editor,e))return!0}const t=this.defaultHandleKeydown(this.editor,e);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterKeyDown&&r.handleAfterKeyDown(this.editor,e))return!0}return t}handleAfterKeyDown(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforeKeyDown&&r.handleBeforeKeyDown(this.editor,e))return!0}const t=this.defaultHandleKeydown(this.editor,e);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterKeyDown&&r.handleAfterKeyDown(this.editor,e))return!0}return t}defaultInsertText(e,t,o,r,i){bg(this.editor,i)}defaultHandleKeydown(e,t){return T9(this.editor,t)?(t.preventDefault(),t.stopPropagation(),!0):!1}async pasteDoc(e){for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleBeforePasteDoc&&await r.handleBeforePasteDoc(this.editor,e))return}const t={blockIdMap:new Map,containerIdMap:new Map};await OT(this.editor,e,t);for(let o=0;o<this.handlers.length;o++){const r=this.handlers[o];if(r.handleAfterPasteDoc&&await r.handleAfterPasteDoc(this.editor,e,t))return}}async pasteDocs(e,t){for(let r=0;r<this.handlers.length;r++){const i=this.handlers[r];if(i.handleBeforePaste&&await i.handleBeforePaste(this.editor,t,e))return}const o=PT(e);if(!!o){await this.pasteDoc(o);for(let r=0;r<this.handlers.length;r++){const i=this.handlers[r];if(i.handleAfterPaste&&await i.handleAfterPaste(this.editor,t,e))return}}}destroy(){this.handlers.forEach(e=>{var t;(t=e.destroy)==null||t.call(e,this.editor)}),this.handlers=[]}}function HT(n,e,t){const o=Rr(e,t);return o.remove(),o}S("copy-dom-attributes");const M9=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"];function jT(n,e){for(let l=0;l<M9.length;l++){const a=M9[l];e[a]=n[a]}const t=n.attributes,o=e.attributes,r=[],i=[];for(let l=0;l<t.length;l++){const a=t[l],d=o.getNamedItem(a.name);d?d.value!==a.value&&(d.value=a.value,i.push(a)):r.push(a)}const s=[];for(let l=0;l<o.length;l++){const a=o[l];t.getNamedItem(a.name)||s.push(a)}r.forEach(l=>{e.setAttribute(l.name,l.value)}),i.forEach(l=>{e.setAttribute(l.name,l.value)}),s.forEach(l=>{e.removeAttribute(l.name)})}function R9(n){const e=Array.from(n.childNodes).filter(t=>!xC(t));return e.forEach(t=>{t.remove()}),e}function O9(n,e,t){var d;const o=n.getContainerById(e),r=Rr(o,t),i=Di(r),s=n.doc.getBlockData(e,t),l=Qe(n,r);if((d=l==null?void 0:l.handleUpdateBlock)==null?void 0:d.call(l,n,r,s))n.editorBlockRenders.updateBlock(n,i,r,s);else{const f=n.editorBlocks.createBlock(i,o,s),p=R9(f);R9(r),p.forEach(v=>{r.appendChild(v)});const A=Vd(f);if(A){const v=Vd(r);v&&v.remove(),r.appendChild(A)}jT(f,r)}VC(n,r,s),n.blockHooks.forEach(f=>{var p;(p=f.update)==null||p.call(f,n,i,o,r,s)}),setTimeout(()=>{n.selection.updateSelection(null)})}const UT=S("transform-selection");function _9(n,e,t,o){const{range:r}=n.selection,{anchor:i,focus:s}=r;if(i.blockId!==e&&s.blockId!==e)return r;m(UT,i.isSimple()&&s.isSimple(),"invalid text pos type");let l=i;if(i.blockId===e){const d=ln.transformCursor(i.offset,t,o);l=se(e,d,"normal")}let a=s;if(s.blockId===e){const d=ln.transformCursor(s.offset,t,o);a=se(e,d,"normal")}return Ht(n,{anchor:l,focus:a})}const zT=S("handle-block-text-changed");function VT(n,e,t,o,r){const i=n.getContainerById(e),s=Rr(i,t),l=n.doc.getBlockData(e,t);if(m(zT,l.text,"no block text"),NC(n,s).setBlockText(n,s,l.text),!r){const a=_9(n,l.id,o,r);n.selection.setRange(a,{noScroll:!0})}}function WT(n,e){const t=fe.default(n);return e.delete.forEach(r=>{delete t[r]}),{...t,...e.insert}}function P9(n,e,t,o){const r=Qe(n,e);r.handleDeleteBlock&&r.handleDeleteBlock(n,e,t,o),n.emit("blockDeleted",n,e,t,o)}function qT(n,e,t,o){const r=n.getBlockByIndex(e,t);r.querySelectorAll('[data-type="editor-block"]').forEach(i=>{P9(n,i,o,{child:!0})}),P9(n,r,o,{child:!1})}const Mo=S("editor-doc");class GT extends ua{constructor(t,o,r){super();g(this,"localEvents",[]);this.editor=t,this.externalDoc=o,this.externalDoc.registerCallback(this),this.registerLocalEvents(r)}beginBatchUpdate(){return this.externalDoc.beginBatchUpdate()}endBatchUpdate(){return this.externalDoc.endBatchUpdate()}registerLocalEvents(t){this.localEvents.push(t)}toJSON(){return this.externalDoc.toJSON()}getVersionHelper(){var o,r;return(r=(o=this.externalDoc).getVersionHelper)==null?void 0:r.call(o)}getContainerBlocks(t){return this.externalDoc.getContainerBlocks(t)}getBlockData(t,o){return this.externalDoc.getBlockData(t,o)}verifyBlockWritable(t,o){const r=this.editor.getBlockByIndex(t,o);m(Mo,this.editor.isBlockWritable(r),`block is not writable, ${t}, ${o}`)}localUpdateBlockText(t,o,r,i){m(Mo,!this.editor.readonly,"editor is readonly"),this.verifyBlockWritable(t,o);const s=this.getBlockData(t,o),l=s.text;m(Mo,l,`no text, ${t}, ${o}`);const a=_9(this.editor,s.id,r,!0),d=ln.apply(l,r);this.localEvents.forEach(p=>p.onBeforeUpdateBlockText(t,s.id,l,d,a.toDocRange()));const f=this.externalDoc.localUpdateBlockText(t,o,r);return this.editor.selection.setRange(a,i),f}localUpdateBlockData(t,o,r,i){m(Mo,!this.editor.readonly,"editor is readonly");const s=this.editor.getBlockByIndex(t,o);if(!this.editor.isBlockWritable(s)){const f=Array.from(r.delete).filter(A=>A!=="comments"),p=Object.keys(r.insert).filter(A=>A!=="comments");(f.length>0||p.length>0)&&m(Mo,!1,`block is not writable, comment supported only, ${JSON.stringify(r)}}`)}const l=fe.default(this.getBlockData(t,o)),a=fe.default(WT(l,r));this.localEvents.forEach(f=>f.onBeforeUpdateBlockData(t,l.id,l,a,i));const d=this.externalDoc.localUpdateBlockData(t,o,r,i);return this.editor.selection.setRange(Si(this.editor,i)),d}localInsertBlock(t,o,r,i,s){m(Mo,!this.editor.readonly,"editor is readonly"),this.localEvents.forEach(a=>a.onBeforeInsertBlock(t,o,r,i));const l=this.externalDoc.localInsertBlock(t,o,r,i);return this.editor.selection.setRange(Si(this.editor,i),s),l}localDeleteBlock(t,o,r){m(Mo,!this.editor.readonly,"editor is readonly"),this.verifyBlockWritable(t,o);const i=fe.default(this.getBlockData(t,o));this.localEvents.forEach(l=>l.onBeforeDeleteBlock(t,o,i,r));const s=this.externalDoc.localDeleteBlock(t,o,r);return this.editor.selection.setRange(Si(this.editor,r)),s}localDeleteChildContainers(t){return m(Mo,!this.editor.readonly,"editor is readonly"),t.forEach(o=>{const r=fe.default(this.getContainerBlocks(o));this.localEvents.forEach(i=>i.onBeforeDeleteChildContainer(o,r))}),this.externalDoc.localDeleteChildContainers(t)}localInsertChildContainer(t,o){return m(Mo,!this.editor.readonly,"editor is readonly"),this.localEvents.forEach(r=>r.onBeforeInsertChildContainer(t,fe.default(o))),this.externalDoc.localInsertChildContainer(t,o)}onRequestReload(t){Mo.debug(`reload doc: ${t}`),this.editor.reload(),this.callbacks.forEach(r=>{var i;return(i=r.onRequestReload)==null?void 0:i.call(r,t)});const o=!1;this.editor.emit("docChanged",this.editor,o)}onUpdateBlockText(t,o,r,i){this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockText)==null?void 0:l.call(s,t,o,r,i)}),VT(this.editor,t,o,r,i),this.editor.emit("docChanged",this.editor,i)}onUpdateBlockData(t,o,r,i){this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,t,o,r,i)}),O9(this.editor,t,o),this.editor.emit("docChanged",this.editor,i)}onInsertBlock(t,o,r,i){this.callbacks.forEach(l=>{var a;return(a=l.onInsertBlock)==null?void 0:a.call(l,t,o,r,i)});const s=this.editor.getContainerById(t);_E(this.editor,s,o,r),this.editor.emit("docChanged",this.editor,i)}onDeleteBlock(t,o,r){qT(this.editor,t,o,r),this.callbacks.forEach(s=>{var l;return(l=s.onDeleteBlock)==null?void 0:l.call(s,t,o,r)});const i=this.editor.getContainerById(t);HT(this.editor,i,o),this.editor.emit("docChanged",this.editor,r)}onInsertChildContainer(t,o,r){this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,t,o,r)})}onDeleteChildContainer(t,o){this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,t,o)})}onCustomMessage(t){this.callbacks.forEach(o=>{var r;return(r=o.onCustomMessage)==null?void 0:r.call(o,t)})}onStatusChanged(t){this.callbacks.forEach(o=>{var r;return(r=o.onStatusChanged)==null?void 0:r.call(o,t)})}onError(t){this.callbacks.forEach(o=>{var r;return(r=o.onError)==null?void 0:r.call(o,t)})}uploadResource(t,o){return this.externalDoc.uploadResource(t,o)}addResources(t){return this.externalDoc.addResources(t)}buildResourceUrl(t,o){return this.externalDoc.buildResourceUrl(t,o)}request(t,o){return this.externalDoc.request(t,o)}broadcastMessage(t){return this.externalDoc.broadcastMessage(t)}getUser(){return this.externalDoc.getUser()}getRemoteUsers(){return this.externalDoc.getRemoteUsers()}destroy(){this.externalDoc.destroy(),this.clearCallbacks()}getServerMeta(){var t,o,r;return(r=(o=(t=this.externalDoc).getServerMeta)==null?void 0:o.call(t))!=null?r:{}}reset(t){Mo.log("reset doc"),this.externalDoc=t,this.externalDoc.registerCallback(this),this.editor.reload()}}function F9(n,e){if(n.length===0){n.push(e);return}const t=n[n.length-1];if(!t.combinable(e)){n.push(e);return}t.combine(e)}const Ug=S("undo-action");class Yl{constructor(e,t,o){g(this,"beforeRange");g(this,"afterRange");this.containerId=t,this.beforeRange=e.selection.range.clone().toDocRange(),this.afterRange=o}undo(e){return!1}redo(e){return!1}combinable(e){return m(Ug,e,"no other action"),!1}combine(e){m(Ug,!1,"no other")}setAfterRange(e){this.afterRange&&Ug.warn("after range has already set"),this.afterRange=e}}const ZT=S("block-action");class N9 extends Yl{constructor(t,o,r,i,s){super(t,o,s);g(this,"blockData");g(this,"blockIndex");this.blockData=fe.default(i),this.blockIndex=r}deleteBlock(t,o){if(!t.getContainerById(this.containerId))return!1;const i=t.getBlockById(this.blockData.id);return i?(m(ZT,this.blockIndex===be(i),"invalid block index"),mh(t,i,Si(t,o)),!0):!1}insertBlock(t,o){return Gl(t,this.containerId,this.blockIndex,fe.default(this.blockData),o),!0}}class QT extends N9{undo(e){return this.deleteBlock(e,this.beforeRange)}redo(e){return this.insertBlock(e,this.afterRange)}}class YT extends N9{undo(e){return this.insertBlock(e,this.beforeRange)}redo(e){return this.deleteBlock(e,this.afterRange)}}class JT extends Yl{constructor(t){super(t,ae(t.rootContainer),t.selection.range.toDocRange());g(this,"actions",[])}addAction(t){F9(this.actions,t),this.afterRange=t.afterRange}undo(t){let o=!1;return this.actions.concat().reverse().forEach(r=>{r.undo(t)&&(o=!0)}),o}redo(t){let o=!1;return this.actions.forEach(r=>{r.redo(t)&&(o=!0)}),o}setAfterRange(t){this.afterRange=t;const o=this.actions[this.actions.length-1];!o||o instanceof Yl&&(o.afterRange||o.setAfterRange(t))}}const Ns=S("update-block-data-action");class xh extends Yl{constructor(t,o,r,i,s,l){super(t,o,l);g(this,"beforeBlockData");g(this,"afterBlockData");g(this,"blockId");this.blockId=r,m(Ns,this.blockId===i.id,"invalid block id"),m(Ns,this.blockId===s.id,"invalid block id"),this.beforeBlockData=fe.default(i),this.afterBlockData=fe.default(s),m(Ns,this.beforeBlockData.type===this.afterBlockData.type,"invalid block type")}undo(t){m(Ns,t,"no editor");const o=t.getBlockById(this.blockId);if(!o)return!1;const r=t.getContainerById(this.containerId);return m(Ns,r,"no container"),Ch(t,o,xh.toAttributes(this.beforeBlockData),this.beforeRange),!0}redo(t){m(Ns,t,"no editor");const o=t.getBlockById(this.blockId);if(!o)return!1;const r=t.getContainerById(this.containerId);return m(Ns,r,"no container"),Ch(t,o,xh.toAttributes(this.afterBlockData),this.afterRange),!0}static toAttributes(t){const o=fe.default(t);return delete o.id,delete o.type,o}}const zg=S("update-block-text-action");class Pa extends Yl{constructor(t,o,r,i,s,l){super(t,o,l);g(this,"beforeRichTextData");g(this,"afterRichTextData");g(this,"blockId");g(this,"type");this.blockId=r,this.beforeRichTextData=fe.default(i),this.afterRichTextData=fe.default(s),this.type=Pa.calType(i,s)}static calType(t,o){m(zg,t,"no old data"),m(zg,o,"no new data");const i=ln.diff(t,o),s=new Set;let l=!1;const a=f=>iC(f)?`cjk_${f}`:oC(f)?"number":Fd(f)?"space":rC(f)?"letter":"unknown";let d=!1;return i.forEach(f=>{f.insert?f.insert===" "?s.add("insert_letter"):typeof f.insert=="string"&&f.insert.startsWith(" ")&&f.insert.length>1?(l=!0,d=!0,s.add(`insert_${a(f.insert.substr(1))}`)):s.add(`insert_${a(f.insert)}`):f.delete&&(l?l=!1:s.add("delete"))}),{textType:Array.from(s).join("|"),begin:d}}undo(t){if(!t.getContainerById(this.containerId))return!1;const r=t.getBlockById(this.blockId);return r?(ph(t,r,this.beforeRichTextData),!0):!1}redo(t){if(!t.getContainerById(this.containerId))return!1;const r=t.getBlockById(this.blockId);return r?(ph(t,r,this.afterRichTextData),!0):!1}combinable(t){if(!(t instanceof Pa)||t.type.begin||this.type.textType!==t.type.textType||t.blockId!==this.blockId)return!1;const o=t.beforeRange,r=o.anchor;if(!r.isSimple())return!1;const i=this.afterRange;if(!i)return!1;const s=i.anchor;return!(!s.isSimple()||s.blockId!==o.anchor.blockId||s.offset!==r.offset)}combine(t){m(zg,t instanceof Pa,"invalid action type");const o=t;this.afterRichTextData=o.afterRichTextData,this.afterRange=t.afterRange}}class $9 extends Yl{constructor(e,t,o){super(e,t,e.selection.range.toDocRange()),this.blocks=o}deleteChildContainer(e){return e.doc.localDeleteChildContainers([this.containerId]),!0}insertChildContainer(e){return e.doc.localInsertChildContainer(this.containerId,fe.default(this.blocks)),!0}}class KT extends $9{undo(e){return this.deleteChildContainer(e)}redo(e){return this.insertChildContainer(e)}}class XT extends $9{undo(e){return this.insertChildContainer(e)}redo(e){return this.deleteChildContainer(e)}}const Ro=S("undo");class eD{constructor(e){g(this,"editor");g(this,"actions",[]);g(this,"undoCursor");g(this,"currentGroup",null);g(this,"groupCounter",0);g(this,"undoRedoing",!1);g(this,"handleSelectionChange",e=>{if(this.currentGroup){this.currentGroup.setAfterRange(e.selection.range.toDocRange());return}const t=this.actions[this.actions.length-1];!t||t.afterRange||t.setAfterRange(e.selection.range.toDocRange())});this.editor=e,this.undoCursor=-1,this.editor.addListener("selectionChanged",this.handleSelectionChange)}reset(){this.actions=[],this.undoCursor=-1}prepareSaveUndoState(){this.undoCursor!==-1&&(this.actions.splice(this.undoCursor),this.undoCursor=-1)}addAction(e){this.currentGroup?this.currentGroup.addAction(e):(F9(this.actions,e),setTimeout(()=>{this.editor.input.handleChanged(e)}))}beginGroup(){this.groupCounter===0?(m(Ro,!this.currentGroup,"current group already exists"),this.currentGroup=new JT(this.editor),this.groupCounter=1):(m(Ro,this.currentGroup,"current group not exists"),this.groupCounter+=1)}endGroup(){m(Ro,this.currentGroup,"current group not exists"),m(Ro,this.groupCounter>0,"group counter === 0"),this.groupCounter-=1,this.groupCounter===0&&(this.currentGroup.actions.length===0?Ro.warn("empty undo group, skip it"):(this.actions.push(this.currentGroup),this.editor.input.handleChanged(this.currentGroup)),this.currentGroup=null)}hasGroup(){return this.groupCounter>0}runInGroup(e){this.beginGroup();try{const t=e();return setTimeout(()=>this.editor.selection.caret.update()),t}catch(t){throw Ro.error(`failed to run action: ${t.message}`),t}finally{this.endGroup()}}undo(){this.undoCursor===-1&&(this.undoCursor=this.actions.length);try{for(this.undoRedoing=!0;this.undoCursor>0;){this.undoCursor-=1;const e=this.actions[this.undoCursor];if(e.undo(this.editor)){try{this.editor.selection.setRange(Si(this.editor,e.beforeRange))}catch(t){Ro.error(`undo: failed to restore caret pos: ${t.message}`)}return this.editor.input.handleChanged(e),!0}}return!1}finally{this.undoRedoing=!1}}redo(){this.undoCursor===-1&&(this.undoCursor=this.actions.length);try{for(this.undoRedoing=!0;this.undoCursor<this.actions.length;){const e=this.actions[this.undoCursor];if(this.undoCursor+=1,e.redo(this.editor)){try{const t=e.afterRange;t?this.editor.selection.setRange(Si(this.editor,t)):Ro.warn("no after range")}catch(t){Ro.error(`redo: failed to set caret pos after redo: ${t.message}`)}return this.editor.input.handleChanged(e),!0}}return!1}finally{this.undoRedoing=!1}}canUndo(){return!(this.actions.length===0||this.undoCursor===0)}canRedo(){return!(this.actions.length===0||this.undoCursor===-1||this.undoCursor===this.actions.length)}lastAction(){var t;const e=this.undoCursor===-1?this.actions.length-1:this.undoCursor-1;return(t=this.actions[e])!=null?t:null}undoTo(e){for(;;){const t=this.lastAction();if(!t||t===e)return!0;if(!this.undo())return!1}}onBeforeUpdateBlockText(e,t,o,r,i){this.undoRedoing||(this.prepareSaveUndoState(),ln.diff(o,r).length!==0&&this.addAction(new Pa(this.editor,e,t,o,r,i)))}onBeforeUpdateBlockData(e,t,o,r,i){if(this.undoRedoing)return;this.prepareSaveUndoState();const s=new xh(this.editor,e,t,o,r,i);this.addAction(s)}onBeforeInsertBlock(e,t,o,r){this.undoRedoing||(this.prepareSaveUndoState(),m(Ro,t>=0,"invalid block index"),m(Ro,o,"no block data"),this.addAction(new QT(this.editor,e,t,o,r)))}onBeforeDeleteBlock(e,t,o,r){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new YT(this.editor,e,t,o,r)))}onBeforeInsertChildContainer(e,t){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new KT(this.editor,e,t)))}onBeforeDeleteChildContainer(e,t){this.undoRedoing||(this.prepareSaveUndoState(),this.addAction(new XT(this.editor,e,t)))}}class tD{async fromData(e,t){const o=t.getData("text/x-ones-editor-doc");if(o)return{"text/x-ones-editor-doc":JSON.parse(o)}}}class nD{constructor(){g(this,"converters",[]);this.addConverter(new tD)}async fromData(e,t){let o={};for(const r of this.converters){const i=await r.fromData(e,t);i&&(o={...o,...i})}return o}addConverter(e){this.converters.push(e)}}class oD{constructor(e){g(this,"renders",[]);this.editor=e}registerRender(e){this.renders.push(e)}renderText(e,t){const o={classes:[],attributes:{},styles:{}};return this.renders.forEach(r=>{if(r.renderText){const i=r.renderText(this.editor,e,t);i.classes&&o.classes.push(...i.classes),i.attributes&&(o.attributes={...o.attributes,...i.attributes}),i.styles&&(o.styles={...o.styles,...i.styles})}}),o}renderBlock(e,t,o){const r={classes:[],attributes:{},styles:{}};return this.renders.forEach(i=>{if(i.renderBlock){const s=i.renderBlock(this.editor,t,o);s.classes&&r.classes.push(...s.classes),s.attributes&&(r.attributes={...r.attributes,...s.attributes}),s.styles&&(r.styles={...r.styles,...s.styles})}}),r}updateBlock(e,t,o,r){this.renders.forEach(i=>{var s;(s=i.updateBlock)==null||s.call(i,e,t,o,r)})}}class gt extends Dt.TypedEmitter{constructor(t){super();g(this,"hoveringBlock",null);g(this,"hoveringTextChild",null);g(this,"filters",[]);g(this,"finders",[]);g(this,"handleDocumentMouseMove",t=>{if(this.hoveringBlock){for(const s of this.filters)if(s.isInBlock(this.hoveringBlock,t))return}const o=document.elementFromPoint(t.x,t.y);if(!o){this.setHoveringBlock(null,t,null);return}let r=re(o);if((!r||!Ke(this.editor.rootContainer,r))&&(r=this.findBlockByFinders(t),!r)){this.setHoveringBlock(null,t,null);return}const i=this.getParentTextContentChild(r,o);this.setHoveringBlock(r,t,i)});this.editor=t,document.addEventListener("mousemove",this.handleDocumentMouseMove)}destroy(){document.removeEventListener("mousemove",this.handleDocumentMouseMove),this.filters.forEach(t=>t.destroy()),this.filters=[],this.finders.forEach(t=>t.destroy()),this.finders=[]}addFilter(t){this.filters.push(t)}addFinder(t){this.finders.push(t)}hoveringBlockId(){return this.hoveringBlock?ie(this.hoveringBlock):""}findBlockByFinders(t){for(let o=0;o<this.finders.length;o++){const i=this.finders[o].findTargetBlock(this.editor,t);if(i)return i}return null}setHoveringBlock(t,o,r){if(this.hoveringBlock===t&&this.hoveringTextChild===r)return;if(this.hoveringBlock!==t){const s=this.hoveringBlock&&Ke(this.editor.rootContainer,this.hoveringBlock)?this.hoveringBlock:null;s&&te(s,"hover"),t&&W(t,"hover"),this.hoveringBlock=t,this.emit("change",this.hoveringBlock,s,o)}const i=this.hoveringTextChild;this.hoveringTextChild=r,this.emit("childChange",this.hoveringBlock,r,i,o)}static get(t){return t.addCustom("standard-hovering-block",()=>new gt(t))}getParentTextContentChild(t,o){if(!ee(this.editor,t))return null;const r=Re(t);return o.parentElement===r?o:Im(o)}}const H9="style-color-",j9="style-bg-color-";class rD{renderText(e,t,o){const r=[],i={},s={};return Object.entries(o).forEach(([l,a])=>{a===!0?l.startsWith(H9)?i["data-style-color"]=l.substring(H9.length):l.startsWith(j9)?i["data-style-bg-color"]=l.substring(j9.length):l.startsWith("style")&&r.push(l):typeof a=="string"&&(l==="link"&&(r.push("link"),i.link=a),l==="inline-style-color"&&(s.color=a))}),{classes:r,attributes:i,styles:s}}renderBlock(e,t,o){var l,a;const r={};Object.entries(o).filter(d=>d[0].startsWith("style-")).forEach(([d,f])=>{r[`data-${d}`]=`${f}`});const s=[];return((a=(l=e.selection)==null?void 0:l.range)==null?void 0:a.start.blockId)===o.id&&s.push("focused"),typeof o.align=="string"&&o.align&&(r["data-style-align"]=o.align),o.heading&&(r["data-style-heading"]=String(o.heading)),o.quoted&&(r["data-style-quoted"]="true"),gt.get(e).hoveringBlockId()===o.id&&s.push("hover"),{attributes:r,classes:s}}updateBlock(e,t,o,r){var s,l;Array.from(o.attributes).forEach(a=>{a.name.startsWith("data-style-")&&o.removeAttribute(a.name)}),Object.entries(r).filter(a=>a[0].startsWith("style-")).forEach(([a,d])=>{o.setAttribute(`data-${a}`,`${d}`)}),((l=(s=e.selection)==null?void 0:s.range)==null?void 0:l.start.blockId)===r.id&&W(o,"focused"),gt.get(e).hoveringBlockId()===r.id&&W(o,"hover")}}function iD(n){n.editorBlocks.registerBlockClass(In),n.editorBlocks.registerBlockClass(u4),n.editorBoxes.registerBoxClass(X4),n.editorBoxes.registerBoxClass(e6),n.editorBoxes.registerBoxClass(o6),n.editorBoxes.registerBoxClass(r6),n.editorInsertions.registerInsertionClass(i6),n.editorBlockRenders.registerRender(new rD)}function sD(n,e){iD(n),e!=null&&e.blocks&&e.blocks.forEach(t=>n.editorBlocks.registerBlockClass(t)),e!=null&&e.boxes&&e.boxes.forEach(t=>n.editorBoxes.registerBoxClass(t)),e!=null&&e.embeds&&e.embeds.forEach(t=>n.editorEmbeds.registerEmbedClass(t)),e!=null&&e.insertions&&e.insertions.forEach(t=>n.editorInsertions.registerInsertionClass(t)),e!=null&&e.decorators&&e.decorators.forEach(t=>n.editorDecorators.registerDecorator(t)),e!=null&&e.dataConverters&&e.dataConverters.forEach(t=>n.dataConverter.addConverter(t)),e!=null&&e.commandProviders&&e.commandProviders.forEach(t=>n.editorCommandProviders.registerCommandProvider(t)),e!=null&&e.textRenders&&e.textRenders.forEach(t=>n.editorBlockRenders.registerRender(t))}const U9=S("range-commands");function z9(n,e){n.forEach(t=>{t.source=e,t.children&&z9(t.children,e)})}function V9(n,e,t){const o=ie(e);m(U9,o===t.start.blockId,"invalid start range"),m(U9,o===t.end.blockId,"invalid end range");const r=n.editorCommandProviders.getCommandProviders();let i=[];return r.forEach(s=>{const l=s.getAvailableCommands(n,e,t);z9(l,s.id),i.push(...l)}),r.forEach(s=>{if(s.filterCommands){const l=s.filterCommands(n,e,t,i);l&&(i=l)}}),Le(n,e)&&Ms(n,e,t.start,t.end).forEach(l=>{At(l).forEach(d=>{const f=ue(n,d),p=Ht(n,{anchor:se(d,0,"home"),focus:se(d,f,"end")}),A=V9(n,d,p);i.push(...A)})}),i}function W9(n){const e=n.getEditor(),t=n.getSelectedBlocks(),o=[];return t.forEach(r=>{const i=Ht(e,{anchor:r.start,focus:r.end});V9(e,r.block,i).forEach(l=>{o.push(l)})}),o}function q9(n,e,t,o,r,i){var f;const s=n.editorCommandProviders.getCommandProviders();for(let p=0;p<s.length;p++){const A=s[p];if(A.beforeExecuteCommand&&A.beforeExecuteCommand(n,e,t,o,r))return!1}const l=n.editorCommandProviders.getCommandProvider(o.source),a={};if((f=l.executeCommand)!=null&&f.call(l,n,e,t,o,r,{}))return i[ie(e)]=a,!0;let d=!1;return Le(n,e)&&Ms(n,e,t.start,t.end).forEach(A=>{At(A).forEach(B=>{const D=ue(n,B),I=Ht(n,{anchor:se(B,0,"home"),focus:se(B,D,"end")});q9(n,B,I,o,r,i)&&(d=!0)})}),s.forEach(p=>{p.afterExecuteCommand&&p.afterExecuteCommand(n,e,t,o,r,i)}),d}function G9(n,e,t){const o=n.getEditor(),r={},i=o.editorCommandProviders.getCommandProvider(e.source);return i.executeRangeCommand&&i.executeRangeCommand(o,n,e,t,r)||n.getSelectedBlocks().forEach(l=>{const a=Ht(o,{anchor:l.start,focus:l.end});q9(o,l.block,a,e,t,r)}),r}const lD=S("command-providers");class Z9{constructor(e){g(this,"providers",[]);this.editor=e}registerCommandProvider(e){this.providers.push(e)}getCommandProviders(){return this.providers}getCommandProvider(e){const t=this.providers.find(o=>o.id===e);return m(lD,t,`no command provider, id=${e}`),t}getCommands(e){return W9(e)}executeCommand(e,t,o){return this.editor.undoManager.runInGroup(()=>G9(e,t,o))}getEmptyBlockTextAttributes(e,t){let o={};if(this.providers.forEach(r=>{var s;const i=(s=r.getEmptyBlockTextAttributes)==null?void 0:s.call(r,e,t);i&&(o={...o,...i})}),Object.keys(o).length!==0)return o}}function cD(n,e){const t=ne(e),o=ae(t),r=be(e);O9(n,o,r)}const aD=S("table-scroll");class Q9{constructor(e,t,o,r,i){g(this,"handleEvent",e=>{this.handler(this.editor,e,this.data)});this.editor=e,this.dom=t,this.name=o,this.handler=r,this.data=i,t.addEventListener(o,this.handleEvent)}destroy(){this.dom.removeEventListener(this.name,this.handleEvent)}}class uD{constructor(e){g(this,"handlers",new Map);this.editor=e}destroy(){Array.from(this.handlers.entries()).forEach(([e,t])=>{t.forEach(o=>o.destroy()),this.handlers.delete(e)})}addEventListener(e,t,o,r){const i=this.handlers.get(e);if(i){if(i.find(s=>s.handler===o&&s.name===t)){aD.warn(`event has already registered: ${t}`);return}i.push(new Q9(this.editor,e,t,o,r))}else{const s=new Q9(this.editor,e,t,o,r);this.handlers.set(e,[s])}}removeEventListener(e,t,o){if(!e){for(const[i,s]of Array.from(this.handlers.entries()))for(let l=s.length-1;l>=0;l--){const a=s[l];if(t)t===a.name&&o===a.handler&&s.splice(l,1);else if(o===a.handler){s.splice(l,1),a.destroy(),s.length===0&&this.handlers.delete(i);continue}}return}const r=this.handlers.get(e);if(r){const i=r.findIndex(s=>s.handler===o&&s.name===t);if(i!==-1){const s=r[i];r.splice(i,1),s.destroy(),r.length===0&&this.handlers.delete(e)}}}removeAllListeners(e,t){const o=this.handlers.get(e);if(o)if(t)for(let r=0;r<o.length;r++){const i=o[r];i.name===t&&(o.splice(r,1),i.destroy())}else o.forEach(r=>{r.destroy()}),this.handlers.delete(e)}}const Y9=S("update-block-text");function dD(n,e){const t=n.getBoxById(e.id),o=re(t);m(Y9,o,"no parent block"),m(Y9,ee(n,o),"not a text block");const r=n.getBlockText(o),i=V4(r,"id",e.id,e);T6(n,o,i)}function hD(n,e){for(const t of n.blockHooks)if(t.writable){const o=t.writable(n,e);if(typeof o=="boolean")return o}return!0}function fD(n){return n.readonly?!1:!So(n).find(o=>!n.isBlockWritable(o.block))}class mD{constructor(e){this.editor=e}getKey(e){return`${this.editor.id}-${e}`}getItem(e){return window.localStorage.getItem(this.getKey(e))}setItem(e,t){if(!t){this.removeItem(e);return}window.localStorage.setItem(this.getKey(e),t)}removeItem(e){window.localStorage.removeItem(this.getKey(e))}}class gD{constructor(){g(this,"shortcuts",[])}handleKeyboardEvents(e,t){const o=this.shortcuts;for(const r of o){const i=Object.entries(r);for(const[s,l]of i)if(Mr(t,s)){const a=l(e,t);if(a!==void 0)return a}}}}const Ur=S("editor");class pD extends Dt.TypedEmitter{constructor(t,o,r){var i,s,l,a,d,f,p;super();g(this,"parent");g(this,"rootElement");g(this,"contentElement");g(this,"rootContainerObject");g(this,"rootContainer");g(this,"input");g(this,"selection");g(this,"selectionHandler");g(this,"doc");g(this,"id");g(this,"clientId");g(this,"compositingText","");g(this,"undoManager");g(this,"shortcuts",new gD);g(this,"dataConverter",new nD);g(this,"editorBlocks",new s4(this));g(this,"editorBoxes",new n6(this));g(this,"editorInsertions",new l6(this));g(this,"editorEmbeds",new c4(this));g(this,"editorDecorators",new c6(this));g(this,"editorCommandProviders",new Z9(this));g(this,"editorBlockRenders",new oD(this));g(this,"blockHooks",[]);g(this,"domEvents",new uD(this));g(this,"customs",new Map);g(this,"options");g(this,"inputHandlers",new $T(this));g(this,"settingsProvider");g(this,"_readonly",!1);Ur.debug("create editor"),this.setMaxListeners(100),this.options={colors:(i=r==null?void 0:r.colors)!=null?i:["#9923E9","#4587C2","#8BDB7A","#FB28D3","#CBC619","#10FEEB","#812A1A","#8A3F25","#22D742","#A53E74","#555C87","#57E0AA"],componentsOptions:(l=(s=r==null?void 0:r.components)==null?void 0:s.options)!=null?l:{},scrollContainer:r==null?void 0:r.scrollContainer},this.settingsProvider=(a=r==null?void 0:r.settingsProvider)!=null?a:new mD(this),sD(this,r==null?void 0:r.components),this.blockHooks.push(...(f=(d=r==null?void 0:r.components)==null?void 0:d.blockHooks)!=null?f:[]),this.id=(p=r==null?void 0:r.id)!=null?p:K(),this.clientId=K(),this.undoManager=new eD(this),this.doc=new GT(this,o,this.undoManager),this.parent=t,this.rootElement=w("div",["editor-root"],this.parent),this.rootElement.setAttribute("data-editor-client-id",this.clientId),this.contentElement=w("div",["editor-content"],this.rootElement),this.rootContainerObject=o4(this),this.rootContainer=this.rootContainerObject.rootContainer,this.input=new II(this,this.inputHandlers),this.selection=new fT(this),this.selectionHandler=new pT(this),r!=null&&r.shortcuts&&this.shortcuts.shortcuts.push(...r.shortcuts),Kt.isMobile&&W(this.rootElement,"mobile"),Kt.isSafari&&W(this.rootElement,"safari"),this._readonly&&W(this.rootElement,"readonly"),this.emit("load",this,!1)}get readonly(){return this._readonly}set readonly(t){this._readonly=t,t?W(this.rootElement,"readonly"):te(this.rootElement,"readonly"),this.emit("readonlyChanged",this)}get scrollContainer(){return this.options.scrollContainer?this.options.scrollContainer:wo(this.rootContainer)}addCustom(t,o){const r=this.customs.get(t);if(r)return r;const i=o(this);return this.customs.set(t,i),i}getCustom(t){const o=this.customs.get(t);return m(Ur,o,`${t} does not exists`),o}replaceCustom(t,o){const r=this.customs.get(t);return r&&r.destroy(),this.customs.set(t,o),o}findCustom(t){return this.customs.get(t)}findCustomByType(t){const o=this.customs.values();for(const r of o)if(r instanceof t)return r;return null}destroyCustom(t){const o=this.customs.get(t);o&&(this.customs.delete(t),o.destroy())}getComponentOptions(t){return this.options.componentsOptions[t]}registerLocalEvents(t){this.doc.registerLocalEvents(t)}reload(){this.rootContainerObject.reload(),this.emit("load",this,!0)}createBlock(t,o,r){return this.editorBlocks.createBlock(t,o,r)}createBox(t,o){return this.editorBoxes.createBox(t,o)}createInsertion(t,o){return this.editorInsertions.createInsertion(t,o)}destroy(){Ur.debug("destroy editor"),this.emit("destroy",this),this.input.destroy(),this.rootContainerObject.destroy(),this.rootElement.remove(),this.doc.destroy(),this.customs.forEach(t=>t.destroy()),this.customs.clear(),this.selection.destroy(),this.domEvents.destroy(),this.removeAllListeners(),this.inputHandlers.destroy()}focus(){this.input.focus()}focusToBlock(t,o){Eg(this,t,o)}isWritable(){return fD(this)}isBlockWritable(t){return hD(this,t)}getChildContainerData(t){const o=this.doc.getContainerBlocks(t);return m(Ur,o,`no child container data: ${t}, ${JSON.stringify(this.doc)}`),m(Ur,Array.isArray(o),`container data is not an array: ${JSON.stringify(o)}`),o}createChildContainer(t,o,r){return r4(this,t,o,r)}getFirstBlock(){return this.rootContainer.querySelector("[data-type=editor-block]")}getLastBlock(){const t=Array.from(this.rootContainer.querySelectorAll(":scope [data-type=editor-block]"));return t[t.length-1]}getFocusedBlock(){return this.selection.getFocusedBlock()}findBlockById(t){const o=this.rootContainer.querySelector(`#${t}`);return o&&m(Ur,Es(o),"not an valid block element"),o!=null?o:null}findBoxById(t){const o=this.rootContainer.querySelector(`#${t}`);return o&&m(Ur,xm(o),"not an valid box element"),o!=null?o:null}getBlockById(t){const o=this.findBlockById(t);return m(Ur,o,`no block, id=${t}`),o}getBoxById(t){const o=this.findBoxById(t);return m(Ur,o,`no box, id=${t}`),o}getBlockByIndex(t,o){const r=this.getContainerById(t);return Rr(r,o)}getBlockIndex(t){if(typeof t=="string"){const o=this.getBlockById(t);return be(o)}return be(t)}getContainerById(t){return Fr(this,t)}getParentContainer(t){return ne(t)}reloadBlock(t){cD(this,t)}contains(t){const o=t instanceof Element?t:t.parentElement;return o?o.closest("div.editor-root")===this.rootElement:!1}insertBlock(t,o,r,i,s){const l={blockId:r.id,offset:0},a={anchor:l,focus:l};return Gl(this,t,o,r,i!=null?i:a,s)}insertEmbed(t,o,r,i,s){const l={id:K(),type:"embed",embedType:r,embedData:i};return this.insertBlock(t,o,l,s)}deleteBlock(t,o){kg(this,t,o)}mergeTextBlock(t,o){return E6(this,t,o)}breakTextBlock(t,o,r){return Zl(this,t,o,r).newBlock}getTextPosition(){return ql(this)}getBlockString(t,o){const r=this.getBlockText(t);return rt(r,o)}getBlockData(t){return _i(this,t)}getBoxData(t){return J4(this,t)}getBlockText(t){return mn(this,t)}setBlockText(t,o){T6(this,t,o)}deleteTextFromBlock(t,o,r,i){return vg(this,t,o,r,i)}insertTextToBlock(t,o,r,i){return A6(this,t,o,r,i)}insertBoxToBlock(t,o,r){return b6(this,t,o,r)}pasteDoc(t){return this.inputHandlers.pasteDoc(t)}insertDoc(t,o,r,i){L6(this,t,o,r,i)}insertDocAt(t,o,r,i){return Tg(this,t,o,r,i)}deleteChildContainers(t){B6(this,t)}replaceBlockText(t,o){return ph(this,t,o)}updateBlockData(t,o,r){const i={...this.getBlockData(t),...o},{id:s,type:l,...a}=i;return Ch(this,t,a,(r!=null?r:this.selection.range).toDocRange())}updateEmbedData(t,o,r){return D6(this,t,o,r)}updateBoxData(t){dD(this,t)}getSelectedText(){const t=vh(this);return Ia(this,t)}clearSelectedContents(){Bg(this)}insertTextBlock(t,o,r,i){const s=sr(t!=null?t:"");return w6(this,s,o,r,i==null?void 0:i.newRange,i==null?void 0:i.insertBlockOptions)}updateCompositionText(t,o){if(t&&!o&&(this.selection.range.isCollapsed()||this.clearSelectedContents()),!t&&!o){y6(this);return}o?(this.compositingText="",hm()||bg(this,t)):(this.compositingText=t,v6(this))}getColor(t){const o=this.options.colors;return o.length===0?"#FF1A75":o[t%o.length]}}function Fa(n,e,t){return new pD(n,e,t)}function CD(n){const e=(o,r)=>{const i=o.findIndex(l=>l.id===r.id);if(i===-1){o.push(r);return}const s=o[i];if(s.value!==r.value){o.splice(i,1);return}if(!!s.states){if(!r.states){s.states=[];return}s.states=em.default(s.states,r.states)}},t=[];return n.forEach(o=>{o.forEach(r=>{e(t,r)})}),t}const AD=["#FBBFBD","#FFDDB6","#FFF897","#C5F0C1","#CEDDFE","#DCC9FC","#E5E6E8","#F76964","#FFA53D","#FFE928","#63D156","#A0BBFE","#C4A5FB","#BBBFC3"];class Ih extends Dt.TypedEmitter{constructor(t){super();g(this,"users",new Map);g(this,"cursors",new Map);g(this,"addingUser",!1);g(this,"colors");this.colors=t&&t.length>0?t:AD}setCursor(t){this.addUser(t.user);const o=this.cursors.get(t.user.userId);if(o&&la.default(o,t))return;this.cursors.set(t.user.userId,t);const r=new Set([t.range.anchor.blockId,t.range.focus.blockId]),i=new Set(r);o&&new Set([o.range.anchor.blockId,o.range.focus.blockId]).forEach(l=>{r.has(l)||i.add(l)}),this.emit("remote-carets-change",[...i])}addUsers(t){this.addingUser=!0,t.forEach(o=>this.addUser(o)),this.addingUser=!1,this.emit("change",Array.from(this.users.values()))}addUser(t){this.users.set(t.userId,t),this.addingUser||this.emit("change",Array.from(this.users.values()))}findUser(t){var o;return(o=this.users.get(t))!=null?o:null}removeUser(t){this.users.delete(t),this.cursors.delete(t),this.emit("change",Array.from(this.users.values()))}updateUsers(t){this.users.clear(),this.addingUser=!0;try{t.forEach(o=>{this.addUser(o)})}finally{this.addingUser=!1}setTimeout(()=>{this.emit("change",Array.from(this.users.values()))},300)}getSimpleCursors(t){const o=new Map;return Array.from(this.cursors.values()).filter(r=>r.range.anchor.blockId===t&&ih(r.range)).forEach(r=>{const i=r.range.focus.offset;let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}),o}getCursors(t){return Array.from(this.cursors.values()).filter(o=>o.range.anchor.blockId===t||o.range.focus.blockId===t)}onUpdateBlockText(t,o,r){if(!t.text)return;this.getCursors(t.id).forEach(l=>{if(ih(l.range)){const{anchor:a,focus:d}=l.range;a.blockId===t.id&&(a.offset=ln.transformCursor(a.offset,o,r)),d.blockId===t.id&&(d.offset=ln.transformCursor(d.offset,o,r))}})}getFixedUserColor(t,o){let r=0;Array.from(t).forEach(s=>{r+=s.charCodeAt(0)});const i=r%this.colors.length;return this.colors[i]}destroy(){this.removeAllListeners()}}const Xt=S("local-doc");class Vg extends ua{constructor(t,o){super();g(this,"doc");g(this,"serviceUrl");t?this.doc=t:this.doc={meta:{},comments:{},blocks:{root:[sr("")]}},this.serviceUrl=(o==null?void 0:o.serverUrl)||""}beginBatchUpdate(){return 0}endBatchUpdate(){return 0}toJSON(){return fe.default(this.doc)}getContainerBlocks(t){return this.doc.blocks[t]}getBlockData(t,o){const r=this.getContainerBlocks(t);m(Xt,r,`no container data: ${t}`);const i=r[o];return m(Xt,i,`no block data: ${o}`),i}localUpdateBlockText(t,o,r){const i=this.getBlockData(t,o);m(Xt,i.text,"no text for data");const s=ln.apply(i.text,r);return i.text=s,m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(l=>{var a;return(a=l.onUpdateBlockText)==null?void 0:a.call(l,t,o,r,!0)}),s}localUpdateBlockData(t,o,r){const i=this.getBlockData(t,o);return r.delete.forEach(s=>delete i[s]),Object.entries(r.insert).forEach(([s,l])=>{i[s]=l}),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,t,o,r,!0)}),i}localInsertBlock(t,o,r){const i=this.getContainerBlocks(t);return m(Xt,i,`no container data: ${t}`),m(Xt,o>=0&&o<=i.length,`invalid block index: ${o}, ${i.length}`),i.splice(o,0,r),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onInsertBlock)==null?void 0:l.call(s,t,o,r,!0)}),r}localDeleteBlock(t,o){const r=this.getContainerBlocks(t);m(Xt,r,`no container data: ${t}`),m(Xt,o>=0&&o<=r.length,`invalid block index: ${o}, ${r.length}`);const i=r[o];return r.splice(o,1),m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onDeleteBlock)==null?void 0:l.call(s,t,o,!0)}),i}localInsertChildContainer(t,o){this.doc.blocks[t]=o,m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onInsertChildContainer)==null?void 0:i.call(r,t,o,!0)})}localDeleteChildContainers(t){Xt.debug(`delete child containers: ${t}`),t.forEach(o=>{m(Xt,this.doc.blocks[o],`no child container: ${o}`),delete this.doc.blocks[o]}),t.forEach(o=>{m(Xt,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,o,!0)})})}uploadResource(t,o){m(Xt,!1,"not implemented")}async addResources(t){return t}buildResourceUrl(t){return t}request(t,o){m(Xt,!1,"not implemented")}broadcastMessage(t){}getServerMeta(){return{serverId:this.serviceUrl}}getUser(){return{permission:"w",userId:"-",displayName:"-",avatarUrl:"-",rainbowIndex:0}}getRemoteUsers(){return new Ih}setDoc(t){this.doc=fe.default(t),this.callbacks.forEach(o=>{var r;return(r=o.onRequestReload)==null?void 0:r.call(o,"change doc")})}destroy(){this.clearCallbacks()}}class bD{constructor(e){this.cleanup=e}destroy(){var e;(e=this.cleanup)==null||e.call(this)}}function Wg(n,e,t){n.addCustom(e,()=>{var i;const o=(i=t())!=null?i:void 0;return new bD(o)})}const J9=S("find-block");function K9(n,e){const t=Ts(e);if(!t){if(no(e))return null;const o=xs(e);return m(J9,o,"no parent block"),K9(n,o)}return Le(n,t)?zl(n,t,{visibleOnly:!0}):t}function X9(n,e){const t=Ds(e);if(!t){if(no(e))return null;const o=xs(e);return m(J9,o,"no parent block"),X9(n,o)}return Le(n,t)?zm(n,t,{visibleOnly:!0}):t}const vD=S("remote-cursor");class yD{constructor(){g(this,"remoteUsers",new Ih)}onCustomMessage(e){const t=e;if(t.type==="onlineUsers"){const o=t;this.handleUpdateUsers(o.users)}else t.type==="caret"?this.handleUpdateCaret(t):vD.debug(`unknown remote message received: ${e}`)}handleUpdateUsers(e){this.remoteUsers.updateUsers(e)}handleUpdateCaret(e){const t=this.remoteUsers.findUser(e.userId);!t||this.remoteUsers.setCursor({oneseditor:"cursor",user:t,range:e.range,time:Date.now()})}destroy(){this.remoteUsers.destroy()}}function kD(n){const{blocks:e,meta:t,comments:o,...r}=n;return{rootBlocks:e,meta:t,comments:o,childBlocks:r}}function wD(n){const{blocks:e,meta:t,comments:o}=n,{root:r,...i}=e;return{blocks:r,meta:t,comments:o,...i}}function Na(n){const{childBlocks:e,meta:t,comments:o,rootBlocks:r}=kD(fe.default(n));return{blocks:{root:r,...e},meta:t,comments:o}}function Ni(n){return n==="root"?"blocks":n}function Jl(n){return n==="blocks"?"root":n}const BD={type:{name:"rich-text",uri:"http://sharejs.org/types/rich-text/v1",create(n){return new on.default(n)},apply(n,e){const t=new on.default(n),o=new on.default(e);return t.compose(o).ops},compose(n,e){const t=new on.default(n),o=new on.default(e);return t.compose(o).ops},diff(n,e){const t=new on.default(n),o=new on.default(e);return t.diff(o).ops},transform(n,e,t){const o=new on.default(n);return new on.default(e).transform(o,t==="left").ops},transformCursor(n,e,t){return e.transformPosition(n,!t)},normalize(n){return n},serialize(n){return n.ops},deserialize(n){return n},transformPresence(n,e,t){if(!n)return null;const o=new on.default(e),r=this.transformCursor(n.index,o,t),i=this.transformCursor(n.index+n.length,o,t);return{...n,index:r,length:i-r}}}};var cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$i={},qg=F3.default.EventEmitter;$i.EventEmitter=qg,$i.mixin=ED;function ED(n){for(var e in qg.prototype)n.prototype[e]=qg.prototype[e]}var e7=["info","warn","error"];function t7(){var n={};e7.forEach(function(e){n[e]=console[e].bind(console)}),this.setMethods(n)}var xD=t7;t7.prototype.setMethods=function(n){n=n||{};var e=this;e7.forEach(function(t){typeof n[t]=="function"&&(e[t]=n[t])})};var ID=xD,TD=new ID,n7=TD;function $s(n,e){this.code=n,this.message=e||"",Error.captureStackTrace?Error.captureStackTrace(this,$s):this.stack=new Error().stack}$s.prototype=Object.create(Error.prototype),$s.prototype.constructor=$s,$s.prototype.name="ShareDBError",$s.CODES={ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT:"ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT",ERR_APPLY_SNAPSHOT_NOT_PROVIDED:"ERR_APPLY_SNAPSHOT_NOT_PROVIDED",ERR_CLIENT_ID_BADLY_FORMED:"ERR_CLIENT_ID_BADLY_FORMED",ERR_CANNOT_PING_OFFLINE:"ERR_CANNOT_PING_OFFLINE",ERR_CONNECTION_SEQ_INTEGER_OVERFLOW:"ERR_CONNECTION_SEQ_INTEGER_OVERFLOW",ERR_CONNECTION_STATE_TRANSITION_INVALID:"ERR_CONNECTION_STATE_TRANSITION_INVALID",ERR_DATABASE_ADAPTER_NOT_FOUND:"ERR_DATABASE_ADAPTER_NOT_FOUND",ERR_DATABASE_DOES_NOT_SUPPORT_SUBSCRIBE:"ERR_DATABASE_DOES_NOT_SUPPORT_SUBSCRIBE",ERR_DATABASE_METHOD_NOT_IMPLEMENTED:"ERR_DATABASE_METHOD_NOT_IMPLEMENTED",ERR_DEFAULT_TYPE_MISMATCH:"ERR_DEFAULT_TYPE_MISMATCH",ERR_DOC_MISSING_VERSION:"ERR_DOC_MISSING_VERSION",ERR_DOC_ALREADY_CREATED:"ERR_DOC_ALREADY_CREATED",ERR_DOC_DOES_NOT_EXIST:"ERR_DOC_DOES_NOT_EXIST",ERR_DOC_TYPE_NOT_RECOGNIZED:"ERR_DOC_TYPE_NOT_RECOGNIZED",ERR_DOC_WAS_DELETED:"ERR_DOC_WAS_DELETED",ERR_INFLIGHT_OP_MISSING:"ERR_INFLIGHT_OP_MISSING",ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION:"ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION",ERR_MAX_SUBMIT_RETRIES_EXCEEDED:"ERR_MAX_SUBMIT_RETRIES_EXCEEDED",ERR_MESSAGE_BADLY_FORMED:"ERR_MESSAGE_BADLY_FORMED",ERR_MILESTONE_ARGUMENT_INVALID:"ERR_MILESTONE_ARGUMENT_INVALID",ERR_OP_ALREADY_SUBMITTED:"ERR_OP_ALREADY_SUBMITTED",ERR_OP_NOT_ALLOWED_IN_PROJECTION:"ERR_OP_NOT_ALLOWED_IN_PROJECTION",ERR_OP_SUBMIT_REJECTED:"ERR_OP_SUBMIT_REJECTED",ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM:"ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM",ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM:"ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM",ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT:"ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT",ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED:"ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED",ERR_OT_OP_BADLY_FORMED:"ERR_OT_OP_BADLY_FORMED",ERR_OT_OP_NOT_APPLIED:"ERR_OT_OP_NOT_APPLIED",ERR_OT_OP_NOT_PROVIDED:"ERR_OT_OP_NOT_PROVIDED",ERR_PRESENCE_TRANSFORM_FAILED:"ERR_PRESENCE_TRANSFORM_FAILED",ERR_PROTOCOL_VERSION_NOT_SUPPORTED:"ERR_PROTOCOL_VERSION_NOT_SUPPORTED",ERR_QUERY_EMITTER_LISTENER_NOT_ASSIGNED:"ERR_QUERY_EMITTER_LISTENER_NOT_ASSIGNED",ERR_SNAPSHOT_READ_SILENT_REJECTION:"ERR_SNAPSHOT_READ_SILENT_REJECTION",ERR_SNAPSHOT_READS_REJECTED:"ERR_SNAPSHOT_READS_REJECTED",ERR_SUBMIT_TRANSFORM_OPS_NOT_FOUND:"ERR_SUBMIT_TRANSFORM_OPS_NOT_FOUND",ERR_TYPE_CANNOT_BE_PROJECTED:"ERR_TYPE_CANNOT_BE_PROJECTED",ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE:"ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE",ERR_UNKNOWN_ERROR:"ERR_UNKNOWN_ERROR"};var Th=$s,$a={},o7=DD;function DD(n,e,t,o){var r=function(s,l,a,d){e(a,s,l,"left"),e(d,l,s,"right")},i=n.transformX=function(s,l){t(s),t(l);for(var a=[],d=0;d<l.length;d++){for(var f=l[d],p=[],A=0;A<s.length;){var v=[];if(r(s[A],f,p,v),A++,v.length===1)f=v[0];else if(v.length===0){for(var B=A;B<s.length;B++)o(p,s[B]);f=null;break}else{for(var D=i(s.slice(A),v),I=0;I<D[0].length;I++)o(p,D[0][I]);for(var _=0;_<D[1].length;_++)o(a,D[1][_]);f=null;break}}f!=null&&o(a,f),s=p}return[s,a]};n.transform=function(s,l,a){if(!(a==="left"||a==="right"))throw new Error("type must be 'left' or 'right'");return l.length===0?s:s.length===1&&l.length===1?e([],s[0],l[0],a):a==="left"?i(s,l)[0]:i(l,s)[1]}}var r7={exports:{}},Hi=r7.exports={name:"text0",uri:"http://sharejs.org/types/textv0",create:function(n){if(n!=null&&typeof n!="string")throw new Error("Initial data must be a string");return n||""}},Gg=function(n,e,t){return n.slice(0,e)+t+n.slice(e)},Zg=function(n){if(typeof n.p!="number")throw new Error("component missing position field");if(typeof n.i=="string"==(typeof n.d=="string"))throw new Error("component needs an i or d field");if(n.p<0)throw new Error("position cannot be negative")},Dh=function(n){for(var e=0;e<n.length;e++)Zg(n[e])};Hi.apply=function(n,e){var t;Dh(e);for(var o=0;o<e.length;o++){var r=e[o];if(r.i!=null)n=Gg(n,r.p,r.i);else{if(t=n.slice(r.p,r.p+r.d.length),r.d!==t)throw new Error("Delete component '"+r.d+"' does not match deleted text '"+t+"'");n=n.slice(0,r.p)+n.slice(r.p+r.d.length)}}return n};var zr=Hi._append=function(n,e){if(!(e.i===""||e.d===""))if(n.length===0)n.push(e);else{var t=n[n.length-1];t.i!=null&&e.i!=null&&t.p<=e.p&&e.p<=t.p+t.i.length?n[n.length-1]={i:Gg(t.i,e.p-t.p,e.i),p:t.p}:t.d!=null&&e.d!=null&&e.p<=t.p&&t.p<=e.p+e.d.length?n[n.length-1]={d:Gg(e.d,t.p-e.p,t.d),p:e.p}:n.push(e)}};Hi.compose=function(n,e){Dh(n),Dh(e);for(var t=n.slice(),o=0;o<e.length;o++)zr(t,e[o]);return t},Hi.normalize=function(n){var e=[];(n.i!=null||n.p!=null)&&(n=[n]);for(var t=0;t<n.length;t++){var o=n[t];o.p==null&&(o.p=0),zr(e,o)}return e};var Qg=function(n,e,t){return e.i!=null?e.p<n||e.p===n&&t?n+e.i.length:n:n<=e.p?n:n<=e.p+e.d.length?e.p:n-e.d.length};Hi.transformCursor=function(n,e,t){for(var o=t==="right",r=0;r<e.length;r++)n=Qg(n,e[r],o);return n};var SD=Hi._tc=function(n,e,t,o){if(Zg(e),Zg(t),e.i!=null)zr(n,{i:e.i,p:Qg(e.p,t,o==="right")});else if(t.i!=null){var r=e.d;e.p<t.p&&(zr(n,{d:r.slice(0,t.p-e.p),p:e.p}),r=r.slice(t.p-e.p)),r!==""&&zr(n,{d:r,p:e.p+t.i.length})}else if(e.p>=t.p+t.d.length)zr(n,{d:e.d,p:e.p-t.d.length});else if(e.p+e.d.length<=t.p)zr(n,e);else{var i={d:"",p:e.p};e.p<t.p&&(i.d=e.d.slice(0,t.p-e.p)),e.p+e.d.length>t.p+t.d.length&&(i.d+=e.d.slice(t.p+t.d.length-e.p));var s=Math.max(e.p,t.p),l=Math.min(e.p+e.d.length,t.p+t.d.length),a=e.d.slice(s-e.p,l-e.p),d=t.d.slice(s-t.p,l-t.p);if(a!==d)throw new Error("Delete ops delete different text in the same region of the document");i.d!==""&&(i.p=Qg(i.p,t),zr(n,i))}return n},LD=function(n){return n.i!=null?{d:n.i,p:n.p}:{i:n.d,p:n.p}};Hi.invert=function(n){n=n.slice().reverse();for(var e=0;e<n.length;e++)n[e]=LD(n[e]);return n},o7(Hi,SD,Dh,zr);var Sh=function(n){return Object.prototype.toString.call(n)=="[object Array]"},MD=function(n){return!!n&&n.constructor===Object},Oo=function(n){return JSON.parse(JSON.stringify(n))},Ie={name:"json0",uri:"http://sharejs.org/types/JSONv0"},Vr={};Ie.registerSubtype=function(n){Vr[n.name]=n},Ie.create=function(n){return n===void 0?null:Oo(n)},Ie.invertComponent=function(n){var e={p:n.p};return n.t&&Vr[n.t]&&(e.t=n.t,e.o=Vr[n.t].invert(n.o)),n.si!==void 0&&(e.sd=n.si),n.sd!==void 0&&(e.si=n.sd),n.oi!==void 0&&(e.od=n.oi),n.od!==void 0&&(e.oi=n.od),n.li!==void 0&&(e.ld=n.li),n.ld!==void 0&&(e.li=n.ld),n.na!==void 0&&(e.na=-n.na),n.lm!==void 0&&(e.lm=n.p[n.p.length-1],e.p=n.p.slice(0,n.p.length-1).concat([n.lm])),e},Ie.invert=function(n){for(var e=n.slice().reverse(),t=[],o=0;o<e.length;o++)t.push(Ie.invertComponent(e[o]));return t},Ie.checkValidOp=function(n){for(var e=0;e<n.length;e++)if(!Sh(n[e].p))throw new Error("Missing path")},Ie.checkList=function(n){if(!Sh(n))throw new Error("Referenced element not a list")},Ie.checkObj=function(n){if(!MD(n))throw new Error("Referenced element not an object (it was "+JSON.stringify(n)+")")};function Ha(n){n.t="text0";var e={p:n.p.pop()};n.si!=null&&(e.i=n.si),n.sd!=null&&(e.d=n.sd),n.o=[e]}function ja(n){n.p.push(n.o[0].p),n.o[0].i!=null&&(n.si=n.o[0].i),n.o[0].d!=null&&(n.sd=n.o[0].d),delete n.t,delete n.o}Ie.apply=function(n,e){Ie.checkValidOp(e),e=Oo(e);for(var t={data:n},o=0;o<e.length;o++){var r=e[o];(r.si!=null||r.sd!=null)&&Ha(r);for(var i=null,s=t,l="data",a=0;a<r.p.length;a++){var d=r.p[a];if(i=s,s=s[l],l=d,i==null)throw new Error("Path invalid")}if(r.t&&r.o!==void 0&&Vr[r.t])s[l]=Vr[r.t].apply(s[l],r.o);else if(r.na!==void 0){if(typeof s[l]!="number")throw new Error("Referenced element not a number");s[l]+=r.na}else if(r.li!==void 0&&r.ld!==void 0)Ie.checkList(s),s[l]=r.li;else if(r.li!==void 0)Ie.checkList(s),s.splice(l,0,r.li);else if(r.ld!==void 0)Ie.checkList(s),s.splice(l,1);else if(r.lm!==void 0){if(Ie.checkList(s),r.lm!=l){var f=s[l];s.splice(l,1),s.splice(r.lm,0,f)}}else if(r.oi!==void 0)Ie.checkObj(s),s[l]=r.oi;else if(r.od!==void 0)Ie.checkObj(s),delete s[l];else throw new Error("invalid / missing instruction in op")}return t.data},Ie.shatter=function(n){for(var e=[],t=0;t<n.length;t++)e.push([n[t]]);return e},Ie.incrementalApply=function(n,e,t){for(var o=0;o<e.length;o++){var r=[e[o]];n=Ie.apply(n,r),t(r,n)}return n};var RD=Ie.pathMatches=function(n,e,t){if(n.length!=e.length)return!1;for(var o=0;o<n.length;o++)if(n[o]!==e[o]&&(!t||o!==n.length-1))return!1;return!0};Ie.append=function(n,e){if(e=Oo(e),n.length===0){n.push(e);return}var t=n[n.length-1];if((e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(Ha(e),Ha(t)),RD(e.p,t.p))if(e.t&&t.t&&e.t===t.t&&Vr[e.t]){if(t.o=Vr[e.t].compose(t.o,e.o),e.si!=null||e.sd!=null){for(var o=e.p,r=0;r<t.o.length-1;r++)e.o=[t.o.pop()],e.p=o.slice(),ja(e),n.push(e);ja(t)}}else t.na!=null&&e.na!=null?n[n.length-1]={p:t.p,na:t.na+e.na}:t.li!==void 0&&e.li===void 0&&e.ld===t.li?t.ld!==void 0?delete t.li:n.pop():t.od!==void 0&&t.oi===void 0&&e.oi!==void 0&&e.od===void 0?t.oi=e.oi:t.oi!==void 0&&e.od!==void 0?e.oi!==void 0?t.oi=e.oi:t.od!==void 0?delete t.oi:n.pop():e.lm!==void 0&&e.p[e.p.length-1]===e.lm||n.push(e);else(e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(ja(e),ja(t)),n.push(e)},Ie.compose=function(n,e){Ie.checkValidOp(n),Ie.checkValidOp(e);for(var t=Oo(n),o=0;o<e.length;o++)Ie.append(t,e[o]);return t},Ie.normalize=function(n){var e=[];n=Sh(n)?n:[n];for(var t=0;t<n.length;t++){var o=n[t];o.p==null&&(o.p=[]),Ie.append(e,o)}return e},Ie.commonLengthForOps=function(n,e){var t=n.p.length,o=e.p.length;if((n.na!=null||n.t)&&t++,(e.na!=null||e.t)&&o++,t===0)return-1;if(o===0)return null;t--,o--;for(var r=0;r<t;r++){var i=n.p[r];if(r>=o||i!==e.p[r])return null}return t},Ie.canOpAffectPath=function(n,e){return Ie.commonLengthForOps({p:e},n)!=null},Ie.transformComponent=function(n,e,t,o){e=Oo(e);var r=Ie.commonLengthForOps(t,e),i=Ie.commonLengthForOps(e,t),s=e.p.length,l=t.p.length;if((e.na!=null||e.t)&&s++,(t.na!=null||t.t)&&l++,i!=null&&l>s&&e.p[i]==t.p[i]){if(e.ld!==void 0){var a=Oo(t);a.p=a.p.slice(s),e.ld=Ie.apply(Oo(e.ld),[a])}else if(e.od!==void 0){var a=Oo(t);a.p=a.p.slice(s),e.od=Ie.apply(Oo(e.od),[a])}}if(r!=null){var d=s==l,a=t;if((e.si!=null||e.sd!=null)&&(t.si!=null||t.sd!=null)&&(Ha(e),a=Oo(t),Ha(a)),a.t&&Vr[a.t]){if(e.t&&e.t===a.t){var f=Vr[e.t].transform(e.o,a.o,o);if(e.si!=null||e.sd!=null)for(var p=e.p,A=0;A<f.length;A++)e.o=[f[A]],e.p=p.slice(),ja(e),Ie.append(n,e);else(!Sh(f)||f.length>0)&&(e.o=f,Ie.append(n,e));return n}}else if(t.na===void 0){if(t.li!==void 0&&t.ld!==void 0){if(t.p[r]===e.p[r])if(d){if(e.ld!==void 0)if(e.li!==void 0&&o==="left")e.ld=Oo(t.li);else return n}else return n}else if(t.li!==void 0)e.li!==void 0&&e.ld===void 0&&d&&e.p[r]===t.p[r]?o==="right"&&e.p[r]++:t.p[r]<=e.p[r]&&e.p[r]++,e.lm!==void 0&&d&&t.p[r]<=e.lm&&e.lm++;else if(t.ld!==void 0){if(e.lm!==void 0&&d){if(t.p[r]===e.p[r])return n;var p=t.p[r],v=e.p[r],B=e.lm;(p<B||p===B&&v<B)&&e.lm--}if(t.p[r]<e.p[r])e.p[r]--;else if(t.p[r]===e.p[r]){if(l<s)return n;if(e.ld!==void 0)if(e.li!==void 0)delete e.ld;else return n}}else if(t.lm!==void 0)if(e.lm!==void 0&&s===l){var v=e.p[r],B=e.lm,D=t.p[r],I=t.lm;if(D!==I)if(v===D)if(o==="left")e.p[r]=I,v===B&&(e.lm=I);else return n;else v>D&&e.p[r]--,v>I?e.p[r]++:v===I&&D>I&&(e.p[r]++,v===B&&e.lm++),(B>D||B===D&&B>v)&&e.lm--,B>I?e.lm++:B===I&&(I>D&&B>v||I<D&&B<v?o==="right"&&e.lm++:B>v?e.lm++:B===D&&e.lm--)}else if(e.li!==void 0&&e.ld===void 0&&d){var v=t.p[r],B=t.lm;p=e.p[r],p>v&&e.p[r]--,p>B&&e.p[r]++}else{var v=t.p[r],B=t.lm;p=e.p[r],p===v?e.p[r]=B:(p>v&&e.p[r]--,(p>B||p===B&&v>B)&&e.p[r]++)}else if(t.oi!==void 0&&t.od!==void 0){if(e.p[r]===t.p[r])if(e.oi!==void 0&&d){if(o==="right")return n;e.od=t.oi}else return n}else if(t.oi!==void 0){if(e.oi!==void 0&&e.p[r]===t.p[r])if(o==="left")Ie.append(n,{p:e.p,od:t.oi});else return n}else if(t.od!==void 0&&e.p[r]==t.p[r]){if(!d)return n;if(e.oi!==void 0)delete e.od;else return n}}}return Ie.append(n,e),n},o7(Ie,Ie.transformComponent,Ie.checkValidOp,Ie.append);var OD=r7.exports;Ie.registerSubtype(OD);var _D=Ie,PD={type:_D};(function(n){n.defaultType=PD.type,n.map={},n.register=function(e){e.name&&(n.map[e.name]=e),e.uri&&(n.map[e.uri]=e)},n.register(n.defaultType)})($a);var _o={};(function(n){n.doNothing=e;function e(){}n.hasKeys=function(t){for(var o in t)return!0;return!1},n.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},n.isValidVersion=function(t){return t===null?!0:n.isInteger(t)&&t>=0},n.isValidTimestamp=function(t){return n.isValidVersion(t)},n.MAX_SAFE_INTEGER=9007199254740991,n.dig=function(){for(var t=arguments[0],o=1;o<arguments.length;o++){var r=arguments[o];t=t[r]||(o===arguments.length-1?void 0:{})}return t},n.digOrCreate=function(){for(var t=arguments[0],o=arguments[arguments.length-1],r=1;r<arguments.length-1;r++){var i=arguments[r];t=t[i]||(t[i]=r===arguments.length-2?o():{})}return t},n.digAndRemove=function(){for(var t=arguments[0],o=[t],r=1;r<arguments.length-1;r++){var i=arguments[r];if(!t.hasOwnProperty(i))break;t=t[i],o.push(t)}for(var r=o.length-1;r>=0;r--){var s=o[r],i=arguments[r+1],l=s[i];(r===o.length-1||!n.hasKeys(l))&&delete s[i]}},n.supportsPresence=function(t){return t&&typeof t.transformPresence=="function"},n.callEach=function(t,o){var r=!1;return t.forEach(function(i){i&&(i(o),r=!0)}),r},n.truthy=function(t){return!!t},n.nextTick=function(t){if(typeof process<"u"&&process.nextTick)return process.nextTick.apply(null,arguments);for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];setTimeout(function(){t.apply(null,o)})},n.clone=function(t){return t===void 0?void 0:JSON.parse(JSON.stringify(t))}})(_o);var i7=Array.isArray,s7=Object.keys,FD=Object.prototype.hasOwnProperty,ND=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var o=i7(e),r=i7(t),i,s,l;if(o&&r){if(s=e.length,s!=t.length)return!1;for(i=s;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(o!=r)return!1;var a=e instanceof Date,d=t instanceof Date;if(a!=d)return!1;if(a&&d)return e.getTime()==t.getTime();var f=e instanceof RegExp,p=t instanceof RegExp;if(f!=p)return!1;if(f&&p)return e.toString()==t.toString();var A=s7(e);if(s=A.length,s!==s7(t).length)return!1;for(i=s;i--!==0;)if(!FD.call(t,A[i]))return!1;for(i=s;i--!==0;)if(l=A[i],!n(e[l],t[l]))return!1;return!0}return e!==e&&t!==t},l7=$i,$D=n7,Wn=Th,Lh=$a,Po=_o,HD=Po.clone,jD=ND,Tn=Wn.CODES,UD=Pe;function Pe(n,e,t){l7.EventEmitter.call(this),this.connection=n,this.collection=e,this.id=t,this.version=null,this.type=null,this.data=void 0,this.inflightFetch=[],this.inflightSubscribe=null,this.pendingFetch=[],this.pendingSubscribe=[],this.subscribed=!1,this.wantSubscribe=!1,this._wantsDestroy=!1,this.inflightOp=null,this.pendingOps=[],this.type=null,this.applyStack=null,this.preventCompose=!1,this.submitSource=!1,this.paused=!1,this._dataStateVersion=0}l7.mixin(Pe),Pe.prototype.destroy=function(n){this._wantsDestroy=!0;var e=this;e.whenNothingPending(function(){e.wantSubscribe?e.unsubscribe(function(t){if(t)return n?n(t):e.emit("error",t);e.connection._destroyDoc(e),n&&n()}):(e.connection._destroyDoc(e),n&&n())})},Pe.prototype._setType=function(n){if(typeof n=="string"&&(n=Lh.map[n]),n)this.type=n;else if(n===null)this.type=n,this._setData(void 0);else{var e=new Wn(Tn.ERR_DOC_TYPE_NOT_RECOGNIZED,"Missing type "+n);return this.emit("error",e)}},Pe.prototype._setData=function(n){this.data=n,this._dataStateVersion++},Pe.prototype.ingestSnapshot=function(n,e){if(!n)return e&&e();if(typeof n.v!="number"){var t=new Wn(Tn.ERR_INGESTED_SNAPSHOT_HAS_NO_VERSION,"Missing version in ingested snapshot. "+this.collection+"."+this.id);return e?e(t):this.emit("error",t)}if(this.type||this.hasWritePending()){if(this.version==null){if(this.hasWritePending())return e&&this.once("no write pending",e);var t=new Wn(Tn.ERR_DOC_MISSING_VERSION,"Cannot ingest snapshot in doc with null version. "+this.collection+"."+this.id);return e?e(t):this.emit("error",t)}return n.v>this.version?this.fetch(e):e&&e()}if(this.version>n.v)return e&&e();this.version=n.v;var o=n.type===void 0?Lh.defaultType:n.type;this._setType(o),this._setData(this.type&&this.type.deserialize?this.type.deserialize(n.data):n.data),this.emit("load"),e&&e()},Pe.prototype.whenNothingPending=function(n){var e=this;Po.nextTick(function(){if(e.hasPending()){e.once("nothing pending",n);return}n()})},Pe.prototype.hasPending=function(){return!!(this.inflightOp||this.pendingOps.length||this.inflightFetch.length||this.inflightSubscribe||this.pendingFetch.length||this.pendingSubscribe.length)},Pe.prototype.hasWritePending=function(){return!!(this.inflightOp||this.pendingOps.length)},Pe.prototype._emitNothingPending=function(){this.hasWritePending()||(this.emit("no write pending"),!this.hasPending()&&this.emit("nothing pending"))},Pe.prototype._emitResponseError=function(n,e){if(n&&n.code===Tn.ERR_SNAPSHOT_READ_SILENT_REJECTION){this.wantSubscribe=!1,e&&e(),this._emitNothingPending();return}if(e){e(n),this._emitNothingPending();return}this._emitNothingPending(),this.emit("error",n)},Pe.prototype._handleFetch=function(n,e){var t=this.pendingFetch;this.pendingFetch=[];var o=this.inflightFetch.shift();if(o&&t.push(o),t.length&&(o=function(r){Po.callEach(t,r)}),n)return this._emitResponseError(n,o);this.ingestSnapshot(e,o),this._emitNothingPending()},Pe.prototype._handleSubscribe=function(n,e){var t=this.inflightSubscribe;this.inflightSubscribe=null;var o=this.pendingFetch;this.pendingFetch=[],t.callback&&o.push(t.callback);var r;if(o.length&&(r=function(i){Po.callEach(o,i)}),n)return this._emitResponseError(n,r);this.subscribed=t.wantSubscribe,this.subscribed?this.ingestSnapshot(e,r):r&&r(),this._emitNothingPending(),this._flushSubscribe()},Pe.prototype._handleOp=function(n,e){if(n)return this.inflightOp?(n.code===Tn.ERR_OP_SUBMIT_REJECTED&&(n=null),this._rollback(n)):this.emit("error",n);if(this.inflightOp&&e.src===this.inflightOp.src&&e.seq===this.inflightOp.seq){this._opAcknowledged(e);return}if(this.version==null||e.v>this.version){this.fetch();return}if(!(e.v<this.version)){if(this.inflightOp){var t=Mh(this.inflightOp,e);if(t)return this._hardRollback(t)}for(var o=0;o<this.pendingOps.length;o++){var t=Mh(this.pendingOps[o],e);if(t)return this._hardRollback(t)}this.version++;try{this._otApply(e,!1)}catch(r){return this._hardRollback(r)}}},Pe.prototype._onConnectionStateChanged=function(){this.connection.canSend?(this.flush(),this._resubscribe()):(this.inflightOp&&(this.pendingOps.unshift(this.inflightOp),this.inflightOp=null),this.subscribed=!1,this.inflightSubscribe&&(this.inflightSubscribe.wantSubscribe?(this.pendingSubscribe.unshift(this.inflightSubscribe),this.inflightSubscribe=null):this._handleSubscribe()),this.inflightFetch.length&&(this.pendingFetch=this.pendingFetch.concat(this.inflightFetch),this.inflightFetch.length=0))},Pe.prototype._resubscribe=function(){if(!this.pendingSubscribe.length&&this.wantSubscribe)return this.subscribe();var n=this.pendingSubscribe.some(function(e){return e.wantSubscribe});!n&&this.pendingFetch.length&&this.fetch(),this._flushSubscribe()},Pe.prototype.fetch=function(n){if(this.connection.canSend){var e=this.connection.sendFetch(this);zD(this.inflightFetch,e,n);return}this.pendingFetch.push(n)},Pe.prototype.subscribe=function(n){var e=!0;this._queueSubscribe(e,n)},Pe.prototype.unsubscribe=function(n){var e=!1;this._queueSubscribe(e,n)},Pe.prototype._queueSubscribe=function(n,e){var t=this.pendingSubscribe[this.pendingSubscribe.length-1]||this.inflightSubscribe,o=t&&t.wantSubscribe===n;if(o){t.callback=VD([t.callback,e]);return}this.pendingSubscribe.push({wantSubscribe:!!n,callback:e}),this._flushSubscribe()},Pe.prototype._flushSubscribe=function(){if(!(this.inflightSubscribe||!this.pendingSubscribe.length)){if(this.connection.canSend){this.inflightSubscribe=this.pendingSubscribe.shift(),this.wantSubscribe=this.inflightSubscribe.wantSubscribe,this.wantSubscribe?this.connection.sendSubscribe(this):(this.subscribed=!1,this.connection.sendUnsubscribe(this));return}if(!this.pendingSubscribe[0].wantSubscribe){this.inflightSubscribe=this.pendingSubscribe.shift();var n=this;Po.nextTick(function(){n._handleSubscribe()})}}};function zD(n,e,t){if(e){var o=n.pop();n.push(function(r){o&&o(r),t&&t(r)})}else n.push(t)}function VD(n){return n=n.filter(Po.truthy),n.length?function(e){Po.callEach(n,e)}:null}Pe.prototype.flush=function(){!this.connection.canSend||this.inflightOp||!this.paused&&this.pendingOps.length&&this._sendOp()};function WD(n){delete n.op,delete n.create,delete n.del}function Mh(n,e){if(n.del)return WD(e);if(e.del)return new Wn(Tn.ERR_DOC_WAS_DELETED,"Document was deleted");if(e.create)return new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already created");if("op"in e){if(n.create)return new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already created");if(n.type.transformX){var t=n.type.transformX(n.op,e.op);n.op=t[0],e.op=t[1]}else{var o=n.type.transform(n.op,e.op,"left"),r=n.type.transform(e.op,n.op,"right");n.op=o,e.op=r}}}Pe.prototype._otApply=function(n,e){if("op"in n){if(!this.type)throw new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Cannot apply op to uncreated document. "+this.collection+"."+this.id);if(this.emit("before op batch",n.op,e),!e&&this.type===Lh.defaultType&&n.op.length>1){this.applyStack||(this.applyStack=[]);for(var t=this.applyStack.length,o=0;o<n.op.length;o++){var r=n.op[o],i={op:[r]};this.emit("before op",i.op,e,n.src);for(var s=t;s<this.applyStack.length;s++){var l=Mh(this.applyStack[s],i);if(l)return this._hardRollback(l)}this._setData(this.type.apply(this.data,i.op)),this.emit("op",i.op,e,n.src)}this.emit("op batch",n.op,e),this._popApplyStack(t);return}this.emit("before op",n.op,e,n.src),this._setData(this.type.apply(this.data,n.op)),this.emit("op",n.op,e,n.src),this.emit("op batch",n.op,e);return}if(n.create){this._setType(n.create.type),this.type.deserialize?this.type.createDeserialized?this._setData(this.type.createDeserialized(n.create.data)):this._setData(this.type.deserialize(this.type.create(n.create.data))):this._setData(this.type.create(n.create.data)),this.emit("create",e);return}if(n.del){var a=this.data;this._setType(null),this.emit("del",a,e);return}},Pe.prototype._sendOp=function(){if(!!this.connection.canSend){var n=this.connection.id;this.inflightOp||(this.inflightOp=this.pendingOps.shift());var e=this.inflightOp;if(!e){var t=new Wn(Tn.ERR_INFLIGHT_OP_MISSING,"No op to send on call to _sendOp");return this.emit("error",t)}if(e.sentAt=Date.now(),e.retries=e.retries==null?0:e.retries+1,e.seq==null){if(this.connection.seq>=Po.MAX_SAFE_INTEGER)return this.emit("error",new Wn(Tn.ERR_CONNECTION_SEQ_INTEGER_OVERFLOW,"Connection seq has exceeded the max safe integer, maybe from being open for too long"));e.seq=this.connection.seq++}this.connection.sendOp(this,e),e.src==null&&(e.src=n)}},Pe.prototype._submit=function(n,e,t){if(e||(e=!0),"op"in n){if(!this.type){var o=new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Cannot submit op. Document has not been created. "+this.collection+"."+this.id);return t?t(o):this.emit("error",o)}this.type.normalize&&(n.op=this.type.normalize(n.op))}try{this._pushOp(n,e,t),this._otApply(n,e)}catch(i){return this._hardRollback(i)}var r=this;Po.nextTick(function(){r.flush()})},Pe.prototype._pushOp=function(n,e,t){if(n.source=e,this.applyStack)this.applyStack.push(n);else{var o=this._tryCompose(n);if(o){o.callbacks.push(t);return}}n.type=this.type,n.callbacks=[t],this.pendingOps.push(n)},Pe.prototype._popApplyStack=function(n){if(n>0){this.applyStack.length=n;return}var e=this.applyStack[0];if(this.applyStack=null,!!e){var t=this.pendingOps.indexOf(e);if(t!==-1)for(var o=this.pendingOps.splice(t),t=0;t<o.length;t++){var e=o[t],r=this._tryCompose(e);r?r.callbacks=r.callbacks.concat(e.callbacks):this.pendingOps.push(e)}}},Pe.prototype._tryCompose=function(n){if(!this.preventCompose){var e=this.pendingOps[this.pendingOps.length-1];if(!(!e||e.sentAt)&&!(this.submitSource&&!jD(n.source,e.source))){if(e.create&&"op"in n)return e.create.data=this.type.apply(e.create.data,n.op),e;if("op"in e&&"op"in n&&this.type.compose)return e.op=this.type.compose(e.op,n.op),e}}},Pe.prototype.submitOp=function(n,e,t){typeof e=="function"&&(t=e,e=null);var o={op:n},r=e&&e.source;this._submit(o,r,t)},Pe.prototype.create=function(n,e,t,o){if(typeof e=="function"?(o=e,t=null,e=null):typeof t=="function"&&(o=t,t=null),e||(e=Lh.defaultType.uri),this.type){var r=new Wn(Tn.ERR_DOC_ALREADY_CREATED,"Document already exists");return o?o(r):this.emit("error",r)}var i={create:{type:e,data:n}},s=t&&t.source;this._submit(i,s,o)},Pe.prototype.del=function(n,e){if(typeof n=="function"&&(e=n,n=null),!this.type){var t=new Wn(Tn.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");return e?e(t):this.emit("error",t)}var o={del:!0},r=n&&n.source;this._submit(o,r,e)},Pe.prototype.pause=function(){this.paused=!0},Pe.prototype.resume=function(){this.paused=!1,this.flush()},Pe.prototype.toSnapshot=function(){return{v:this.version,data:HD(this.data),type:this.type.uri}},Pe.prototype._opAcknowledged=function(n){if(this.inflightOp.create)this.version=n.v;else if(n.v!==this.version)return $D.warn("Invalid version from server. Expected: "+this.version+" Received: "+n.v,n),this.fetch();this.version++,this._clearInflightOp()},Pe.prototype._rollback=function(n){var e=this.inflightOp;if("op"in e&&e.type.invert){try{e.op=e.type.invert(e.op)}catch{return this._hardRollback(n)}for(var t=0;t<this.pendingOps.length;t++){var o=Mh(this.pendingOps[t],e);if(o)return this._hardRollback(o)}try{this._otApply(e,!1)}catch(r){return this._hardRollback(r)}this._clearInflightOp(n);return}this._hardRollback(n)},Pe.prototype._hardRollback=function(n){var e=[];this.inflightOp&&e.push(this.inflightOp),e=e.concat(this.pendingOps),this._setType(null),this.version=null,this.inflightOp=null,this.pendingOps=[];var t=this;this.fetch(function(){for(var o=!!e.length,r=0;r<e.length;r++)o=Po.callEach(e[r].callbacks,n)&&o;if(n&&!o)return t.emit("error",n)})},Pe.prototype._clearInflightOp=function(n){var e=this.inflightOp;this.inflightOp=null;var t=Po.callEach(e.callbacks,n);if(this.flush(),this._emitNothingPending(),n&&!t)return this.emit("error",n)};var Hs={};Hs.ACTIONS={initLegacy:"init",handshake:"hs",queryFetch:"qf",querySubscribe:"qs",queryUnsubscribe:"qu",queryUpdate:"q",bulkFetch:"bf",bulkSubscribe:"bs",bulkUnsubscribe:"bu",fetch:"f",subscribe:"s",unsubscribe:"u",op:"op",snapshotFetch:"nf",snapshotFetchByTimestamp:"nt",pingPong:"pp",presence:"p",presenceSubscribe:"ps",presenceUnsubscribe:"pu",presenceRequest:"pr"};var c7=$i,a7=Hs.ACTIONS,qD=_o,GD=Dn;function Dn(n,e,t,o,r,i,s){c7.EventEmitter.call(this),this.action=n,this.connection=e,this.id=t,this.collection=o,this.query=r,this.results=null,i&&i.results&&(this.results=i.results,delete i.results),this.extra=void 0,this.options=i,this.callback=s,this.ready=!1,this.sent=!1}c7.mixin(Dn),Dn.prototype.hasPending=function(){return!this.ready},Dn.prototype.send=function(){if(!!this.connection.canSend){var n={a:this.action,id:this.id,c:this.collection,q:this.query};if(this.options&&(n.o=this.options),this.results){for(var e=[],t=0;t<this.results.length;t++){var o=this.results[t];e.push([o.id,o.version])}n.r=e}this.connection.send(n),this.sent=!0}},Dn.prototype.destroy=function(n){this.connection.canSend&&this.action===a7.querySubscribe&&this.connection.send({a:a7.queryUnsubscribe,id:this.id}),this.connection._destroyQuery(this),n&&qD.nextTick(n)},Dn.prototype._onConnectionStateChanged=function(){this.connection.canSend&&!this.sent?this.send():this.sent=!1},Dn.prototype._handleFetch=function(n,e,t){this.connection._destroyQuery(this),this._handleResponse(n,e,t)},Dn.prototype._handleSubscribe=function(n,e,t){this._handleResponse(n,e,t)},Dn.prototype._handleResponse=function(n,e,t){var o=this.callback;if(this.callback=null,n)return this._finishResponse(n,o);if(!e)return this._finishResponse(null,o);var r=this,i=1,s=function(f){if(f)return r._finishResponse(f,o);--i||r._finishResponse(null,o)};if(Array.isArray(e))i+=e.length,this.results=this._ingestSnapshots(e,s),this.extra=t;else for(var l in e){i++;var a=e[l],d=this.connection.get(a.c||this.collection,l);d.ingestSnapshot(a,s)}s()},Dn.prototype._ingestSnapshots=function(n,e){for(var t=[],o=0;o<n.length;o++){var r=n[o],i=this.connection.get(r.c||this.collection,r.d);i.ingestSnapshot(r,e),t.push(i)}return t},Dn.prototype._finishResponse=function(n,e){if(this.emit("ready"),this.ready=!0,n)return this.connection._destroyQuery(this),e?e(n):this.emit("error",n);e&&e(null,this.results,this.extra)},Dn.prototype._handleError=function(n){this.emit("error",n)},Dn.prototype._handleDiff=function(n){for(var e=0;e<n.length;e++){var t=n[e];t.type==="insert"&&(t.values=this._ingestSnapshots(t.values))}for(var e=0;e<n.length;e++){var t=n[e];switch(t.type){case"insert":var o=t.values;Array.prototype.splice.apply(this.results,[t.index,0].concat(o)),this.emit("insert",o,t.index);break;case"remove":var i=t.howMany||1,r=this.results.splice(t.index,i);this.emit("remove",r,t.index);break;case"move":var i=t.howMany||1,s=this.results.splice(t.from,i);Array.prototype.splice.apply(this.results,[t.to,0].concat(s)),this.emit("move",s,t.from,t.to);break}}this.emit("changed",this.results)},Dn.prototype._handleExtra=function(n){this.extra=n,this.emit("extra",n)};var u7=$i,ZD=Hs.ACTIONS,QD=_o,d7=ar;function ar(n,e){if(u7.EventEmitter.call(this),!e||typeof e!="string")throw new Error("LocalPresence presenceId must be a string");this.presence=n,this.presenceId=e,this.connection=n.connection,this.presenceVersion=0,this.value=null,this._pendingMessages=[],this._callbacksByPresenceVersion={}}u7.mixin(ar),ar.prototype.submit=function(n,e){this.value=n,this.send(e)},ar.prototype.send=function(n){var e=this._message();this._pendingMessages.push(e),this._callbacksByPresenceVersion[e.pv]=n,this._sendPending()},ar.prototype.destroy=function(n){var e=this;this.submit(null,function(t){if(t)return e._callbackOrEmit(t,n);delete e.presence.localPresences[e.presenceId],n&&n()})},ar.prototype._sendPending=function(){if(!!this.connection.canSend){var n=this;this._pendingMessages.forEach(function(e){n.connection.send(e)}),this._pendingMessages=[]}},ar.prototype._ack=function(n,e){var t=this._getCallback(e);this._callbackOrEmit(n,t)},ar.prototype._message=function(){return{a:ZD.presence,ch:this.presence.channel,id:this.presenceId,p:this.value,pv:this.presenceVersion++}},ar.prototype._getCallback=function(n){var e=this._callbacksByPresenceVersion[n];return delete this._callbacksByPresenceVersion[n],e},ar.prototype._callbackOrEmit=function(n,e){if(e)return QD.nextTick(e,n);n&&this.emit("error",n)};var YD=_o,h7=Yg;function Yg(n,e){this.presence=n,this.presenceId=e,this.connection=this.presence.connection,this.value=null,this.presenceVersion=0}Yg.prototype.receiveUpdate=function(n){n.pv<this.presenceVersion||(this.value=n.p,this.presenceVersion=n.pv,this.presence._updateRemotePresence(this))},Yg.prototype.destroy=function(n){delete this.presence._remotePresenceInstances[this.presenceId],delete this.presence.remotePresences[this.presenceId],n&&YD.nextTick(n)};var Jg={exports:{}};(function(n,e){(function(t,o){o(e)})(cr,function(t){function o(k,T){T=T|0;for(var L=Math.max(k.length-T,0),P=Array(L),j=0;j<L;j++)P[j]=k[T+j];return P}var r=function(k){var T=o(arguments,1);return function(){var L=o(arguments);return k.apply(null,T.concat(L))}},i=function(k){return function(){var T=o(arguments),L=T.pop();k.call(this,T,L)}};function s(k){var T=typeof k;return k!=null&&(T=="object"||T=="function")}var l=typeof setImmediate=="function"&&setImmediate,a=typeof process=="object"&&typeof process.nextTick=="function";function d(k){setTimeout(k,0)}function f(k){return function(T){var L=o(arguments,1);k(function(){T.apply(null,L)})}}var p;l?p=setImmediate:a?p=process.nextTick:p=d;var A=f(p);function v(k){return i(function(T,L){var P;try{P=k.apply(this,T)}catch(j){return L(j)}s(P)&&typeof P.then=="function"?P.then(function(j){B(L,null,j)},function(j){B(L,j.message?j:new Error(j))}):L(null,P)})}function B(k,T,L){try{k(T,L)}catch(P){A(D,P)}}function D(k){throw k}var I=typeof Symbol=="function";function _(k){return I&&k[Symbol.toStringTag]==="AsyncFunction"}function R(k){return _(k)?v(k):k}function U(k){return function(T){var L=o(arguments,1),P=i(function(j,H){var Z=this;return k(T,function(J,le){R(J).apply(Z,j.concat(le))},H)});return L.length?P.apply(this,L):P}}var z=typeof cr=="object"&&cr&&cr.Object===Object&&cr,q=typeof self=="object"&&self&&self.Object===Object&&self,oe=z||q||Function("return this")(),me=oe.Symbol,Be=Object.prototype,je=Be.hasOwnProperty,Ue=Be.toString,tt=me?me.toStringTag:void 0;function Yt(k){var T=je.call(k,tt),L=k[tt];try{k[tt]=void 0;var P=!0}catch{}var j=Ue.call(k);return P&&(T?k[tt]=L:delete k[tt]),j}var Wo=Object.prototype,Ft=Wo.toString;function Ln(k){return Ft.call(k)}var br="[object Null]",bn="[object Undefined]",an=me?me.toStringTag:void 0;function vr(k){return k==null?k===void 0?bn:br:an&&an in Object(k)?Yt(k):Ln(k)}var ti="[object AsyncFunction]",ho="[object Function]",z2="[object GeneratorFunction]",V2="[object Proxy]";function W2(k){if(!s(k))return!1;var T=vr(k);return T==ho||T==z2||T==ti||T==V2}var ts=9007199254740991;function tl(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=ts}function nl(k){return k!=null&&tl(k.length)&&!W2(k)}var ni={};function Ne(){}function yr(k){return function(){if(k!==null){var T=k;k=null,T.apply(this,arguments)}}}var ns=typeof Symbol=="function"&&Symbol.iterator,Oc=function(k){return ns&&k[ns]&&k[ns]()};function Gf(k,T){for(var L=-1,P=Array(k);++L<k;)P[L]=T(L);return P}function un(k){return k!=null&&typeof k=="object"}var ol="[object Arguments]";function Zf(k){return un(k)&&vr(k)==ol}var fo=Object.prototype,Qf=fo.hasOwnProperty,q2=fo.propertyIsEnumerable,rl=Zf(function(){return arguments}())?Zf:function(k){return un(k)&&Qf.call(k,"callee")&&!q2.call(k,"callee")},pt=Array.isArray;function il(){return!1}var sl=typeof t=="object"&&t&&!t.nodeType&&t,Yf=sl&&!0&&n&&!n.nodeType&&n,ll=Yf&&Yf.exports===sl,Jf=ll?oe.Buffer:void 0,cl=Jf?Jf.isBuffer:void 0,os=cl||il,Pu=9007199254740991,Fu=/^(?:0|[1-9]\d*)$/;function Nu(k,T){var L=typeof k;return T=T==null?Pu:T,!!T&&(L=="number"||L!="symbol"&&Fu.test(k))&&k>-1&&k%1==0&&k<T}var $u="[object Arguments]",Hu="[object Array]",ju="[object Boolean]",Uu="[object Date]",zu="[object Error]",Vu="[object Function]",G2="[object Map]",Z2="[object Number]",Q2="[object Object]",Kf="[object RegExp]",Xf="[object Set]",Y2="[object String]",J2="[object WeakMap]",K2="[object ArrayBuffer]",X2="[object DataView]",e1="[object Float32Array]",e5="[object Float64Array]",t5="[object Int8Array]",n5="[object Int16Array]",Wu="[object Int32Array]",o5="[object Uint8Array]",qu="[object Uint8ClampedArray]",r5="[object Uint16Array]",i5="[object Uint32Array]",it={};it[e1]=it[e5]=it[t5]=it[n5]=it[Wu]=it[o5]=it[qu]=it[r5]=it[i5]=!0,it[$u]=it[Hu]=it[K2]=it[ju]=it[X2]=it[Uu]=it[zu]=it[Vu]=it[G2]=it[Z2]=it[Q2]=it[Kf]=it[Xf]=it[Y2]=it[J2]=!1;function s5(k){return un(k)&&tl(k.length)&&!!it[vr(k)]}function l5(k){return function(T){return k(T)}}var t1=typeof t=="object"&&t&&!t.nodeType&&t,al=t1&&!0&&n&&!n.nodeType&&n,c5=al&&al.exports===t1,_c=c5&&z.process,n1=function(){try{var k=al&&al.require&&al.require("util").types;return k||_c&&_c.binding&&_c.binding("util")}catch{}}(),o1=n1&&n1.isTypedArray,a5=o1?l5(o1):s5,u5=Object.prototype,d5=u5.hasOwnProperty;function h5(k,T){var L=pt(k),P=!L&&rl(k),j=!L&&!P&&os(k),H=!L&&!P&&!j&&a5(k),Z=L||P||j||H,J=Z?Gf(k.length,String):[],le=J.length;for(var pe in k)(T||d5.call(k,pe))&&!(Z&&(pe=="length"||j&&(pe=="offset"||pe=="parent")||H&&(pe=="buffer"||pe=="byteLength"||pe=="byteOffset")||Nu(pe,le)))&&J.push(pe);return J}var Pc=Object.prototype;function f5(k){var T=k&&k.constructor,L=typeof T=="function"&&T.prototype||Pc;return k===L}function Fc(k,T){return function(L){return k(T(L))}}var m5=Fc(Object.keys,Object),g5=Object.prototype,p5=g5.hasOwnProperty;function r1(k){if(!f5(k))return m5(k);var T=[];for(var L in Object(k))p5.call(k,L)&&L!="constructor"&&T.push(L);return T}function Nc(k){return nl(k)?h5(k):r1(k)}function i1(k){var T=-1,L=k.length;return function(){return++T<L?{value:k[T],key:T}:null}}function C5(k){var T=-1;return function(){var P=k.next();return P.done?null:(T++,{value:P.value,key:T})}}function A5(k){var T=Nc(k),L=-1,P=T.length;return function j(){var H=T[++L];return H==="__proto__"?j():L<P?{value:k[H],key:H}:null}}function b5(k){if(nl(k))return i1(k);var T=Oc(k);return T?C5(T):A5(k)}function mo(k){return function(){if(k===null)throw new Error("Callback was already called.");var T=k;k=null,T.apply(this,arguments)}}function ul(k){return function(T,L,P){if(P=yr(P||Ne),k<=0||!T)return P(null);var j=b5(T),H=!1,Z=0,J=!1;function le(ce,Ae){if(Z-=1,ce)H=!0,P(ce);else{if(Ae===ni||H&&Z<=0)return H=!0,P(null);J||pe()}}function pe(){for(J=!0;Z<k&&!H;){var ce=j();if(ce===null){H=!0,Z<=0&&P(null);return}Z+=1,L(ce.value,ce.key,mo(le))}J=!1}pe()}}function kr(k,T,L,P){ul(T)(k,R(L),P)}function Nt(k,T){return function(L,P,j){return k(L,T,P,j)}}function Gu(k,T,L){L=yr(L||Ne);var P=0,j=0,H=k.length;H===0&&L(null);function Z(J,le){J?L(J):(++j===H||le===ni)&&L(null)}for(;P<H;P++)T(k[P],P,mo(Z))}var v5=Nt(kr,1/0),qo=function(k,T,L){var P=nl(k)?Gu:v5;P(k,R(T),L)};function Go(k){return function(T,L,P){return k(qo,T,R(L),P)}}function Zu(k,T,L,P){P=P||Ne,T=T||[];var j=[],H=0,Z=R(L);k(T,function(J,le,pe){var ce=H++;Z(J,function(Ae,Ge){j[ce]=Ge,pe(Ae)})},function(J){P(J,j)})}var $c=Go(Zu),Qu=U($c);function oi(k){return function(T,L,P,j){return k(ul(L),T,R(P),j)}}var wr=oi(Zu),Yu=Nt(wr,1),Ju=U(Yu);function rs(k,T){for(var L=-1,P=k==null?0:k.length;++L<P&&T(k[L],L,k)!==!1;);return k}function Ku(k){return function(T,L,P){for(var j=-1,H=Object(T),Z=P(T),J=Z.length;J--;){var le=Z[k?J:++j];if(L(H[le],le,H)===!1)break}return T}}var is=Ku();function ss(k,T){return k&&is(k,T,Nc)}function s1(k,T,L,P){for(var j=k.length,H=L+(P?1:-1);P?H--:++H<j;)if(T(k[H],H,k))return H;return-1}function y5(k){return k!==k}function l1(k,T,L){for(var P=L-1,j=k.length;++P<j;)if(k[P]===T)return P;return-1}function dl(k,T,L){return T===T?l1(k,T,L):s1(k,y5,L)}var Hc=function(k,T,L){typeof T=="function"&&(L=T,T=null),L=yr(L||Ne);var P=Nc(k),j=P.length;if(!j)return L(null);T||(T=j);var H={},Z=0,J=!1,le=Object.create(null),pe=[],ce=[],Ae={};ss(k,function(ut,ot){if(!pt(ut)){Ge(ot,[ut]),ce.push(ot);return}var mt=ut.slice(0,ut.length-1),po=mt.length;if(po===0){Ge(ot,ut),ce.push(ot);return}Ae[ot]=po,rs(mt,function(E){if(!k[E])throw new Error("async.auto task `"+ot+"` has a non-existent dependency `"+E+"` in "+mt.join(", "));tn(E,function(){po--,po===0&&Ge(ot,ut)})})}),z5(),xt();function Ge(ut,ot){pe.push(function(){go(ut,ot)})}function xt(){if(pe.length===0&&Z===0)return L(null,H);for(;pe.length&&Z<T;){var ut=pe.shift();ut()}}function tn(ut,ot){var mt=le[ut];mt||(mt=le[ut]=[]),mt.push(ot)}function On(ut){var ot=le[ut]||[];rs(ot,function(mt){mt()}),xt()}function go(ut,ot){if(!J){var mt=mo(function(E,xr){if(Z--,arguments.length>2&&(xr=o(arguments,1)),E){var us={};ss(H,function(_n,Fe){us[Fe]=_n}),us[ut]=xr,J=!0,le=Object.create(null),L(E,us)}else H[ut]=xr,On(ut)});Z++;var po=R(ot[ot.length-1]);ot.length>1?po(H,mt):po(mt)}}function z5(){for(var ut,ot=0;ce.length;)ut=ce.pop(),ot++,rs(V5(ut),function(mt){--Ae[mt]===0&&ce.push(mt)});if(ot!==j)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function V5(ut){var ot=[];return ss(k,function(mt,po){pt(mt)&&dl(mt,ut,0)>=0&&ot.push(po)}),ot}};function ri(k,T){for(var L=-1,P=k==null?0:k.length,j=Array(P);++L<P;)j[L]=T(k[L],L,k);return j}var k5="[object Symbol]";function w5(k){return typeof k=="symbol"||un(k)&&vr(k)==k5}var B5=1/0,Xu=me?me.prototype:void 0,c1=Xu?Xu.toString:void 0;function ed(k){if(typeof k=="string")return k;if(pt(k))return ri(k,ed)+"";if(w5(k))return c1?c1.call(k):"";var T=k+"";return T=="0"&&1/k==-B5?"-0":T}function E5(k,T,L){var P=-1,j=k.length;T<0&&(T=-T>j?0:j+T),L=L>j?j:L,L<0&&(L+=j),j=T>L?0:L-T>>>0,T>>>=0;for(var H=Array(j);++P<j;)H[P]=k[P+T];return H}function x5(k,T,L){var P=k.length;return L=L===void 0?P:L,!T&&L>=P?k:E5(k,T,L)}function td(k,T){for(var L=k.length;L--&&dl(T,k[L],0)>-1;);return L}function I5(k,T){for(var L=-1,P=k.length;++L<P&&dl(T,k[L],0)>-1;);return L}function T5(k){return k.split("")}var D5="\\ud800-\\udfff",S5="\\u0300-\\u036f",L5="\\ufe20-\\ufe2f",st="\\u20d0-\\u20ff",nt=S5+L5+st,M5="\\ufe0e\\ufe0f",R5="\\u200d",O5=RegExp("["+R5+D5+nt+M5+"]");function _5(k){return O5.test(k)}var a1="\\ud800-\\udfff",P5="\\u0300-\\u036f",u1="\\ufe20-\\ufe2f",F5="\\u20d0-\\u20ff",Wt=P5+u1+F5,nd="\\ufe0e\\ufe0f",ii="["+a1+"]",jc="["+Wt+"]",hl="\\ud83c[\\udffb-\\udfff]",Mn="(?:"+jc+"|"+hl+")",od="[^"+a1+"]",rd="(?:\\ud83c[\\udde6-\\uddff]){2}",id="[\\ud800-\\udbff][\\udc00-\\udfff]",d1="\\u200d",sd=Mn+"?",ld="["+nd+"]?",vn="(?:"+d1+"(?:"+[od,rd,id].join("|")+")"+ld+sd+")*",N5=ld+sd+vn,Rn="(?:"+[od+jc+"?",jc,rd,id,ii].join("|")+")",$5=RegExp(hl+"(?="+hl+")|"+Rn+N5,"g");function h1(k){return k.match($5)||[]}function Zo(k){return _5(k)?h1(k):T5(k)}function Uc(k){return k==null?"":ed(k)}var cd=/^\s+|\s+$/g;function at(k,T,L){if(k=Uc(k),k&&(L||T===void 0))return k.replace(cd,"");if(!k||!(T=ed(T)))return k;var P=Zo(k),j=Zo(T),H=I5(P,j),Z=td(P,j)+1;return x5(P,H,Z).join("")}var Br=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ad=/,/,H5=/(=.+)?(\s*)$/,ud=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;function j5(k){return k=k.toString().replace(ud,""),k=k.match(Br)[2].replace(" ",""),k=k?k.split(ad):[],k=k.map(function(T){return at(T.replace(H5,""))}),k}function f1(k,T){var L={};ss(k,function(P,j){var H,Z=_(P),J=!Z&&P.length===1||Z&&P.length===0;if(pt(P))H=P.slice(0,-1),P=P[P.length-1],L[j]=H.concat(H.length>0?le:P);else if(J)L[j]=P;else{if(H=j5(P),P.length===0&&!Z&&H.length===0)throw new Error("autoInject task functions require explicit parameters.");Z||H.pop(),L[j]=H.concat(le)}function le(pe,ce){var Ae=ri(H,function(Ge){return pe[Ge]});Ae.push(ce),R(P).apply(null,Ae)}}),Hc(L,T)}function Qn(){this.head=this.tail=null,this.length=0}function dd(k,T){k.length=1,k.head=k.tail=T}Qn.prototype.removeLink=function(k){return k.prev?k.prev.next=k.next:this.head=k.next,k.next?k.next.prev=k.prev:this.tail=k.prev,k.prev=k.next=null,this.length-=1,k},Qn.prototype.empty=function(){for(;this.head;)this.shift();return this},Qn.prototype.insertAfter=function(k,T){T.prev=k,T.next=k.next,k.next?k.next.prev=T:this.tail=T,k.next=T,this.length+=1},Qn.prototype.insertBefore=function(k,T){T.prev=k.prev,T.next=k,k.prev?k.prev.next=T:this.head=T,k.prev=T,this.length+=1},Qn.prototype.unshift=function(k){this.head?this.insertBefore(this.head,k):dd(this,k)},Qn.prototype.push=function(k){this.tail?this.insertAfter(this.tail,k):dd(this,k)},Qn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},Qn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},Qn.prototype.toArray=function(){for(var k=Array(this.length),T=this.head,L=0;L<this.length;L++)k[L]=T.data,T=T.next;return k},Qn.prototype.remove=function(k){for(var T=this.head;T;){var L=T.next;k(T)&&this.removeLink(T),T=L}return this};function fl(k,T,L){if(T==null)T=1;else if(T===0)throw new Error("Concurrency must not be zero");var P=R(k),j=0,H=[],Z=!1;function J(Ae,Ge,xt){if(xt!=null&&typeof xt!="function")throw new Error("task callback must be a function");if(ce.started=!0,pt(Ae)||(Ae=[Ae]),Ae.length===0&&ce.idle())return A(function(){ce.drain()});for(var tn=0,On=Ae.length;tn<On;tn++){var go={data:Ae[tn],callback:xt||Ne};Ge?ce._tasks.unshift(go):ce._tasks.push(go)}Z||(Z=!0,A(function(){Z=!1,ce.process()}))}function le(Ae){return function(Ge){j-=1;for(var xt=0,tn=Ae.length;xt<tn;xt++){var On=Ae[xt],go=dl(H,On,0);go===0?H.shift():go>0&&H.splice(go,1),On.callback.apply(On,arguments),Ge!=null&&ce.error(Ge,On.data)}j<=ce.concurrency-ce.buffer&&ce.unsaturated(),ce.idle()&&ce.drain(),ce.process()}}var pe=!1,ce={_tasks:new Qn,concurrency:T,payload:L,saturated:Ne,unsaturated:Ne,buffer:T/4,empty:Ne,drain:Ne,error:Ne,started:!1,paused:!1,push:function(Ae,Ge){J(Ae,!1,Ge)},kill:function(){ce.drain=Ne,ce._tasks.empty()},unshift:function(Ae,Ge){J(Ae,!0,Ge)},remove:function(Ae){ce._tasks.remove(Ae)},process:function(){if(!pe){for(pe=!0;!ce.paused&&j<ce.concurrency&&ce._tasks.length;){var Ae=[],Ge=[],xt=ce._tasks.length;ce.payload&&(xt=Math.min(xt,ce.payload));for(var tn=0;tn<xt;tn++){var On=ce._tasks.shift();Ae.push(On),H.push(On),Ge.push(On.data)}j+=1,ce._tasks.length===0&&ce.empty(),j===ce.concurrency&&ce.saturated();var go=mo(le(Ae));P(Ge,go)}pe=!1}},length:function(){return ce._tasks.length},running:function(){return j},workersList:function(){return H},idle:function(){return ce._tasks.length+j===0},pause:function(){ce.paused=!0},resume:function(){ce.paused!==!1&&(ce.paused=!1,A(ce.process))}};return ce}function si(k,T){return fl(k,1,T)}var ls=Nt(kr,1);function Qo(k,T,L,P){P=yr(P||Ne);var j=R(L);ls(k,function(H,Z,J){j(T,H,function(le,pe){T=pe,J(le)})},function(H){P(H,T)})}function zc(){var k=ri(arguments,R);return function(){var T=o(arguments),L=this,P=T[T.length-1];typeof P=="function"?T.pop():P=Ne,Qo(k,T,function(j,H,Z){H.apply(L,j.concat(function(J){var le=o(arguments,1);Z(J,le)}))},function(j,H){P.apply(L,[j].concat(H))})}}var Vc=function(){return zc.apply(null,o(arguments).reverse())},hd=Array.prototype.concat,ml=function(k,T,L,P){P=P||Ne;var j=R(L);wr(k,T,function(H,Z){j(H,function(J){return J?Z(J):Z(null,o(arguments,1))})},function(H,Z){for(var J=[],le=0;le<Z.length;le++)Z[le]&&(J=hd.apply(J,Z[le]));return P(H,J)})},m1=Nt(ml,1/0),Wc=Nt(ml,1),qc=function(){var k=o(arguments),T=[null].concat(k);return function(){var L=arguments[arguments.length-1];return L.apply(this,T)}};function gl(k){return k}function li(k,T){return function(L,P,j,H){H=H||Ne;var Z=!1,J;L(P,function(le,pe,ce){j(le,function(Ae,Ge){Ae?ce(Ae):k(Ge)&&!J?(Z=!0,J=T(!0,le),ce(null,ni)):ce()})},function(le){le?H(le):H(null,Z?J:T(!1))})}}function dn(k,T){return T}var cs=Go(li(gl,dn)),Yo=oi(li(gl,dn)),pl=Nt(Yo,1);function fd(k){return function(T){var L=o(arguments,1);L.push(function(P){var j=o(arguments,1);typeof console=="object"&&(P?console.error&&console.error(P):console[k]&&rs(j,function(H){console[k](H)}))}),R(T).apply(null,L)}}var g1=fd("dir");function p1(k,T,L){L=mo(L||Ne);var P=R(k),j=R(T);function H(J){if(J)return L(J);var le=o(arguments,1);le.push(Z),j.apply(this,le)}function Z(J,le){if(J)return L(J);if(!le)return L(null);P(H)}Z(null,!0)}function md(k,T,L){L=mo(L||Ne);var P=R(k),j=function(H){if(H)return L(H);var Z=o(arguments,1);if(T.apply(this,Z))return P(j);L.apply(null,[null].concat(Z))};P(j)}function C1(k,T,L){md(k,function(){return!T.apply(this,arguments)},L)}function A1(k,T,L){L=mo(L||Ne);var P=R(T),j=R(k);function H(J){if(J)return L(J);j(Z)}function Z(J,le){if(J)return L(J);if(!le)return L(null);P(H)}j(Z)}function ci(k){return function(T,L,P){return k(T,P)}}function Gc(k,T,L){qo(k,ci(R(T)),L)}function Cl(k,T,L,P){ul(T)(k,ci(R(L)),P)}var ai=Nt(Cl,1);function Zc(k){return _(k)?k:i(function(T,L){var P=!0;T.push(function(){var j=arguments;P?A(function(){L.apply(null,j)}):L.apply(null,j)}),k.apply(this,T),P=!1})}function Yn(k){return!k}var ui=Go(li(Yn,Yn)),Al=oi(li(Yn,Yn)),Qc=Nt(Al,1);function b1(k){return function(T){return T==null?void 0:T[k]}}function as(k,T,L,P){var j=new Array(T.length);k(T,function(H,Z,J){L(H,function(le,pe){j[Z]=!!pe,J(le)})},function(H){if(H)return P(H);for(var Z=[],J=0;J<T.length;J++)j[J]&&Z.push(T[J]);P(null,Z)})}function Jn(k,T,L,P){var j=[];k(T,function(H,Z,J){L(H,function(le,pe){le?J(le):(pe&&j.push({index:Z,value:H}),J())})},function(H){H?P(H):P(null,ri(j.sort(function(Z,J){return Z.index-J.index}),b1("value")))})}function Yc(k,T,L,P){var j=nl(T)?as:Jn;j(k,T,R(L),P||Ne)}var Jc=Go(Yc),bl=oi(Yc),Kc=Nt(bl,1);function v1(k,T){var L=mo(T||Ne),P=R(Zc(k));function j(H){if(H)return L(H);P(j)}j()}var Xc=function(k,T,L,P){P=P||Ne;var j=R(L);wr(k,T,function(H,Z){j(H,function(J,le){return J?Z(J):Z(null,{key:le,val:H})})},function(H,Z){for(var J={},le=Object.prototype.hasOwnProperty,pe=0;pe<Z.length;pe++)if(Z[pe]){var ce=Z[pe].key,Ae=Z[pe].val;le.call(J,ce)?J[ce].push(Ae):J[ce]=[Ae]}return P(H,J)})},di=Nt(Xc,1/0),N=Nt(Xc,1),G=fd("log");function V(k,T,L,P){P=yr(P||Ne);var j={},H=R(L);kr(k,T,function(Z,J,le){H(Z,J,function(pe,ce){if(pe)return le(pe);j[J]=ce,le()})},function(Z){P(Z,j)})}var he=Nt(V,1/0),Ee=Nt(V,1);function Ve(k,T){return T in k}function yt(k,T){var L=Object.create(null),P=Object.create(null);T=T||gl;var j=R(k),H=i(function(J,le){var pe=T.apply(null,J);Ve(L,pe)?A(function(){le.apply(null,L[pe])}):Ve(P,pe)?P[pe].push(le):(P[pe]=[le],j.apply(null,J.concat(function(){var ce=o(arguments);L[pe]=ce;var Ae=P[pe];delete P[pe];for(var Ge=0,xt=Ae.length;Ge<xt;Ge++)Ae[Ge].apply(null,ce)})))});return H.memo=L,H.unmemoized=k,H}var qe;a?qe=process.nextTick:l?qe=setImmediate:qe=d;var ea=f(qe);function gd(k,T,L){L=L||Ne;var P=nl(T)?[]:{};k(T,function(j,H,Z){R(j)(function(J,le){arguments.length>2&&(le=o(arguments,1)),P[H]=le,Z(J)})},function(j){L(j,P)})}function yn(k,T){gd(qo,k,T)}function vl(k,T,L){gd(ul(T),k,L)}var pd=function(k,T){var L=R(k);return fl(function(P,j){L(P[0],j)},T,1)},hi=function(k,T){var L=pd(k,T);return L.push=function(P,j,H){if(H==null&&(H=Ne),typeof H!="function")throw new Error("task callback must be a function");if(L.started=!0,pt(P)||(P=[P]),P.length===0)return A(function(){L.drain()});j=j||0;for(var Z=L._tasks.head;Z&&j>=Z.priority;)Z=Z.next;for(var J=0,le=P.length;J<le;J++){var pe={data:P[J],priority:j,callback:H};Z?L._tasks.insertBefore(Z,pe):L._tasks.push(pe)}A(L.process)},delete L.unshift,L};function yl(k,T){if(T=yr(T||Ne),!pt(k))return T(new TypeError("First argument to race must be an array of functions"));if(!k.length)return T();for(var L=0,P=k.length;L<P;L++)R(k[L])(T)}function fi(k,T,L,P){var j=o(k).reverse();Qo(j,T,L,P)}function We(k){var T=R(k);return i(function(P,j){return P.push(function(Z,J){if(Z)j(null,{error:Z});else{var le;arguments.length<=2?le=J:le=o(arguments,1),j(null,{value:le})}}),T.apply(this,P)})}function y1(k){var T;return pt(k)?T=ri(k,We):(T={},ss(k,function(L,P){T[P]=We.call(this,L)})),T}function Cd(k,T,L,P){Yc(k,T,function(j,H){L(j,function(Z,J){H(Z,!J)})},P)}var kl=Go(Cd),Ad=oi(Cd),k1=Nt(Ad,1);function w1(k){return function(){return k}}function mi(k,T,L){var P=5,j=0,H={times:P,intervalFunc:w1(j)};function Z(ce,Ae){if(typeof Ae=="object")ce.times=+Ae.times||P,ce.intervalFunc=typeof Ae.interval=="function"?Ae.interval:w1(+Ae.interval||j),ce.errorFilter=Ae.errorFilter;else if(typeof Ae=="number"||typeof Ae=="string")ce.times=+Ae||P;else throw new Error("Invalid arguments for async.retry")}if(arguments.length<3&&typeof k=="function"?(L=T||Ne,T=k):(Z(H,k),L=L||Ne),typeof T!="function")throw new Error("Invalid arguments for async.retry");var J=R(T),le=1;function pe(){J(function(ce){ce&&le++<H.times&&(typeof H.errorFilter!="function"||H.errorFilter(ce))?setTimeout(pe,H.intervalFunc(le)):L.apply(null,arguments)})}pe()}var Jo=function(k,T){T||(T=k,k=null);var L=R(T);return i(function(P,j){function H(Z){L.apply(null,P.concat(Z))}k?mi(k,H,j):mi(H,j)})};function wl(k,T){gd(ls,k,T)}var Bl=Go(li(Boolean,gl)),Er=oi(li(Boolean,gl)),El=Nt(Er,1);function bd(k,T,L){var P=R(T);$c(k,function(H,Z){P(H,function(J,le){if(J)return Z(J);Z(null,{value:H,criteria:le})})},function(H,Z){if(H)return L(H);L(null,ri(Z.sort(j),b1("value")))});function j(H,Z){var J=H.criteria,le=Z.criteria;return J<le?-1:J>le?1:0}}function xl(k,T,L){var P=R(k);return i(function(j,H){var Z=!1,J;function le(){var pe=k.name||"anonymous",ce=new Error('Callback function "'+pe+'" timed out.');ce.code="ETIMEDOUT",L&&(ce.info=L),Z=!0,H(ce)}j.push(function(){Z||(H.apply(null,arguments),clearTimeout(J))}),J=setTimeout(le,T),P.apply(null,j)})}var B1=Math.ceil,Il=Math.max;function gi(k,T,L,P){for(var j=-1,H=Il(B1((T-k)/(L||1)),0),Z=Array(H);H--;)Z[P?H:++j]=k,k+=L;return Z}function pi(k,T,L,P){var j=R(L);wr(gi(0,k,1),T,j,P)}var E1=Nt(pi,1/0),x1=Nt(pi,1);function I1(k,T,L,P){arguments.length<=3&&(P=L,L=T,T=pt(k)?[]:{}),P=yr(P||Ne);var j=R(L);qo(k,function(H,Z,J){j(T,H,Z,J)},function(H){P(H,T)})}function Tl(k,T){var L=null,P;T=T||Ne,ai(k,function(j,H){R(j)(function(Z,J){arguments.length>2?P=o(arguments,1):P=J,L=Z,H(!Z)})},function(){T(L,P)})}function Dl(k){return function(){return(k.unmemoized||k).apply(null,arguments)}}function Sl(k,T,L){L=mo(L||Ne);var P=R(T);if(!k())return L(null);var j=function(H){if(H)return L(H);if(k())return P(j);var Z=o(arguments,1);L.apply(null,[null].concat(Z))};P(j)}function T1(k,T,L){Sl(function(){return!k.apply(this,arguments)},T,L)}var vd=function(k,T){if(T=yr(T||Ne),!pt(k))return T(new Error("First argument to waterfall must be an array of functions"));if(!k.length)return T();var L=0;function P(H){var Z=R(k[L++]);H.push(mo(j)),Z.apply(null,H)}function j(H){if(H||L===k.length)return T.apply(null,arguments);P(o(arguments,1))}P([])},U5={apply:r,applyEach:Qu,applyEachSeries:Ju,asyncify:v,auto:Hc,autoInject:f1,cargo:si,compose:Vc,concat:m1,concatLimit:ml,concatSeries:Wc,constant:qc,detect:cs,detectLimit:Yo,detectSeries:pl,dir:g1,doDuring:p1,doUntil:C1,doWhilst:md,during:A1,each:Gc,eachLimit:Cl,eachOf:qo,eachOfLimit:kr,eachOfSeries:ls,eachSeries:ai,ensureAsync:Zc,every:ui,everyLimit:Al,everySeries:Qc,filter:Jc,filterLimit:bl,filterSeries:Kc,forever:v1,groupBy:di,groupByLimit:Xc,groupBySeries:N,log:G,map:$c,mapLimit:wr,mapSeries:Yu,mapValues:he,mapValuesLimit:V,mapValuesSeries:Ee,memoize:yt,nextTick:ea,parallel:yn,parallelLimit:vl,priorityQueue:hi,queue:pd,race:yl,reduce:Qo,reduceRight:fi,reflect:We,reflectAll:y1,reject:kl,rejectLimit:Ad,rejectSeries:k1,retry:mi,retryable:Jo,seq:zc,series:wl,setImmediate:A,some:Bl,someLimit:Er,someSeries:El,sortBy:bd,timeout:xl,times:E1,timesLimit:pi,timesSeries:x1,transform:I1,tryEach:Tl,unmemoize:Dl,until:T1,waterfall:vd,whilst:Sl,all:ui,allLimit:Al,allSeries:Qc,any:Bl,anyLimit:Er,anySeries:El,find:cs,findLimit:Yo,findSeries:pl,forEach:Gc,forEachSeries:ai,forEachLimit:Cl,forEachOf:qo,forEachOfSeries:ls,forEachOfLimit:kr,inject:Qo,foldl:Qo,foldr:fi,select:Jc,selectLimit:bl,selectSeries:Kc,wrapSync:v};t.default=U5,t.apply=r,t.applyEach=Qu,t.applyEachSeries=Ju,t.asyncify=v,t.auto=Hc,t.autoInject=f1,t.cargo=si,t.compose=Vc,t.concat=m1,t.concatLimit=ml,t.concatSeries=Wc,t.constant=qc,t.detect=cs,t.detectLimit=Yo,t.detectSeries=pl,t.dir=g1,t.doDuring=p1,t.doUntil=C1,t.doWhilst=md,t.during=A1,t.each=Gc,t.eachLimit=Cl,t.eachOf=qo,t.eachOfLimit=kr,t.eachOfSeries=ls,t.eachSeries=ai,t.ensureAsync=Zc,t.every=ui,t.everyLimit=Al,t.everySeries=Qc,t.filter=Jc,t.filterLimit=bl,t.filterSeries=Kc,t.forever=v1,t.groupBy=di,t.groupByLimit=Xc,t.groupBySeries=N,t.log=G,t.map=$c,t.mapLimit=wr,t.mapSeries=Yu,t.mapValues=he,t.mapValuesLimit=V,t.mapValuesSeries=Ee,t.memoize=yt,t.nextTick=ea,t.parallel=yn,t.parallelLimit=vl,t.priorityQueue=hi,t.queue=pd,t.race=yl,t.reduce=Qo,t.reduceRight=fi,t.reflect=We,t.reflectAll=y1,t.reject=kl,t.rejectLimit=Ad,t.rejectSeries=k1,t.retry=mi,t.retryable=Jo,t.seq=zc,t.series=wl,t.setImmediate=A,t.some=Bl,t.someLimit=Er,t.someSeries=El,t.sortBy=bd,t.timeout=xl,t.times=E1,t.timesLimit=pi,t.timesSeries=x1,t.transform=I1,t.tryEach=Tl,t.unmemoize=Dl,t.until=T1,t.waterfall=vd,t.whilst=Sl,t.all=ui,t.allLimit=Al,t.allSeries=Qc,t.any=Bl,t.anyLimit=Er,t.anySeries=El,t.find=cs,t.findLimit=Yo,t.findSeries=pl,t.forEach=Gc,t.forEachSeries=ai,t.forEachLimit=Cl,t.forEachOf=qo,t.forEachOfSeries=ls,t.forEachOfLimit=kr,t.inject=Qo,t.foldl=Qo,t.foldr=fi,t.select=Jc,t.selectLimit=bl,t.selectSeries=Kc,t.wrapSync=v,Object.defineProperty(t,"__esModule",{value:!0})})})(Jg,Jg.exports);var f7={exports:{}},Kg=f7.exports=function(n,e){if(e||(e=16),n===void 0&&(n=128),n<=0)return"0";for(var t=Math.log(Math.pow(2,n))/Math.log(e),o=2;t===1/0;o*=2)t=Math.log(Math.pow(2,n/o))/Math.log(e)*o;for(var r=t-Math.floor(t),i="",o=0;o<Math.floor(t);o++){var s=Math.floor(Math.random()*e).toString(e);i=s+i}if(r){var l=Math.pow(e,r),s=Math.floor(Math.random()*l).toString(e);i=s+i}var a=parseInt(i,e);return a!==1/0&&a>=Math.pow(2,n)?Kg(n,e):i};Kg.rack=function(n,e,t){var o=function(i){var s=0;do{if(s++>10)if(t)n+=t;else throw new Error("too many ID collisions, use more bits");var l=Kg(n,e)}while(Object.hasOwnProperty.call(r,l));return r[l]=i,l},r=o.hats={};return o.get=function(i){return o.hats[i]},o.set=function(i,s){return o.hats[i]=s,o},o.bits=n||128,o.base=e||16,o};var m7=$i,JD=d7,KD=h7,Rh=_o,Xg=Jg.exports,XD=f7.exports,g7=Hs.ACTIONS,p7=Mt;function Mt(n,e){if(m7.EventEmitter.call(this),!e||typeof e!="string")throw new Error("Presence channel must be provided");this.connection=n,this.channel=e,this.wantSubscribe=!1,this.subscribed=!1,this.remotePresences={},this.localPresences={},this._remotePresenceInstances={},this._subscriptionCallbacksBySeq={},this._wantsDestroy=!1}m7.mixin(Mt),Mt.prototype.subscribe=function(n){this._sendSubscriptionAction(!0,n)},Mt.prototype.unsubscribe=function(n){this._sendSubscriptionAction(!1,n)},Mt.prototype.create=function(n){if(this._wantsDestroy)throw new Error("Presence is being destroyed");n=n||XD();var e=this._createLocalPresence(n);return this.localPresences[n]=e,e},Mt.prototype.destroy=function(n){this._wantsDestroy=!0;var e=this,t=Object.keys(e.localPresences);this.unsubscribe(function(o){if(o)return e._callbackOrEmit(o,n);var r=Object.keys(e._remotePresenceInstances);Xg.parallel([function(i){Xg.each(t,function(s,l){e.localPresences[s].destroy(l)},i)},function(i){if(!e._wantsDestroy)return i();Xg.each(r,function(s,l){e._remotePresenceInstances[s].destroy(l)},i)}],function(i){e._wantsDestroy&&delete e.connection._presences[e.channel],e._callbackOrEmit(i,n)})})},Mt.prototype._sendSubscriptionAction=function(n,e){this.wantSubscribe=!!n;var t=this.wantSubscribe?g7.presenceSubscribe:g7.presenceUnsubscribe,o=this.connection._presenceSeq++;this._subscriptionCallbacksBySeq[o]=e,this.connection.canSend&&this.connection._sendPresenceAction(t,o,this)},Mt.prototype._handleSubscribe=function(n,e){this.wantSubscribe&&(this.subscribed=!0);var t=this._subscriptionCallback(e);this._callbackOrEmit(n,t)},Mt.prototype._handleUnsubscribe=function(n,e){this.subscribed=!1;var t=this._subscriptionCallback(e);this._callbackOrEmit(n,t)},Mt.prototype._receiveUpdate=function(n,e){var t=Rh.dig(this.localPresences,e.id);if(t)return t._ack(n,e.pv);if(n)return this.emit("error",n);var o=this,r=Rh.digOrCreate(this._remotePresenceInstances,e.id,function(){return o._createRemotePresence(e.id)});r.receiveUpdate(e)},Mt.prototype._updateRemotePresence=function(n){this.remotePresences[n.presenceId]=n.value,n.value===null&&this._removeRemotePresence(n.presenceId),this.emit("receive",n.presenceId,n.value)},Mt.prototype._broadcastAllLocalPresence=function(n){if(n)return this.emit("error",n);for(var e in this.localPresences){var t=this.localPresences[e];t.value!==null&&t.send()}},Mt.prototype._removeRemotePresence=function(n){this._remotePresenceInstances[n].destroy(),delete this._remotePresenceInstances[n],delete this.remotePresences[n]},Mt.prototype._onConnectionStateChanged=function(){if(!!this.connection.canSend){this._resubscribe();for(var n in this.localPresences)this.localPresences[n]._sendPending()}},Mt.prototype._resubscribe=function(){var n=[];for(var e in this._subscriptionCallbacksBySeq){var t=this._subscriptionCallback(e);n.push(t)}if(!this.wantSubscribe)return this._callEachOrEmit(n);var o=this;this.subscribe(function(r){o._callEachOrEmit(n,r)})},Mt.prototype._subscriptionCallback=function(n){var e=this._subscriptionCallbacksBySeq[n];return delete this._subscriptionCallbacksBySeq[n],e},Mt.prototype._callbackOrEmit=function(n,e){if(e)return Rh.nextTick(e,n);n&&this.emit("error",n)},Mt.prototype._createLocalPresence=function(n){return new JD(this,n)},Mt.prototype._createRemotePresence=function(n){return new KD(this,n)},Mt.prototype._callEachOrEmit=function(n,e){var t=Rh.callEach(n,e);!t&&e&&this.emit("error",e)};var Ua=d7,C7=Th,eS=_o,A7=C7.CODES,tS=Fo;function Fo(n,e){Ua.call(this,n,e),this.collection=this.presence.collection,this.id=this.presence.id,this._doc=this.connection.get(this.collection,this.id),this._isSending=!1,this._docDataVersionByPresenceVersion={},this._opHandler=this._transformAgainstOp.bind(this),this._createOrDelHandler=this._handleCreateOrDel.bind(this),this._loadHandler=this._handleLoad.bind(this),this._destroyHandler=this.destroy.bind(this),this._registerWithDoc()}Fo.prototype=Object.create(Ua.prototype),Fo.prototype.submit=function(n,e){if(!this._doc.type){if(n===null)return this._callbackOrEmit(null,e);var t={code:A7.ERR_DOC_DOES_NOT_EXIST,message:"Cannot submit presence. Document has not been created"};return this._callbackOrEmit(t,e)}this._docDataVersionByPresenceVersion[this.presenceVersion]=this._doc._dataStateVersion,Ua.prototype.submit.call(this,n,e)},Fo.prototype.destroy=function(n){this._doc.removeListener("op",this._opHandler),this._doc.removeListener("create",this._createOrDelHandler),this._doc.removeListener("del",this._createOrDelHandler),this._doc.removeListener("load",this._loadHandler),this._doc.removeListener("destroy",this._destroyHandler),Ua.prototype.destroy.call(this,n)},Fo.prototype._sendPending=function(){if(!this._isSending){this._isSending=!0;var n=this;this._doc.whenNothingPending(function(){n._isSending=!1,n.connection.canSend&&(n._pendingMessages.forEach(function(e){e.t=n._doc.type.uri,e.v=n._doc.version,n.connection.send(e)}),n._pendingMessages=[],n._docDataVersionByPresenceVersion={})})}},Fo.prototype._registerWithDoc=function(){this._doc.on("op",this._opHandler),this._doc.on("create",this._createOrDelHandler),this._doc.on("del",this._createOrDelHandler),this._doc.on("load",this._loadHandler),this._doc.on("destroy",this._destroyHandler)},Fo.prototype._transformAgainstOp=function(n,e){var t=this,o=this._doc._dataStateVersion;this._pendingMessages.forEach(function(r){var i=t._docDataVersionByPresenceVersion[r.pv];if(!(i>=o))try{r.p=t._transformPresence(r.p,n,e),t._docDataVersionByPresenceVersion[r.pv]=o}catch(l){var s=t._getCallback(r.pv);t._callbackOrEmit(l,s)}});try{this.value=this._transformPresence(this.value,n,e)}catch(r){this.emit("error",r)}},Fo.prototype._handleCreateOrDel=function(){this._pendingMessages.forEach(function(n){n.p=null}),this.value=null},Fo.prototype._handleLoad=function(){this.value=null,this._pendingMessages=[],this._docDataVersionByPresenceVersion={}},Fo.prototype._message=function(){var n=Ua.prototype._message.call(this);return n.c=this.collection,n.d=this.id,n.v=null,n.t=null,n},Fo.prototype._transformPresence=function(n,e,t){var o=this._doc.type;if(!eS.supportsPresence(o))throw new C7(A7.ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE,"Type does not support presence: "+o.name);return o.transformPresence(n,e,t)};var b7={};(function(n){var e=$a,t=Th,o=_o,r=t.CODES;n.checkOp=function(l){if(l==null||typeof l!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"Op must be an object");if(l.create!=null){if(typeof l.create!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"Create data must be an object");var a=l.create.type;if(typeof a!="string")return new t(r.ERR_OT_OP_BADLY_FORMED,"Missing create type");var d=e.map[a];if(d==null||typeof d!="object")return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type")}else if(l.del!=null){if(l.del!==!0)return new t(r.ERR_OT_OP_BADLY_FORMED,"del value must be true")}else if(!("op"in l))return new t(r.ERR_OT_OP_BADLY_FORMED,"Missing op, create, or del");if(l.src!=null&&typeof l.src!="string")return new t(r.ERR_OT_OP_BADLY_FORMED,"src must be a string");if(l.seq!=null&&typeof l.seq!="number")return new t(r.ERR_OT_OP_BADLY_FORMED,"seq must be a number");if(l.src==null&&l.seq!=null||l.src!=null&&l.seq==null)return new t(r.ERR_OT_OP_BADLY_FORMED,"Both src and seq must be set together");if(l.m!=null&&typeof l.m!="object")return new t(r.ERR_OT_OP_BADLY_FORMED,"op.m must be an object or null")},n.normalizeType=function(l){return e.map[l]&&e.map[l].uri},n.apply=function(l,a){if(typeof l!="object")return new t(r.ERR_APPLY_SNAPSHOT_NOT_PROVIDED,"Missing snapshot");if(l.v!=null&&a.v!=null&&l.v!==a.v)return new t(r.ERR_APPLY_OP_VERSION_DOES_NOT_MATCH_SNAPSHOT,"Version mismatch");if(a.create){if(l.type)return new t(r.ERR_DOC_ALREADY_CREATED,"Document already exists");var d=a.create,f=e.map[d.type];if(!f)return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{l.data=f.create(d.data),l.type=f.uri,l.v++}catch(A){return A}}else if(a.del)l.data=void 0,l.type=null,l.v++;else if("op"in a){var p=i(l,a.op);if(p)return p;l.v++}else l.v++};function i(l,a){if(!l.type)return new t(r.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");if(a===void 0)return new t(r.ERR_OT_OP_NOT_PROVIDED,"Missing op");var d=e.map[l.type];if(!d)return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{l.data=d.apply(l.data,a)}catch(f){return new t(r.ERR_OT_OP_NOT_APPLIED,f.message)}}n.transform=function(l,a,d){if(a.v!=null&&a.v!==d.v)return new t(r.ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM,"Version mismatch");if(d.del){if(a.create||"op"in a)return new t(r.ERR_DOC_WAS_DELETED,"Document was deleted")}else{if(d.create&&("op"in a||a.create||a.del)||"op"in d&&a.create)return new t(r.ERR_DOC_ALREADY_CREATED,"Document was created remotely");if("op"in d&&"op"in a){if(!l)return new t(r.ERR_DOC_DOES_NOT_EXIST,"Document does not exist");if(typeof l=="string"&&(l=e.map[l],!l))return new t(r.ERR_DOC_TYPE_NOT_RECOGNIZED,"Unknown type");try{a.op=l.transform(a.op,d.op,"left")}catch(f){return f}}}a.v!=null&&a.v++},n.applyOps=function(l,a,d){d=d||{};for(var f=0;f<a.length;f++){var p=a[f];if(d._normalizeLegacyJson0Ops)try{s(l,p)}catch{return new t(r.ERR_OT_LEGACY_JSON0_OP_CANNOT_BE_NORMALIZED,"Cannot normalize legacy json0 op")}l.v=p.v;var A=n.apply(l,p);if(A)return A}},n.transformPresence=function(l,a,d){var f=this.checkOp(a);if(f)return f;var p=l.t;if(typeof p=="string"&&(p=e.map[p]),!p)return{code:r.ERR_DOC_TYPE_NOT_RECOGNIZED,message:"Unknown type"};if(!o.supportsPresence(p))return{code:r.ERR_TYPE_DOES_NOT_SUPPORT_PRESENCE,message:"Type does not support presence"};if(a.create||a.del){l.p=null,l.v++;return}try{l.p=l.p===null?null:p.transformPresence(l.p,a.op,d)}catch(A){return{code:r.ERR_PRESENCE_TRANSFORM_FAILED,message:A.message||A}}l.v++};function s(l,a){if(l.type===e.defaultType.uri){var d=a.op;if(!!d){var f=l.data;d.length>1&&(f=o.clone(f));for(var p=0;p<d.length;p++){var A=d[p];typeof A.lm=="string"&&(A.lm=+A.lm);for(var v=A.p,B=f,D=0;D<v.length;D++){var I=v[D];Object.prototype.toString.call(B)=="[object Array]"?v[D]=+I:B.constructor===Object&&(v[D]=I.toString()),B=B[I]}p<d.length-1&&(f=e.defaultType.apply(f,[A]))}}}}})(b7);var za=h7,nS=b7,oS=so;function so(n,e){za.call(this,n,e),this.collection=this.presence.collection,this.id=this.presence.id,this.src=null,this.presenceVersion=null,this._doc=this.connection.get(this.collection,this.id),this._pending=null,this._opCache=null,this._pendingSetPending=!1,this._opHandler=this._handleOp.bind(this),this._createDelHandler=this._handleCreateDel.bind(this),this._loadHandler=this._handleLoad.bind(this),this._registerWithDoc()}so.prototype=Object.create(za.prototype),so.prototype.receiveUpdate=function(n){this._pending&&n.pv<this._pending.pv||(this.src=n.src,this._pending=n,this._setPendingPresence())},so.prototype.destroy=function(n){this._doc.removeListener("op",this._opHandler),this._doc.removeListener("create",this._createDelHandler),this._doc.removeListener("del",this._createDelHandler),this._doc.removeListener("load",this._loadHandler),za.prototype.destroy.call(this,n)},so.prototype._registerWithDoc=function(){this._doc.on("op",this._opHandler),this._doc.on("create",this._createDelHandler),this._doc.on("del",this._createDelHandler),this._doc.on("load",this._loadHandler)},so.prototype._setPendingPresence=function(){if(!this._pendingSetPending){this._pendingSetPending=!0;var n=this;this._doc.whenNothingPending(function(){if(n._pendingSetPending=!1,!!n._pending){if(n._pending.pv<n.presenceVersion)return n._pending=null;if(n._pending.v>n._doc.version)return n._doc.fetch();!n._catchUpStalePresence()||(n.value=n._pending.p,n.presenceVersion=n._pending.pv,n._pending=null,n.presence._updateRemotePresence(n))}})}},so.prototype._handleOp=function(n,e,t){var o=t===this.src;this._transformAgainstOp(n,o),this._cacheOp(n,o),this._setPendingPresence()},za.prototype._handleCreateDel=function(){this._cacheOp(null),this._setPendingPresence()},za.prototype._handleLoad=function(){this.value=null,this._pending=null,this._opCache=null,this.presence._updateRemotePresence(this)},so.prototype._transformAgainstOp=function(n,e){if(!!this.value){try{this.value=this._doc.type.transformPresence(this.value,n,e)}catch(t){return this.presence.emit("error",t)}this.presence._updateRemotePresence(this)}},so.prototype._catchUpStalePresence=function(){if(this._pending.v>=this._doc.version)return!0;if(!this._opCache)return this._startCachingOps(),this._doc.fetch(),this.presence.subscribe(),!1;for(;this._opCache[this._pending.v];){var n=this._opCache[this._pending.v],e=n.op,t=n.isOwnOp;e===null?(this._pending.p=null,this._pending.v++):nS.transformPresence(this._pending,e,t)}var o=this._pending.v>=this._doc.version;return o&&this._stopCachingOps(),o},so.prototype._startCachingOps=function(){this._opCache=[]},so.prototype._stopCachingOps=function(){this._opCache=null},so.prototype._cacheOp=function(n,e){this._opCache&&(n=n?{op:n}:null,this._opCache[this._doc.version-1]={op:n,isOwnOp:e})};var v7=p7,rS=tS,iS=oS;function Kl(n,e,t){var o=Kl.channel(e,t);v7.call(this,n,o),this.collection=e,this.id=t}var sS=Kl;Kl.prototype=Object.create(v7.prototype),Kl.channel=function(n,e){return n+"."+e},Kl.prototype._createLocalPresence=function(n){return new rS(this,n)},Kl.prototype._createRemotePresence=function(n){return new iS(this,n)};var lS=cS;function cS(n,e,t,o,r){this.id=n,this.v=e,this.type=t,this.data=o,this.m=r}var aS=lS,y7=$i,k7=Va;function Va(n,e,t,o,r){if(y7.EventEmitter.call(this),typeof r!="function")throw new Error("Callback is required for SnapshotRequest");this.requestId=e,this.connection=n,this.id=o,this.collection=t,this.callback=r,this.sent=!1}y7.mixin(Va),Va.prototype.send=function(){!this.connection.canSend||(this.connection.send(this._message()),this.sent=!0)},Va.prototype._onConnectionStateChanged=function(){this.connection.canSend?this.sent||this.send():this.sent=!1},Va.prototype._handleResponse=function(n,e){if(this.emit("ready"),n)return this.callback(n);var t=e.meta?e.meta:null,o=new aS(this.id,e.v,e.type,e.data,t);this.callback(null,o)};var w7=k7,uS=_o,dS=Hs.ACTIONS,hS=ep;function ep(n,e,t,o,r,i){if(w7.call(this,n,e,t,o,i),!uS.isValidVersion(r))throw new Error("Snapshot version must be a positive integer or null");this.version=r}ep.prototype=Object.create(w7.prototype),ep.prototype._message=function(){return{a:dS.snapshotFetch,id:this.requestId,c:this.collection,d:this.id,v:this.version}};var B7=k7,fS=_o,mS=Hs.ACTIONS,gS=tp;function tp(n,e,t,o,r,i){if(B7.call(this,n,e,t,o,i),!fS.isValidTimestamp(r))throw new Error("Snapshot timestamp must be a positive integer or null");this.timestamp=r}tp.prototype=Object.create(B7.prototype),tp.prototype._message=function(){return{a:mS.snapshotFetchByTimestamp,id:this.requestId,c:this.collection,d:this.id,ts:this.timestamp}};var pS=UD,CS=GD,AS=p7,E7=sS,bS=hS,vS=gS,x7=$i,Xl=Th,et=Hs.ACTIONS,I7=$a,No=_o,Wa=n7,qa=Xl.CODES;function T7(n){return n.readyState===0||n.readyState===1?"connecting":"disconnected"}var yS=we;function we(n){x7.EventEmitter.call(this),this.collections={},this.nextQueryId=1,this.nextSnapshotRequestId=1,this.queries={},this._presences={},this._snapshotRequests={},this.seq=1,this._presenceSeq=1,this.id=null,this.agent=null,this.debug=!1,this.state=T7(n),this.bindToSocket(n)}x7.mixin(we),we.prototype.bindToSocket=function(n){this.socket&&(this.socket.close(),this.socket.onmessage=null,this.socket.onopen=null,this.socket.onerror=null,this.socket.onclose=null),this.socket=n;var e=T7(n);this._setState(e),this.canSend=!1;var t=this;n.onmessage=function(o){try{var r=typeof o.data=="string"?JSON.parse(o.data):o.data}catch{Wa.warn("Failed to parse message",o);return}t.debug&&Wa.info("RECV",JSON.stringify(r));var i={data:r};if(t.emit("receive",i),!!i.data)try{t.handleMessage(i.data)}catch(s){No.nextTick(function(){t.emit("error",s)})}},n.readyState===1&&t._initializeHandshake(),n.onopen=function(){t._setState("connecting"),t._initializeHandshake()},n.onerror=function(o){t.emit("connection error",o)},n.onclose=function(o){o==="closed"||o==="Closed"?t._setState("closed",o):o==="stopped"||o==="Stopped by server"?t._setState("stopped",o):t._setState("disconnected",o)}},we.prototype.handleMessage=function(n){var e=null;switch(n.error&&(e=D7(n.error,n),delete n.error),n.a){case et.initLegacy:return this._handleLegacyInit(n);case et.handshake:return this._handleHandshake(e,n);case et.queryFetch:var t=this.queries[n.id];t&&t._handleFetch(e,n.data,n.extra);return;case et.querySubscribe:var t=this.queries[n.id];t&&t._handleSubscribe(e,n.data,n.extra);return;case et.queryUnsubscribe:return;case et.queryUpdate:var t=this.queries[n.id];if(!t)return;if(e)return t._handleError(e);n.diff&&t._handleDiff(n.diff),n.hasOwnProperty("extra")&&t._handleExtra(n.extra);return;case et.bulkFetch:return this._handleBulkMessage(e,n,"_handleFetch");case et.bulkSubscribe:case et.bulkUnsubscribe:return this._handleBulkMessage(e,n,"_handleSubscribe");case et.snapshotFetch:case et.snapshotFetchByTimestamp:return this._handleSnapshotFetch(e,n);case et.fetch:var o=this.getExisting(n.c,n.d);o&&o._handleFetch(e,n.data);return;case et.subscribe:case et.unsubscribe:var o=this.getExisting(n.c,n.d);o&&o._handleSubscribe(e,n.data);return;case et.op:var o=this.getExisting(n.c,n.d);o&&o._handleOp(e,n);return;case et.presence:return this._handlePresence(e,n);case et.presenceSubscribe:return this._handlePresenceSubscribe(e,n);case et.presenceUnsubscribe:return this._handlePresenceUnsubscribe(e,n);case et.presenceRequest:return this._handlePresenceRequest(e,n);case et.pingPong:return this._handlePingPong(e);default:Wa.warn("Ignoring unrecognized message",n)}};function D7(n,e){var t=new Error(n.message);return t.code=n.code,e&&(t.data=e),t}we.prototype._handleBulkMessage=function(n,e,t){if(e.data)for(var o in e.data){var r=e.data[o],i=this.getExisting(e.c,o);i&&(n?i[t](n):r.error?i[t](D7(r.error)):i[t](null,r))}else if(Array.isArray(e.b))for(var s=0;s<e.b.length;s++){var o=e.b[s],i=this.getExisting(e.c,o);i&&i[t](n)}else if(e.b)for(var o in e.b){var i=this.getExisting(e.c,o);i&&i[t](n)}else Wa.error("Invalid bulk message",e)},we.prototype._reset=function(){this.agent=null},we.prototype._setState=function(n,e){if(this.state!==n){if(n==="connecting"&&this.state!=="disconnected"&&this.state!=="stopped"&&this.state!=="closed"||n==="connected"&&this.state!=="connecting"){var t=new Xl(qa.ERR_CONNECTION_STATE_TRANSITION_INVALID,"Cannot transition directly from "+this.state+" to "+n);return this.emit("error",t)}this.state=n,this.canSend=n==="connected",(n==="disconnected"||n==="stopped"||n==="closed")&&this._reset(),this.startBulk();for(var o in this.queries){var r=this.queries[o];r._onConnectionStateChanged()}for(var i in this.collections){var s=this.collections[i];for(var o in s)s[o]._onConnectionStateChanged()}for(var l in this._presences)this._presences[l]._onConnectionStateChanged();for(var o in this._snapshotRequests){var a=this._snapshotRequests[o];a._onConnectionStateChanged()}this.endBulk(),this.emit(n,e),this.emit("state",n,e)}},we.prototype.startBulk=function(){this.bulk||(this.bulk={})},we.prototype.endBulk=function(){if(this.bulk)for(var n in this.bulk){var e=this.bulk[n];this._sendBulk("f",n,e.f),this._sendBulk("s",n,e.s),this._sendBulk("u",n,e.u)}this.bulk=null},we.prototype._sendBulk=function(n,e,t){if(!!t){var o=[],r={},i=0,s;for(var l in t){var a=t[l];a==null?o.push(l):(r[l]=a,s=l,i++)}if(o.length===1){var l=o[0];this.send({a:n,c:e,d:l})}else o.length&&this.send({a:"b"+n,c:e,b:o});if(i===1){var d=r[s];this.send({a:n,c:e,d:s,v:d})}else i&&this.send({a:"b"+n,c:e,b:r})}},we.prototype._sendActions=function(n,e,t){if(this._addDoc(e),this.bulk){var o=this.bulk[e.collection]||(this.bulk[e.collection]={}),r=o[n]||(o[n]={}),i=r.hasOwnProperty(e.id);return r[e.id]=t,i}else{var s={a:n,c:e.collection,d:e.id,v:t};this.send(s)}},we.prototype.sendFetch=function(n){return this._sendActions(et.fetch,n,n.version)},we.prototype.sendSubscribe=function(n){return this._sendActions(et.subscribe,n,n.version)},we.prototype.sendUnsubscribe=function(n){return this._sendActions(et.unsubscribe,n)},we.prototype.sendOp=function(n,e){this._addDoc(n);var t={a:et.op,c:n.collection,d:n.id,v:n.version,src:e.src,seq:e.seq,x:{}};"op"in e&&(t.op=e.op),e.create&&(t.create=e.create),e.del&&(t.del=e.del),n.submitSource&&(t.x.source=e.source),this.send(t)},we.prototype.send=function(n){this.debug&&Wa.info("SEND",JSON.stringify(n)),this.emit("send",n),this.socket.send(JSON.stringify(n))},we.prototype.ping=function(){if(!this.canSend)throw new Xl(qa.ERR_CANNOT_PING_OFFLINE,"Socket must be CONNECTED to ping");var n={a:et.pingPong};this.send(n)},we.prototype.close=function(){this.socket.close()},we.prototype.getExisting=function(n,e){if(this.collections[n])return this.collections[n][e]},we.prototype.get=function(n,e){var t=this.collections[n]||(this.collections[n]={}),o=t[e];return o||(o=t[e]=new pS(this,n,e),this.emit("doc",o)),o._wantsDestroy=!1,o},we.prototype._destroyDoc=function(n){!n._wantsDestroy||(No.digAndRemove(this.collections,n.collection,n.id),n.emit("destroy"))},we.prototype._addDoc=function(n){var e=this.collections[n.collection];e||(e=this.collections[n.collection]={}),e[n.id]!==n&&(e[n.id]=n)},we.prototype._createQuery=function(n,e,t,o,r){var i=this.nextQueryId++,s=new CS(n,this,i,e,t,o,r);return this.queries[i]=s,s.send(),s},we.prototype._destroyQuery=function(n){delete this.queries[n.id]},we.prototype.createFetchQuery=function(n,e,t,o){return this._createQuery(et.queryFetch,n,e,t,o)},we.prototype.createSubscribeQuery=function(n,e,t,o){return this._createQuery(et.querySubscribe,n,e,t,o)},we.prototype.hasPending=function(){return!!(this._firstDoc(Oh)||this._firstQuery(Oh)||this._firstSnapshotRequest())};function Oh(n){return n.hasPending()}we.prototype.hasWritePending=function(){return!!this._firstDoc(kS)};function kS(n){return n.hasWritePending()}we.prototype.whenNothingPending=function(n){var e=this._firstDoc(Oh);if(e){e.once("nothing pending",this._nothingPendingRetry(n));return}var t=this._firstQuery(Oh);if(t){t.once("ready",this._nothingPendingRetry(n));return}var o=this._firstSnapshotRequest();if(o){o.once("ready",this._nothingPendingRetry(n));return}No.nextTick(n)},we.prototype._nothingPendingRetry=function(n){var e=this;return function(){No.nextTick(function(){e.whenNothingPending(n)})}},we.prototype._firstDoc=function(n){for(var e in this.collections){var t=this.collections[e];for(var o in t){var r=t[o];if(n(r))return r}}},we.prototype._firstQuery=function(n){for(var e in this.queries){var t=this.queries[e];if(n(t))return t}},we.prototype._firstSnapshotRequest=function(){for(var n in this._snapshotRequests)return this._snapshotRequests[n]},we.prototype.fetchSnapshot=function(n,e,t,o){typeof t=="function"&&(o=t,t=null);var r=this.nextSnapshotRequestId++,i=new bS(this,r,n,e,t,o);this._snapshotRequests[i.requestId]=i,i.send()},we.prototype.fetchSnapshotByTimestamp=function(n,e,t,o){typeof t=="function"&&(o=t,t=null);var r=this.nextSnapshotRequestId++,i=new vS(this,r,n,e,t,o);this._snapshotRequests[i.requestId]=i,i.send()},we.prototype._handleSnapshotFetch=function(n,e){var t=this._snapshotRequests[e.id];!t||(delete this._snapshotRequests[e.id],t._handleResponse(n,e))},we.prototype._handleLegacyInit=function(n){if(n.protocolMinor)return this._initializeHandshake();this._initialize(n)},we.prototype._initializeHandshake=function(){this.send({a:et.handshake,id:this.id})},we.prototype._handleHandshake=function(n,e){if(n)return this.emit("error",n);this._initialize(e)},we.prototype._handlePingPong=function(n){if(n)return this.emit("error",n);this.emit("pong")},we.prototype._initialize=function(n){if(this.state==="connecting"){if(n.protocol!==1)return this.emit("error",new Xl(qa.ERR_PROTOCOL_VERSION_NOT_SUPPORTED,"Unsupported protocol version: "+n.protocol));if(I7.map[n.type]!==I7.defaultType)return this.emit("error",new Xl(qa.ERR_DEFAULT_TYPE_MISMATCH,n.type+" does not match the server default type"));if(typeof n.id!="string")return this.emit("error",new Xl(qa.ERR_CLIENT_ID_BADLY_FORMED,"Client id must be a string"));this.id=n.id,this._setState("connected")}},we.prototype.getPresence=function(n){var e=this,t=No.digOrCreate(this._presences,n,function(){return new AS(e,n)});return t._wantsDestroy=!1,t},we.prototype.getDocPresence=function(n,e){var t=E7.channel(n,e),o=this,r=No.digOrCreate(this._presences,t,function(){return new E7(o,n,e)});return r._wantsDestroy=!1,r},we.prototype._sendPresenceAction=function(n,e,t){this._addPresence(t);var o={a:n,ch:t.channel,seq:e};return this.send(o),o.seq},we.prototype._addPresence=function(n){No.digOrCreate(this._presences,n.channel,function(){return n})},we.prototype._handlePresenceSubscribe=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._handleSubscribe(n,e.seq)},we.prototype._handlePresenceUnsubscribe=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._handleUnsubscribe(n,e.seq)},we.prototype._handlePresence=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._receiveUpdate(n,e)},we.prototype._handlePresenceRequest=function(n,e){var t=No.dig(this._presences,e.ch);t&&t._broadcastAllLocalPresence(n,e)};var S7=yS,wS=$a;const _h={err:1001,msg:"user auth error",name:"AuthError"},BS={err:1002,msg:"you don't have required permission",name:"PermissionError"},np={err:1003,msg:"Too many user connected",name:"MaxUserError"},Ga={err:1004,msg:"document server changed, reload it",name:"RequestReloadError"},ES={err:1005,msg:"app id must be at least 2 chars, doc id must be at least 5 chars",name:"DocIdError"},xS={err:1028,msg:"upload file ext not allowed",name:"FileExtError"},Za="x-live-editor-token",Ph="x-live-editor-base-url",gn=S("auth-connection");function IS(n){try{n()}catch(e){gn.error(e)}}class TS{constructor(e,t){g(this,"connection");g(this,"ws");g(this,"retryCount");g(this,"events",new _3.EventEmitter);g(this,"token",null);g(this,"resourceToken",null);this.url=e,this.reauthFunc=t,this.retryCount=0}getBaseURL(){const e=new URL(this.url);return`${e.protocol==="wss:"?"https:":"http:"}//${e.host}${e.pathname}`}getBase64BaseURL(){return ws(this.getBaseURL())}async auth(e){m(gn,e.token,"no auth token");const t=`${this.getBaseURL()}/auth`,o=await window.fetch(t,{method:"GET",headers:{[Za]:e.token,[Ph]:this.getBase64BaseURL()},credentials:"include"});if(o.status!==200)throw new Error("http auth error");return this.token=e.token,await o.json()}async logout(){if(!this.token)return;const e=`${this.getBaseURL()}/logout`;await window.fetch(e,{method:"GET",headers:{[Ph]:ws(this.getBaseURL())}})}async init(e){const t=await this.auth(e);this.resourceToken=t.read,this.ws=new DB.default(this.url,void 0,{maxReconnectionDelay:2500,minReconnectionDelay:1e3}),this.connection=Object.create(S7.prototype),m(gn,this.connection,"no this.connection"),this.ws,this.connection._initializeHandshake=function(){this.send({a:"hs",id:this.id,auth:e})};const o=this.connection.handleMessage.bind(this.connection);this.connection.handleMessage=r=>{var s;const i=r;if(this.connection&&(this.connection.lastReceiveTime=Date.now()),"err"in i||i.a==="pong")this.handleMessage(i);else{Object.prototype.hasOwnProperty.call(i,"a")&&i.a!=="init"&&i.a!=="hs"&&(this.retryCount=0);try{o(i)}catch(l){if((l==null?void 0:l.type)==="writeConflict"){this.emitWriteConflictError(l,i);return}if((s=l==null?void 0:l.message)!=null&&s.startsWith("Cannot invert subtype")){this.emitWriteConflictError(l,i);return}throw l}}},S7.apply(this.connection,[this.ws])}async handleAuthError(){if(this.reauthFunc&&this.retryCount<5){this.retryCount+=1,gn.info(`retrying re-auth attempt no. ${this.retryCount}`);try{if(this.connection){const e=await this.reauthFunc();await this.auth(e),this.connection._initializeHandshake=function(){this.send({a:"hs",id:this.id,auth:e})}}}catch(e){gn.error(e),setTimeout(()=>this.handleAuthError(),0)}}else gn.error("auth error, cannot retry anymore"),this.emitAuthError(),this.end(!1)}emitAuthError(){const e=new Error(_h.msg);e.code=_h.err,this.events.emit("error",e)}emitRequestReloadError(){const e=new Error(Ga.msg);e.code=Ga.err,this.events.emit("requestReloadError",e)}emitWriteConflictError(e,t){e.orgMsg=t,this.events.emit("writeConflictError",e)}emitMaxUsersError(){this.events.emit("maxUsersError"),this.end(!1)}handleMessage(e){const t=e;if(t.a==="pong")return;const o=t.err;if(o===_h.err)gn.warn("auth error"),this.handleAuthError();else if(o===np.err)gn.warn(np.msg),this.emitMaxUsersError();else if(o===Ga.err){gn.warn(Ga.msg);try{this.emitRequestReloadError()}catch(r){gn.error(`error occurred while process reload error: ${JSON.stringify(r)}`)}finally{this.end(!1)}}else gn.error(`unknown message received: ${JSON.stringify(t)}`),this.emitAuthError()}get(e,t){return m(gn,this.connection,"no this.connection"),this.connection.get(e,t)}addEventListener(e,t){e==="error"?this.events.addListener(e,t):(m(gn,this.ws,"no this.ws"),this.ws.addEventListener(e,t))}onWriteConflictError(e){this.events.addListener("writeConflictError",e)}onMaxUsersError(e){m(gn,this.events.listenerCount("maxUsersError")===0,"too many maxUserError listener"),this.events.addListener("maxUsersError",e)}onRequestReloadError(e){m(gn,this.events.listenerCount("requestReloadError")===0,"to many requestReloadError listener"),this.events.addListener("requestReloadError",e)}end(e){var t;this.reauthFunc=void 0,this.events.removeAllListeners(),IS(()=>{var o;return(o=this.connection)==null?void 0:o.close()}),this.connection=void 0,(t=this.ws)==null||t.close(),this.ws=void 0,e&&this.logout()}}S("utils/file");function DS(){function n(){return new Promise(e=>{const t=new FileReader;t.onload=()=>{e(t.result)},t.readAsArrayBuffer(this)})}File.prototype.arrayBuffer=File.prototype.arrayBuffer||n,Blob.prototype.arrayBuffer=Blob.prototype.arrayBuffer||n}DS();async function SS(n){const t=n.size,o=Math.floor((t+102400-1)/102400),r=new SB.Hash;for(let s=0;s<o;s++){const l=s*102400;let a=l+102400;a>t&&(a=t);const f=await n.slice(l,a,n.type).arrayBuffer();r.update(new Uint8Array(f))}const i=r.digest();return ws(i)}const ur=S("sharedb-doc/client");class LS{constructor(e,t,o){g(this,"connection");g(this,"auth");g(this,"doc",null);g(this,"reauthFunc");g(this,"clientId",K());g(this,"getDoc",async()=>{const e=o=>new Promise((r,i)=>{o.fetch(s=>{s?i(s):r()})});m(ur,!this.doc,"This websocket has opened a doc."),await this.connection.init(this.auth);const t=this.connection.get(this.auth.appId,this.auth.docId);return this.doc=t,await e(t),ur.debug(t),t});this.auth=e;const r=`${t}/${this.auth.appId}/${this.auth.docId}`;wS.register(Ld.type),this.connection=new TS(r,o),this.reauthFunc=o}editorServer(){const e=this.apiServer(),t=`/${this.auth.appId}/${this.auth.docId}`;return m(ur,e.endsWith(t),`invalid api server: ${e}, ${t}`),e.substr(0,e.length-t.length)}close(e){this.connection.end(e),this.doc=null}on(e,t){this.connection.addEventListener(e,o=>{(e==="error"||this.doc)&&t(o)})}onWriteConflictError(e){this.connection.onWriteConflictError(e)}onMaxUsersError(e){this.connection.onMaxUsersError(e)}onRequestReloadError(e){this.connection.onRequestReloadError(e)}async authOnly(){await this.connection.auth(this.auth)}getResourceToken(){return this.connection.resourceToken}hasDocContainer(){return!!this.doc}apiServer(){const e=this.connection.url;if(e.startsWith("ws://"))return`http://${e.substring(5)}`;if(e.startsWith("wss://"))return`https://${e.substring(6)}`;throw new Error(`invalid server url: ${e}`)}async getFileUrlByHash(e,t,o,r,i){try{const s=`${e}/${t}`,l=await this.request(s,{method:"post",headers:{...i},data:{name:o,size:r}});return l.data&&Array.isArray(l.data)&&l.data.length===1?l.data[0]:""}catch{return""}}async getFileUrlsByHashes(e){const o=`${this.apiServer()}/resources`;let r=[];e.forEach(l=>{const a=l.split("|");r.push(...a)}),r=Array.from(new Set(r));const i=r.map(l=>this.getFileUrlByHash(o,l,"",0,{[Za]:this.connection.token}));return await Promise.all(i)}async uploadFile(e,t,o,r,i){let s=t.size;if(s===0)throw new Error("file is empty");s+=500;const l=v=>{ur.info(`on progress: ${v.loaded}`);let B=v.loaded*100/s;B>100&&(B=100),r(B)},a=await SS(t),d=await this.getFileUrlByHash(e,a,t.name,t.size,o);if(d)return r(-1),d;let f=e;i!=null&&i.thumbnail&&(f+="/thumbnail");const p=new FormData;p.append("file-size",`${t.size}`),p.append("file-hash",a),p.append("file",t,t.name);const A=await this.request(f,{method:"post",data:p,withCredentials:!0,headers:{...o},onUploadProgress:l});return ur.info(A),r(100),Array.isArray(A.data)?A.data[0]:A.data}async uploadResource(e,t=()=>{},o){const i=`${this.apiServer()}/resources`;m(ur,this.connection.token,"no connection token");const s=await this.uploadFile(i,e,{[Za]:this.connection.token},t,o);return m(ur,s,"no result"),s}async request(e,t){var i,s;let o=this.connection.token,r;for(let l=0;l<2;l++){const a=t||{};a.url=e,a.headers||(a.headers={}),m(ur,o,"no token"),a.headers={...a.headers,[Za]:o,[Ph]:this.connection.getBase64BaseURL()};try{return await IB.default(e,a)}catch(d){if(r=d,((i=d==null?void 0:d.response)==null?void 0:i.status)===403&&this.reauthFunc){const f=await this.reauthFunc();if(await this.connection.auth(f),!f.token)throw d;o=f.token;continue}throw(s=d.response)!=null&&s.data&&(d.responseData=d.response.data),d}}throw m(ur,r,"no error"),r}async getVersions(){const t=`${this.apiServer()}/versions`,r=(await this.request(t)).data.versions;return r.forEach(i=>{i.extra&&(i.extra=JSON.parse(i.extra))}),r}async getVersion(e){const o=`${this.apiServer()}/versions/${e}`,r=await this.request(o);return JSON.parse(r.data.data)}async getLatestVersion(){const t=`${this.apiServer()}/versions/latest`,o=await this.request(t);return JSON.parse(o.data.data)}async getVersionOps(e,t){let r=`${this.apiServer()}/versions/before/${e}?withOp=true`;t!==void 0&&t!==0&&(r+=`&from=${t}`);const i=await this.request(r),s=i.data.ops,l=TB.default(s,f=>!!f.create);let a=null;l!==-1&&(a=s[l],s.splice(0,l+1));let d;return a?(m(ur,a.create,"no createDoc.create"),d=a.create.data):d=JSON.parse(i.data.data),d.blocks||(d.blocks=[]),{doc:d,ops:i.data.ops}}async updateVersionExtra(e,t,o){const i=`${this.apiServer()}/versions/${e}/tags/${t}`;await this.request(i,{method:"post",data:{extra:JSON.stringify(o)}})}async revertVersion(e){const o=`${this.apiServer()}/versions/revert/${e}`;await this.request(o,{method:"post",data:{}})}async createVersion(e,t){const r=`${this.apiServer()}/versions`;return(await this.request(r,{method:"post",data:{publish:t,tag:e}})).data}async recognizeLink(e){const o=`${this.apiServer()}/resources/external/${ws(e)}`;return(await this.request(o)).data}buildResourceUrl(e,t){if(!e)return"";if(e.startsWith("https:")||e.startsWith("http:")||e.startsWith("file:")||e.startsWith("data:")||e.startsWith("blob:"))return e;let r=`${this.apiServer()}/resources/${encodeURIComponent(e)}`;const i=[];if(t!=null&&t.withToken&&i.push(`token=${this.getResourceToken()}`),t!=null&&t.downloadFileName&&i.push(`&fileName=${encodeURIComponent(t.downloadFileName)}`),i.length>0){const s=i.join("&");r+=`?${s}`}return r}}function MS(){return{blocks:[{id:K(),type:"text",text:[]}],comments:{},meta:{}}}const op=S("block-ids");class RS{constructor(){g(this,"ids",new Map)}onInsertBlock(e){const t=Array.from(this.ids.keys()).sort((r,i)=>i-r);for(let r=0;r<t.length;r++){const i=t[r];if(i>=e){const s=this.ids.get(i);m(op,s!==void 0,"old id is not exists"),this.ids.delete(i),this.ids.set(i+1,s)}}const o=K();this.ids.set(e,o)}onDeleteBlock(e){this.ids.delete(e);const t=Array.from(this.ids.keys()).sort((o,r)=>o-r);for(let o=0;o<t.length;o++){const r=t[o];if(r>e){const i=this.ids.get(r);m(op,i!==void 0,"old id is not exists"),this.ids.delete(r),this.ids.set(r-1,i)}}}getId(e){let t=this.ids.get(e);return t||(t=K(),this.ids.set(e,t)),t}getById(e){return Array.from(this.ids.entries()).find(([,t])=>t===e)}}class OS{constructor(){g(this,"ids",new Map)}getContainerIds(e){let t=this.ids.get(e);return t||(t=new RS,this.ids.set(e,t)),t}onInsertBlock(e,t){this.getContainerIds(e).onInsertBlock(t)}onDeleteBlock(e,t){this.getContainerIds(e).onDeleteBlock(t)}getBlockId(e,t){return this.getContainerIds(e).getId(t)}getBlockIndexById(e){const t=Array.from(this.ids.entries());for(let o=0;o<t.length;o++){const r=t[o],i=r[1].getById(e);if(i)return{containerId:r[0],blockIndex:i[0]}}return m(op,!1,"fault error: failed to get block index"),{containerId:"error",blockIndex:-1}}}class L7{constructor(e=new Set,t=new Map){this.deletedKeys=e,this.insertedValues=t}insert(e,t){this.insertedValues.set(e,t)}delete(e){this.deletedKeys.add(e)}toDocBlockDelta(){const e={};return this.insertedValues.forEach((t,o)=>{e[o]=t}),{insert:e,delete:Array.from(this.deletedKeys)}}}const Fh=S("op-parse-handler");class _S{constructor(e,t){g(this,"actions",[]);this.outerHandler=e,this.local=t}pushActions(e){if(!e.containerId){this.actions.push(e);return}const o={...e,containerId:(r=>r==="blocks"?"root":r)(e.containerId)};this.actions.push(o)}onDeleteBlock(e,t){this.pushActions({type:"deleteBlock",containerId:e,blockIndex:t})}onInsertBlock(e,t,o){this.pushActions({type:"insertBlock",containerId:e,blockIndex:t,data:o})}onDeleteBlockData(e,t,o){this.pushActions({type:"deleteBlockData",containerId:e,blockIndex:t,key:o})}onInsertBlockData(e,t,o,r){this.pushActions({type:"insertBlockData",containerId:e,blockIndex:t,key:o,value:r})}onUpdateBlockText(e,t,o){this.pushActions({type:"updateBlockText",containerId:e,blockIndex:t,richTextData:o})}onDeleteContainer(e){this.pushActions({type:"deleteContainer",containerId:e})}onCreateContainer(e,t){this.pushActions({type:"createContainer",containerId:e,data:t})}onDeleteComment(e){this.pushActions({type:"deleteComment",commentId:e})}onCreateComment(e){this.pushActions({type:"createComment",commentId:e})}onUpdateComment(e){this.pushActions({type:"updateComment",commentId:e})}end(){const e=this.actions,t=new Set,o=new Map,r=new OS,i=e.filter(s=>s.type==="deleteBlock"||s.type==="deleteBlockData");for(const s of i)if(s.type==="deleteBlock"){const l=s,a=r.getBlockId(l.containerId,l.blockIndex);r.onDeleteBlock(l.containerId,l.blockIndex);const d=o.get(a);d&&(Fh.debug(`ignore update object data before delete block: ${JSON.stringify(d)}`),o.delete(a));const f=`${l.containerId}-${l.blockIndex}`;t.add(f),this.outerHandler.onDeleteBlock(l.containerId,l.blockIndex,this.local)}else if(s.type==="deleteBlockData"){const l=s,a=`${l.containerId}-${l.blockIndex}`;if(t.has(a)){Fh.warn("delete block data after delete block, ignore it");continue}const d=r.getBlockId(l.containerId,l.blockIndex);let f=o.get(d);f||(f=new L7,o.set(d,f)),f.delete(l.key)}else m(Fh,!1,`invalid action type, ${s.type}`);this.actions.forEach(s=>{if(s.type==="deleteContainer"){const l=s;this.outerHandler.onDeleteContainer(l.containerId,this.local)}else if(s.type==="deleteComment"){const l=s;this.outerHandler.onDeleteComment(l.commentId,this.local)}}),this.actions.forEach(s=>{if(s.type==="createContainer"){const l=s;this.outerHandler.onCreateContainer(l.containerId,l.data,this.local)}}),this.actions.forEach(s=>{if(s.type==="insertBlock"){const l=s;this.outerHandler.onInsertBlock(l.containerId,l.blockIndex,l.data,this.local)}else if(s.type==="insertBlockData"){const l=s,a=r.getBlockId(l.containerId,l.blockIndex);let d=o.get(a);d||(d=new L7,o.set(a,d)),d.insert(l.key,l.value)}else if(s.type==="updateBlockText"){const l=s;this.outerHandler.onUpdateBlockText(l.containerId,l.blockIndex,l.richTextData,this.local)}else if(s.type==="createComment"){const l=s;this.outerHandler.onCreateComment(l.commentId,this.local)}else if(s.type==="updateComment"){const l=s;this.outerHandler.onUpdateComment(l.commentId,this.local)}}),Array.from(o.entries()).forEach(([s,l])=>{const{containerId:a,blockIndex:d}=r.getBlockIndexById(s);Fh.debug(`update block data: ${a}, ${d}, ${JSON.stringify(l.toDocBlockDelta())}`),this.outerHandler.onUpdateBlockData(a,d,l.toDocBlockDelta(),this.local)})}}const Rt=S("op-parser");class M7{}class rp{constructor(e){g(this,"key");this.key=e}}function PS(n,e,t){const o=e.concat(),r=o[0];if(typeof r!="number"||(o.shift(),o.length===1))return!1;const i=o[0];if(typeof i!="object"||!i.i||Object.keys(i).length!==1)return!1;for(let l=1;l<o.length;l++){const a=o[l];if(!Array.isArray(a)||a.length!==2||typeof a[0]!="string")return!1;const f=a[1];if(typeof f!="object"||f.i===void 0||Object.keys(f).length!==1)return!1}const s=i.i;m(Rt,s.id,"block id is required"),m(Rt,s.type,"block type is required");for(let l=1;l<o.length;l++){const a=o[l],d=a[0],f=a[1];s[d]=f.i}return t.onInsertBlock(n,r,s),!0}function ip(n,e,t,o){if(t==="upsert"&&PS(n,e,o))return;m(Rt,Array.isArray(e),`invalid block op: ${n}, ${JSON.stringify(e)}`);const r=e.concat(),i=r[0];r.shift();const s=[];for(;r.length>0;){const l=r[0];if(l==="text"){const a=r[1];if(m(Rt,typeof a=="object",`invalid block op: ${n}, ${JSON.stringify(e)}`),m(Rt,a.et==="rich-text",`invalid block op: ${n}, ${JSON.stringify(e)}`),r.splice(0,2),t==="upsert"){const f=a.e;o.onUpdateBlockText(n,i,f)}m(Rt,r.length===0,`invalid block ops.length !== 0, ${JSON.stringify(r)}`)}else if(Array.isArray(l)){m(Rt,l.length===2,`invalid block op: data.length !== 2, ${JSON.stringify(l)}`);const a=l[0];m(Rt,typeof a=="string",`invalid block op: key ${JSON.stringify(a)}`);const d=l[1];if(a==="text"){if(m(Rt,typeof d=="object",`invalid opData type, ${JSON.stringify(d)}`),d.i&&t==="upsert"&&o.onInsertBlockData(n,i,a,d.i),d.r&&t==="remove"&&o.onDeleteBlockData(n,i,a),d.et==="rich-text"&&t==="upsert"){const p=d.e;o.onUpdateBlockText(n,i,p)}}else t==="remove"&&d.r&&s.push(new rp(a)),t==="upsert"&&d.i&&o.onInsertBlockData(n,i,a,d.i);r.shift()}else if(typeof l=="object"){const a=l;t==="remove"&&a.r&&s.push(new M7),t==="upsert"&&a.i&&o.onInsertBlock(n,i,a.i),r.shift()}else{m(Rt,typeof l=="string","data is not string"),m(Rt,l!=="text","data !== 'text'"),m(Rt,r.length===2,`invalid block op: ops.length !== 2, ${JSON.stringify(r)}`);const a=l,d=r[1];t==="remove"&&d.r&&s.push(new rp(a)),t==="upsert"&&d.i&&o.onInsertBlockData(n,i,a,d.i),r.splice(0,2)}}s.reverse(),s.forEach(l=>{l instanceof M7?o.onDeleteBlock(n,i):l instanceof rp?o.onDeleteBlockData(n,i,l.key):m(Rt,!1,`invalid action type: ${typeof l}, ${JSON.stringify(l)}`)})}function FS(n,e,t){Rt.warn(`unsupported meta op, ${JSON.stringify(n)}`)}function NS(n,e,t){const o=n[1],r=n[2];m(Rt,o,`invalid comment op, no commentId: ${JSON.stringify(n)}`),m(Rt,r,`invalid comment op, no actions: ${JSON.stringify(n)}`),typeof r=="string"?Rt.error(`unknown comment op, ${JSON.stringify(n)}`):r.i&&r.r?e==="upsert"&&t.onUpdateComment(o):r.i?e==="upsert"&&t.onCreateComment(o):r.r?e==="remove"&&t.onDeleteComment(o):Rt.error(`unknown comment op, ${JSON.stringify(n)}`)}function sp(n,e,t){const o=n[0];if(Array.isArray(o)){o.forEach(s=>{sp(s,e,t)});return}const r=o;if(m(Rt,typeof r=="string",`invalid container id: ${JSON.stringify(n)}`),r==="meta"){FS(n);return}if(r==="comments"){NS(n,e,t);return}const i=r;if(Array.isArray(n[1]))e==="remove"?n.slice(1).reverse().forEach(s=>{ip(i,s,e,t)}):n.slice(1).forEach(s=>{ip(i,s,e,t)});else if(typeof n[1]=="object"){const s=n[1];s.r&&e==="remove"&&t.onDeleteContainer(i),s.i&&e==="upsert"&&t.onCreateContainer(i,s.i)}else m(Rt,typeof n[1]=="number",`invalid ops[1], not a number: ${JSON.stringify(n)}`),ip(i,n.slice(1),e,t)}function R7(n,e,t){const o=new _S(e,t);for(let r=0;r<2;r++){const i=r===0?"remove":"upsert",s=fe.default(n),l=s[0];Array.isArray(l)?s.forEach(a=>{sp(a,i,o)}):sp(s,i,o)}o.end()}const $S=S("sharedb-comments");function lp(n){const e=n.blocks;m($S,e,"no comment blocks");const t={blocks:{root:e},meta:{},comments:{}};return Object.entries(n).forEach(([o,r])=>{Array.isArray(r)&&(t.blocks[o]=r)}),fe.default(t)}function O7(n){const{id:e,groupId:t,userId:o,displayName:r,avatarUrl:i,abstract:s,created:l,modified:a}=n;return{id:e,groupId:t,userId:o,displayName:r,avatarUrl:i,abstract:s,created:l,modified:a}}function cp(n,e){const t=wD(e),{comments:o,meta:r,blocks:i,...s}=t,l={...n,blocks:i,...s},a=fe.default(l);return delete a.children,a}const ct=S("sharedb-doc/doc-container"),_7="ot-json1";Ld.type.registerSubtype(BD.type),Ld.type.name=_7,Ld.type.invert=null;class Qa extends ua{constructor(t,o,r=!0){super();g(this,"doc");g(this,"client");g(this,"localPresence");g(this,"remoteCaretHandler",new yD);g(this,"batching",0);g(this,"status","clean");g(this,"disableLogout");g(this,"destroyed",!1);g(this,"handleNothingPending",()=>{this.setStatus("clean")});g(this,"handleCreate",()=>{this.handleReload("doc created")});g(this,"handleDel",()=>{});g(this,"handleReload",t=>{this.callbacks.forEach(o=>{var r;return(r=o.onRequestReload)==null?void 0:r.call(o,t)})});g(this,"handleReset",async t=>{const o=new Error(`reset doc: ${t}`);o.code="ResetDoc",this.callbacks.forEach(r=>{var i;return(i=r.onError)==null?void 0:i.call(r,o)}),this.destroy()});g(this,"handleWriteConflictError",t=>{this.handleReset(`write conflict: ${t.message}, ${JSON.stringify(t.orgMsg)}`)});g(this,"insertObject",async(t,o,r)=>{const i=[t,o,{i:r}];return this.submitOp(i)});g(this,"deleteObject",async(t,o)=>{const r=[t,o,{r:!0}];return this.submitOp(r)});g(this,"replaceObject",async(t,o,r)=>{const i=[t,o,{r:!0,i:r}];return this.submitOp(i)});g(this,"updateObject",async(t,o,r)=>{const i=this.data()[t][o],s=[t,o];return Object.entries(r).forEach(([l,a])=>{if(!la.default(i[l],a))if(i[l]===void 0){if(a!=null){const d={i:a};s.push([l,d])}}else if(a==null){const d={r:!0};s.push([l,d])}else{const d={r:!0,i:a};s.push([l,d])}}),Object.entries(i).forEach(([l,a])=>{if((r[l]===void 0||r[l]===null)&&a!==void 0){const d={r:!0};s.push([l,d])}}),s.length<=2?Promise.resolve():this.submitOp(s)});g(this,"broadcastMessage",async t=>{const o={type:"custom",data:t,clientId:this.client.clientId};this.localPresence&&this.localPresence.submit(o)});g(this,"data",()=>this.doc.data);g(this,"submitOp",async t=>new Promise((o,r)=>{if(this.destroyed){ct.warn("submit op after destroyed");return}this.setStatus("dirty"),this.doc.submitOp(t,{},i=>{i?(ct.error(`invalid op, ${i.message}, ${JSON.stringify(t)}`),r(i),ct.error("Transform detected write conflict, reload editor"),this.handleReset("write conflict")):o()}),this.doc.data||(ct.error("no data after submit op, may be the submitted op is invalid"),this.handleReset(`invalid op, ${JSON.stringify(t)}`))}));g(this,"createDoc",async t=>new Promise((o,r)=>{this.doc.create(t,_7,i=>{i?r(i):o()})}));g(this,"submitInsertChildContainer",async(t,o)=>{const r=[Ni(t),{i:o}];return this.submitOp(r)});g(this,"submitDeleteChildContainer",async t=>{const o=[Ni(t),{r:!0}];return this.submitOp(o)});g(this,"submitInsertBlock",async(t,o,r)=>{const i=[Ni(t),o,{i:r}];return this.submitOp(i)});g(this,"submitDeleteBlock",async(t,o)=>{const r=[Ni(t),o,{r:!0}];return this.submitOp(r)});g(this,"submitUpdateBlockData",async(t,o,r)=>{if(r.delete.length===0&&Object.keys(r.insert).length===0)return Promise.resolve();const i=[Ni(t),o],s=new Set(r.delete);Object.entries(r.insert).forEach(([a,d])=>{if(s.has(a)){const f={r:!0,i:d};i.push([a,f])}});const l=new Set(Object.keys(r.insert));return r.delete.forEach(a=>{if(l.has(a))return;const d={r:!0};i.push([a,d])}),Object.entries(r.insert).forEach(([a,d])=>{if(s.has(a))return;const f={i:d};i.push([a,f])}),this.submitOp(i)});g(this,"submitUpdateRichText",async(t,o,r)=>{const i=[Ni(t),o,"text",{e:r,et:"rich-text"}];return this.submitOp(i)});g(this,"handleOp",(t,o,r)=>{if(this.destroyed){ct.warn("handleOp: destroyed");return}R7(t,this,!!o)});this.client=t,this.doc=o,this.doc.preventCompose=!0,this.disableLogout=r,this.registerCallback(this.remoteCaretHandler)}beginBatchUpdate(){return this.doc.preventCompose=!1,this.batching++,this.batching}endBatchUpdate(){return this.batching--,m(ct,this.batching>=0,"invalid call beginBatchUpdate/endBatchUpdate"),this.batching===0&&(this.doc.preventCompose=!0),this.batching}static async load(t){try{const o=new LS(t.auth,t.serverUrl,t.reauthFunc),r=await o.getDoc(),i=new Qa(o,r,t.disableLogout);if(r.type===null){if(t.autoCreateDoc===!1){const s=new Error("doc not exists");throw s.code="DocNotExists",s}await i.createDoc(t.templateData||MS())}return await i.initPresence(),await i.subscribe(),i.initEvents(),i}catch(o){throw ct.error(o),ct.error(`failed to load doc: ${JSON.stringify(o)}`),o}}setStatus(t){this.status!==t&&(this.status=t,this.callbacks.forEach(o=>{var r;return(r=o.onStatusChanged)==null?void 0:r.call(o,t)}))}initEvents(){this.doc.on("nothing pending",this.handleNothingPending),this.doc.on("create",this.handleCreate),this.doc.on("del",this.handleDel),this.client.onWriteConflictError(this.handleWriteConflictError)}clearEvents(){this.doc.off("nothing pending",this.handleNothingPending),this.doc.off("create",this.handleCreate),this.doc.off("del",this.handleDel)}initPresence(){return new Promise((t,o)=>{if(this.localPresence)t();else{const r=this.doc.connection.getPresence(`${this.doc.collection}:${this.doc.id}`);r.on("receive",(i,s)=>{this.onCustomMessage(s)}),r.subscribe(i=>{i?o(i):(this.localPresence=r.create(K()),t())})}})}subscribe(){return new Promise((t,o)=>{this.doc.subscribe(r=>{r?o(r):(this.doc.on("op",this.handleOp),t())})})}toJSON(){return Na(this.data())}getContainerBlocks(t){const o=this.data();m(ct,o,"no doc data");const r=o[Ni(t)];return m(ct,r,`no container data: ${t}`),fe.default(r)}getBlockData(t,o){const r=this.data();m(ct,r,"no doc data");const i=r[Ni(t)];m(ct,i,`no container data: ${t}`);const s=i[o];return m(ct,s,`no block data: ${o}`),fe.default(s)}localInsertBlock(t,o,r){return this.submitInsertBlock(t,o,r),this.getBlockData(t,o)}localDeleteBlock(t,o){const r=this.getBlockData(t,o);return this.submitDeleteBlock(t,o),r}localUpdateBlockText(t,o,r){const i=this.getBlockData(t,o);m(ct,i.text,"no block text");const s=fe.default(i.text);this.submitUpdateRichText(t,o,r);const l=ln.apply(s,r);return m(ct,l,"no block text"),l}localUpdateBlockData(t,o,r){const i=fe.default(this.getBlockData(t,o));return this.submitUpdateBlockData(t,o,r),i}localInsertChildContainer(t,o){this.submitInsertChildContainer(t,o)}localDeleteChildContainers(t){this.beginBatchUpdate(),t.forEach(o=>{this.submitDeleteChildContainer(o)}),this.endBatchUpdate()}getComments(){return Object.values(this.data().comments).map(o=>O7(o))}getComment(t){return this.data().comments[t]}getCommentDoc(t){const o=this.data().comments[t];return lp(o)}localCreateComment(t,o){const r=cp(t,o),s=["comments",r.id,{i:r}];return this.submitOp(s)}localDeleteComment(t){const o=["comments",t,{r:!0}];return this.submitOp(o)}localUpdateComment(t,o){const r=cp(t,o),i=["comments",t.id,{r:!0,i:r}];return this.submitOp(i)}destroy(){var t;this.destroyed=!0,this.clearEvents(),this.clearCallbacks(),this.doc.destroy(),(t=this.localPresence)==null||t.destroy(),this.client.close(!this.disableLogout),this.remoteCaretHandler.destroy()}onDeleteBlock(t,o,r){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(i=>{var s;return(s=i.onDeleteBlock)==null?void 0:s.call(i,Jl(t),o,r)})}onInsertBlock(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onInsertBlock)==null?void 0:l.call(s,Jl(t),o,r,i)})}onUpdateBlockData(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockData)==null?void 0:l.call(s,Jl(t),o,r,i)})}onUpdateBlockText(t,o,r,i){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(s=>{var l;return(l=s.onUpdateBlockText)==null?void 0:l.call(s,Jl(t),o,r,i)})}onDeleteContainer(t,o){m(ct,this.callbacks.length>0,"no callbacks"),m(ct,t!=="root","should not delete root container in doc"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteChildContainer)==null?void 0:i.call(r,Jl(t),o)})}onCreateContainer(t,o,r){m(ct,this.callbacks.length>0,"no callbacks"),m(ct,t!=="root","should not create root container in doc"),this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,Jl(t),o,r)})}onDeleteComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onDeleteComment)==null?void 0:i.call(r,t,o)})}onCreateComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onCreateComment)==null?void 0:i.call(r,t,o)})}onUpdateComment(t,o){m(ct,this.callbacks.length>0,"no callbacks"),this.callbacks.forEach(r=>{var i;return(i=r.onUpdateComment)==null?void 0:i.call(r,t,o)})}onCustomMessage(t){const o=t;(o==null?void 0:o.type)==="custom"&&(o==null?void 0:o.clientId)!==this.client.clientId?this.callbacks.forEach(r=>{var i;return(i=r.onCustomMessage)==null?void 0:i.call(r,o.data)}):(o==null?void 0:o.type)==="onlineUsers"&&setTimeout(()=>{const r={type:"custom",data:t,clientId:"-"};this.onCustomMessage(r)})}async addResources(t){return await this.client.getFileUrlsByHashes(t)}async uploadResource(t,o){var i;return{resourceId:await this.client.uploadResource(t,(i=o==null?void 0:o.onProgress)!=null?i:()=>{})}}buildResourceUrl(t,o){return this.client.buildResourceUrl(t,o)}request(t,o){return this.client.request(t,o)}getUser(){const t=this.client.clientId,{permission:o,userId:r,displayName:i,avatarUrl:s}=this.client.auth;return{permission:o,clientId:t,userId:r,displayName:i,avatarUrl:s,rainbowIndex:0}}getRemoteUsers(){return this.remoteCaretHandler.remoteUsers}getVersionHelper(){return this}getVersions(){return this.client.getVersions()}async getVersion(t){const o=await this.client.getVersion(t);return Na(o)}async getLatestVersion(){const t=await this.client.getLatestVersion();return Na(t)}async getHistoryData(t,o){const{doc:r,ops:i}=await this.client.getVersionOps(t,o),s=i.map(l=>({user:l.meta.createdBy,data:l}));return{doc:Na(r),historyData:s}}async getVersionData(t,o){const{doc:r,ops:i}=await this.client.getVersionOps(t,o);return{doc:Na(r),versionData:i}}async updateVersionExtra(t,o,r){await this.client.updateVersionExtra(t,o,r)}revertVersion(t){return this.client.revertVersion(t)}createVersion(t,o){return this.client.createVersion(t,o)}async recognizeLink(t){return this.client.recognizeLink(t)}parseHistoryData(t,o){R7(t.data.op,o,!0)}getServerMeta(){return{appId:this.client.auth.appId,docId:this.client.auth.docId,serverId:this.client.apiServer()}}}S("remote-cursor");class P7{constructor(e){g(this,"handleDocSelectionChange",()=>{this.broadcastCaretPos()});g(this,"broadcastCaretPos",qt.default(()=>{const e={type:"caret",userId:this.editor.doc.getUser().userId,range:this.editor.selection.range.toDocRange()};this.editor.doc.broadcastMessage(e)},300));g(this,"handleRemoteCaretsChanged",e=>{e.forEach(t=>{const o=this.editor.findBlockById(t);o&&this.editor.reloadBlock(o)})});this.editor=e,this.editor.addListener("selectionChanged",this.handleDocSelectionChange),this.editor.doc.getRemoteUsers().addListener("remote-carets-change",this.handleRemoteCaretsChanged)}destroy(){this.editor.removeListener("selectionChanged",this.handleDocSelectionChange),this.editor.doc.getRemoteUsers().removeListener("remote-carets-change",this.handleRemoteCaretsChanged)}}const F7=S("remote-cursor-decorator");class ap{decorateText(e,t,o){const r=e.doc.getRemoteUsers();if(!r)return{};const i=new Map,{containerId:s,blockIndex:l}=t[t.length-1];m(F7,typeof s=="string","invalid path containerId"),m(F7,typeof l=="number","invalid path blockIndex");const a=e.doc.getBlockData(s,l),d=rn(o);return r.getSimpleCursors(a.id).forEach((p,A)=>{A>d&&(A=d);const v=p.map(D=>({id:K(),type:"remote-cursor",name:D.user.displayName,time:D.time,rainbowIndex:D.user.rainbowIndex})),B=i.get(A);B?B.push(...v):i.set(A,v)}),{insertions:i}}}class N7 extends Dt.TypedEmitter{constructor(e){super(),this.editor=e,this.editor.doc.registerCallback(this)}handleChild(e,t,o){if(Xe(Fr(this.editor,e)))return;const r=this.editor.getBlockByIndex(e,t),i=re(this.editor.getContainerById(e));i&&this.emit("change",this.editor,i,r,o)}onUpdateBlockData(e,t){this.handleChild(e,t,"data-change")}onUpdateBlockText(e,t){this.handleChild(e,t,"text-change")}destroy(){this.editor.doc.unregisterCallback(this)}}function HS(n,e){n.addCustom("child-block-tracker",()=>new N7(n)).addListener("change",e)}function jS(n,e){n.addCustom("child-block-tracker",()=>new N7(n)).removeListener("change",e)}const Tte="",US={colorPalette:{colorDesc:"\u5B57\u4F53\u989C\u8272",backgroundDesc:"\u80CC\u666F\u989C\u8272",reset:"\u6062\u590D\u9ED8\u8BA4",name:"\u6587\u672C\u989C\u8272"},search:{emptyTips:"\u6682\u65E0\u641C\u7D22\u7ED3\u679C"}},zS={colorPalette:{colorDesc:"Text Color",name:"Text Color",backgroundDesc:"Background Color",reset:"Reset"},search:{emptyTips:"\u6682\u65E0\u641C\u7D22\u7ED3\u679C"}},VS={colorPalette:{colorDesc:"\u30D5\u30A9\u30F3\u30C8\u306E\u8272",backgroundDesc:"\u80CC\u666F\u8272",reset:"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u623B\u3059",name:"\u30C6\u30AD\u30B9\u30C8\u306E\u8272"},search:{emptyTips:"\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093"}};O.mergeLang({"zh-CN":US,"en-US":zS,"js-JP":VS});const Dte="";S("button");function ji(n,e,t,o,r){const i=w("button",["editor-button"],null);return i.setAttribute("data-button-id",n),r&&i.setAttribute(`data-editor-tooltip-${r}`,e),t?typeof t=="string"?t.startsWith("<")?i.innerHTML=t:i.innerText=t:i.appendChild(t):i.innerText=e,o&&(o.indexOf("checked")!==-1&&W(i,"checked"),o.indexOf("disabled")!==-1&&(i.disabled=!0)),i}function $7(n,e,t){t?n.setAttribute(`data-editor-tooltip-${t}`,e):n.innerText=e}const Ste="",ec=S("ui-command-bar-base"),WS={itemElementTag:"div",tippyArrow:!1},j2=class extends Dt.TypedEmitter{constructor(t,o,r){var i,s;super();g(this,"content");g(this,"items");g(this,"subBar",null);g(this,"parentItem",null);g(this,"closeable",null);g(this,"closeReason",null);g(this,"options");g(this,"id");g(this,"header",null);g(this,"footer",null);g(this,"handleDocumentKeydown",t=>{if(!!this.isVisible&&!t.isComposing&&!Ul(t.target)){if(this.subBar){this.subBar.handleDocumentKeydown(t);return}if(this.items.length!==0){if(t.key==="Escape"){this.close("cancelBar");return}if(t.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),t.preventDefault(),t.stopPropagation()}else if(t.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),t.preventDefault(),t.stopPropagation()}else if(t.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(t.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(t.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return;const r=this.items[o],i=this.getItemElementById(r.id);i&&this.emit("click",this,r,i)}}}});g(this,"handleDocumentMouseDown",t=>{if(t.target instanceof Element&&!this.isInCommandBar(t.target)){const o=this.listeners("closing");for(let r=0;r<o.length;r++)if(o[r](this,t)===!1)return;this.close("clickBackground")}});g(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),mC(this.id)});g(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&W(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&fC(this.id)});g(this,"lastEnterPauseTime",0);g(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});g(this,"handleItemMouseEnter",t=>{if(Date.now()-this.lastEnterPauseTime<100)return;const o=this.getParentCommandItemElement(t.target);if(!o)return;const r=this.getItemElementId(o),i=this.getItemById(r);if(this.selectItem(r),i.manualShowChildren)return;const s=i.childrenMenuId||"";this.showSubCommandBar(s)});g(this,"handleItemMouseLeave",t=>{var r,i;const o=this.getParentCommandItemElement(t.target);!o||((i=(r=this.subBar)==null?void 0:r.parentItem)==null?void 0:i.id)!==this.getItemElementId(o)&&(te(o,"selected"),this.emit("selectionChange",this,""))});g(this,"handleItemClick",t=>{const o=this.getParentCommandItemElement(t.target);if(!o)return;const r=this.getItemElementId(o),i=this.items.find(s=>s.id===r);if(!!i&&!(i.states&&i.states.indexOf("disabled")!==-1)){if(i.children&&i.children.length>0&&i.manualShowChildren){this.showSubCommandBar(i.childrenMenuId);return}i.element||(this.emit("click",this,i,o),this.options.autoClose&&this.close("clickItem"))}});g(this,"handleWheel",t=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const o=t.target;if(!o||!(o instanceof Node))return;const r=o instanceof HTMLElement?o:o.parentElement;if(!r)return;const i=wo(r);if(!Ke(this.content,i)){t.stopPropagation(),t.preventDefault();return}t.deltaY<0?i.scrollTop===0&&(t.stopPropagation(),t.preventDefault()):t.deltaY>0&&i.scrollTop+i.clientHeight>=i.scrollHeight&&(t.stopPropagation(),t.preventDefault())});this.id=(i=r==null?void 0:r.id)!=null?i:K(),this.options={...WS,...r},this.items=t,this.parentItem=(s=r==null?void 0:r.parentItem)!=null?s:null,this.closeable=o!=null?o:null,this.content=this.createCommandBarContent(t)}close(t){this.closeReason=t,this.subBar&&this.subBar.close(t),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(t,o){this.emit("click",this,t,o)}createPopperOptions(){var r,i;const t={modifiers:[]},o=this.options.overflowBoundary;return o&&((r=t==null?void 0:t.modifiers)==null||r.push({name:"flip",options:{boundary:o,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((i=t==null?void 0:t.modifiers)==null||i.push({name:"preventOverflow",options:{padding:this.options.padding}})),t}destroy(){var t;this.close(null),this.removeAllListeners(),(t=this.subBar)==null||t.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(t){var r;this.subBar&&t.findIndex(s=>{var l,a;return s.id===((a=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:a.id)})===-1&&((r=this.subBar)==null||r.destroy(),this.subBar=null),this.items=t;const o=this.createCommandBarContent(t);this.content.innerHTML="",Array.from(o.children).forEach(i=>{this.content.appendChild(i)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const t=this.getSelectedItem();return t?this.items.indexOf(t):-1}getPrevItemIndex(t){if(t<=0)return this.items.length-1;let o=t-1;for(;;){const r=this.items[o],i=r.type,l=!(r.states&&r.states.indexOf("disabled")!==-1);if(i!=="separator"&&i!=="section"&&l)return o;if(o-=1,o<=0)return this.items.length-1}}getNextItemIndex(t){let o=t+1;for(;;){if(!this.items[o])return this.getNextItemIndex(-1);const r=this.items[o],i=r.type,l=!(r.states&&r.states.indexOf("disabled")!==-1);if(i!=="separator"&&i!=="section"&&l)return o;if(o+=1,o>this.items.length-1)return 0}}clearSelectedItem(){const t=this.getSelectedItem();if(!t)return;const o=this.getItemElementById(t.id);o&&te(o,"selected")}selectItem(t){const o=this.getSelectedItem();if(o){if(o.id===t)return;const i=o.id,s=this.getItemElementById(i);s&&te(s,"selected")}const r=this.getItemElementById(t);r?(W(r,"selected"),this.emit("selectionChange",this,r.getAttribute("data-id")||""),r.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(t){var s,l;const o=this.getSelectedItem();if(!o)return;if(this.subBar){if(((s=this.subBar.parentItem)==null?void 0:s.id)===o.id){o.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!o.children)return;const r=this.getItemElementById(o.id);if(!r)return;const i=j2.createSubCommandBar(o,(l=this.closeable)!=null?l:this,t?{id:t}:{});this.subBar=i,this.subBar.on("click",(a,d,f)=>{this.emit("click",a,d,f)}),this.subBar.on("close",()=>{var a;(a=this.subBar)==null||a.destroy(),this.subBar=null,te(r,"active")}),o.beforePopup&&o.beforePopup(i),this.subBar.manualShow(r,this.getSubBarOptions(o)),W(r,"active")}isInCommandBar(t){if(!t||!(t instanceof Node))return!1;const o=this.getCommandBarRoot();return o&&Ke(o,t)||Ke(this.content,t)?!0:this.subBar?this.subBar.isInCommandBar(t):!1}createCommandItem(t){var i,s,l,a;let o=(i=this.options.itemElementTag)!=null?i:"div";t.element&&(o="div");const r=w(o,["command-item"],null);return r.setAttribute("data-id",t.id),t.type==="separator"?r.classList.add("separator"):t.type==="section"?(r.classList.add("section","text"),t.element&&(typeof t.element=="function"?r.appendChild(t.element(t)):r.appendChild(t.element))):((s=t.states)!=null&&s.includes("selected")&&r.classList.add("selected"),(l=t.states)!=null&&l.includes("checked")&&r.classList.add("checked"),(a=t.states)!=null&&a.includes("disabled")&&r.classList.add("disabled"),r.onclick=this.handleItemClick,r.onmouseenter=this.handleItemMouseEnter,r.onmouseleave=this.handleItemMouseLeave,t.element?typeof t.element=="function"?r.appendChild(t.element(t)):r.appendChild(t.element):r.classList.add("standard")),this.initItemElement(t,r),r}getItemById(t){const o=this.items.find(r=>r.id===t);return m(ec,o,`can not find command item for id: ${t}`),o}getSelectedItem(){const t=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(t){const o=this.getItemElementId(t),r=this.items.find(i=>i.id===o);return m(ec,r,`can not find command item for id: ${o}`),r}return null}getItemElementId(t){const o=t.getAttribute("data-id");return m(ec,o,"no data-id attribute"),o}getItemElementById(t){const o=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${t}"]`);return m(ec,o,`no exists command item, id=${t}`),o}getParentCommandItemElement(t){if(!t||!(t instanceof Element))return null;if(xe(t,"command-item"))return t;const o=t.closest(".command-item");return o||null}createCommandBarContent(t){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const o=w("div",["editor-command-bar-root"],null);if(this.options.header){const i=w("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&i.appendChild(s)}else this.header||i.appendChild(this.options.header);this.header=i,this.header&&o.appendChild(this.header)}const r=w("div",["editor-command-bar"],o);if(t.forEach(i=>{var l;const s=this.createCommandItem(i);r.appendChild(s),i.element&&i.setCloseable&&i.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const i=w("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&i.appendChild(s)}else this.footer||i.appendChild(this.options.footer);this.footer=i,this.footer&&o.appendChild(this.footer)}return(this.options.header||this.options.footer)&&W(o,"scrollable-bar"),this.initCommandBarElement(r),o.addEventListener("wheel",this.handleWheel,{passive:!1}),o}getSubBarOptions(t){var o;return{placement:(o=t.childrenPlacement)!=null?o:"right-start"}}static registerManualCommandBar(t,o){this.commandBarCreators.set(t,o)}static createSubCommandBar(t,o,r){var l;m(ec,t.children&&t.children.length>0,"no item children");const i=(l=t.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(i);return m(ec,s,`no creator for command type: ${i}`),s(t,o,r)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let Ui=j2;g(Ui,"commandBarCreators",new Map),S("ui-command-bar");class Nh extends Ui{constructor(){super(...arguments);g(this,"tippyInstance",null)}manualShow(t,o){var r,i;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=LB.default(t,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(r=o==null?void 0:o.placement)!=null?r:"bottom-start",maxWidth:650,arrow:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:o==null?void 0:o.theme,getReferenceClientRect:o==null?void 0:o.getReferenceClientRect,offset:(i=o==null?void 0:o.offset)!=null?i:[0,0],popperOptions:this.createPopperOptions()}),o!=null&&o.point){const{x:s,y:l}=o.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(s,l,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(t){var o;super.close(t),this.isVisible&&((o=this.tippyInstance)==null||o.hide())}destroy(){var t;(t=this.tippyInstance)==null||t.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var t,o;return(o=(t=this.tippyInstance)==null?void 0:t.state.isVisible)!=null?o:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const H7=S("ui-base");class Ya extends Nh{constructor(e,t){var i;const r=[{id:(i=t==null?void 0:t.id)!=null?i:`popup-${K()}`,name:"",element:e}];super(r,void 0,{disablePageScroll:!0})}initCommandBarElement(e){W(e,"popper")}initItemElement(e,t){}get popupContent(){const e=this.items[0];m(H7,e,"no dialog item");const t=typeof e.element=="function"?e.element(e):e.element;return m(H7,t,"no item element"),t}}const zi=S("filterable-list");function j7(n){var t,o;const e=w("div",["list-item"],null);return e.setAttribute("data-id",n.id),e.appendChild(w("div",["list-item-text"],null,n.name)),(t=n.states)!=null&&t.includes("selected")&&W(e,"selected"),(o=n.states)!=null&&o.includes("disabled")&&W(e,"disabled"),e}function U7(n){const e=w("div",["list-root"],null);return n.forEach(t=>{e.appendChild(j7(t))}),n.length||e.appendChild(j7({id:"placeholder",states:["disabled"],name:O.t("search.emptyTips")})),e}function z7(n,e){let t=n;return e&&(t=n.map(o=>({...o,states:o.id===e?["selected"]:void 0}))),t}function qS(n,e){const t=w("div",["filterable-list"],null),o=w("div",["filter"],t),r=w("div",["filter-container"],o),i=w("input",["filter-input"],r);e&&e.placeholder&&(i.placeholder=e.placeholder);const s=w("div",["list"],t),l=U7(z7(n,e==null?void 0:e.initialSelectedId));return s.appendChild(l),t}function V7(n,e,t){const o=n.querySelector(".list");m(zi,o,"no list root");const r=U7(z7(e,t)),i=o.querySelector(".list-root");if(m(zi,i,"no exists menu"),ma(i,r),t){const s=o.querySelector(".list-item.selected");s&&(m(zi,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class GS{constructor(e,t){g(this,"root");g(this,"visibleItems");g(this,"selectedId");g(this,"filter","");g(this,"onSelected",null);g(this,"handleKeydown",e=>{this.processKeyDown(e)});g(this,"handleInputChanged",()=>{const e=this.root.querySelector(".filter-input");m(zi,e,"no input");const t=e.value.toLocaleLowerCase();this.setFilter(t)});g(this,"handleClick",e=>{this.processClick(e)});var o;this.items=e,this.options=t,this.root=qS(e,t),this.bindEvents(),this.selectedId=(o=t==null?void 0:t.initialSelectedId)!=null?o:"",this.visibleItems=e}bindEvents(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.addEventListener("keyup",this.handleInputChanged),e.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.removeEventListener("keyup",this.handleInputChanged),e.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(e=>e.id===this.selectedId):-1}setSelectedId(e){this.selectedId=e,V7(this.root,this.visibleItems,e)}focus(){const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.focus()}reset(){this.setFilter("");const e=this.root.querySelector(".filter-input");m(zi,e,"no input"),e.value=""}setFilter(e){this.filter!==e&&(this.filter=e,this.visibleItems=this.items.filter(t=>t.name.toLocaleLowerCase().includes(e)),V7(this.root,this.visibleItems,this.selectedId))}processClick(e){var s,l;const t=e.target;if(!(t instanceof HTMLElement))return;const o=t.closest(".list-item");if(!o)return;const r=(s=o.getAttribute("data-id"))!=null?s:"",i=(l=this.visibleItems.find(a=>a.id===r))!=null?l:null;this.onSelected&&this.onSelected(this,i)}processKeyDown(e){var t;if(e.key==="ArrowUp"){let o=this.getSelectedIndex();o===-1?o=this.visibleItems.length-1:o>0&&(o-=1);let r="";o!==-1&&(r=this.visibleItems[o].id),this.setSelectedId(r);return}if(e.key==="ArrowDown"){let o=this.getSelectedIndex();o===-1?o=0:o<this.visibleItems.length-1&&(o+=1);let r="";o!==-1&&(r=this.visibleItems[o].id),this.setSelectedId(r);return}if(e.key==="Enter"){const o=(t=this.visibleItems.find(r=>r.id===this.selectedId))!=null?t:null;this.onSelected&&this.onSelected(this,o)}}}class ZS extends GS{constructor(t,o,r){super(t,r);g(this,"popup");g(this,"onShow",null);g(this,"onHide",null);g(this,"custom",null);g(this,"handleShow",()=>{this.onShow&&this.onShow(this)});g(this,"handleHide",()=>{this.onHide&&this.onHide(this)});g(this,"handleShown",()=>{this.focus()});this.popup=new Ya(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(t){this.reset(),this.popup.manualShow(t,{theme:"dropdown-list"}),this.focus()}processKeyDown(t){super.processKeyDown(t),(t.key==="Esc"||t.key==="Enter")&&this.popup.close("cancelBar")}processClick(t){super.processClick(t);const o=t.target;!(o instanceof HTMLElement)||!o.closest(".list-item")||this.popup.close("clickItem")}}const Lte="",Mte="";function QS(n,e){const t=document.createElement("div");t.classList.add("toast","show"),e!=null&&e.theme&&t.setAttribute("data-theme",e.theme),e!=null&&e.id&&t.setAttribute("data-id",e.id),e!=null&&e.html?t.innerHTML=n:t.textContent=n,e!=null&&e.position&&(t.style.left=`${e.position.x}px`,t.style.top=`${e.position.y}px`,t.classList.add("positioned")),document.body.appendChild(t),setTimeout(()=>{t.classList.remove("show"),setTimeout(()=>{t.remove()},500)},(e==null?void 0:e.duration)||3e3)}const W7=`<?xml version="1.0" ?>
28
28
  <svg
29
29
  fill="currentColor"
30
30
  xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">