@alxgrn/prose-editor 0.0.28 → 0.0.30
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/prose-editor.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(G,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom"),require("@alxgrn/telefrag-ui")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@alxgrn/telefrag-ui"],m):(G=typeof globalThis<"u"?globalThis:G||self,m(G.ProseEditor={},G.React,G.ReactDOM,G["@alxgrn/telefrag-ui"]))})(this,function(G,m,Ye,E){"use strict";var D0=Object.defineProperty;var O0=(G,m,Ye)=>m in G?D0(G,m,{enumerable:!0,configurable:!0,writable:!0,value:Ye}):G[m]=Ye;var j=(G,m,Ye)=>O0(G,typeof m!="symbol"?m+"":m,Ye);var ci=document.createElement("style");ci.textContent=`placeholder.ProseMirror-widget{display:flex;align-items:center;justify-content:center;margin:var(--alxgrn-unit) auto;border-radius:var(--alxgrn-unit-small);width:100%;height:200px;background-color:var(--alxgrn-logo-color-beige);font-style:normal;font-weight:400;font-size:var(--alxgrn-font-size)}placeholder.ProseMirror-widget:after{content:"Загрузка..."}div.carousel div.carousel-list span{display:block;scroll-snap-align:start;flex:0 0 auto;width:100%;margin:0}div.carousel placeholder.ProseMirror-widget{height:unset;aspect-ratio:16 / 9;margin:0}.MenuItem{display:flex;align-items:center;justify-content:center;cursor:pointer;padding:var(--alxgrn-unit-smallest)}.MenuItem.active{background:var(--alxgrn-bg-accent);border-radius:var(--alxgrn-unit-smallest)}.MenuItem.disabled{cursor:default;opacity:.3}.MenuBlock{flex:0 0 auto;display:flex;align-items:center;gap:var(--alxgrn-unit-small);border-right:1px solid var(--alxgrn-border);padding-right:var(--alxgrn-unit-small)}.MenuBlock:last-child{border-right:none;padding-right:0;flex:1 1 auto;justify-content:flex-end}.SimpleMenuBar{display:flex;align-items:center;gap:var(--alxgrn-unit-small);flex-wrap:wrap;padding:var(--alxgrn-unit-small)}.ProseMirror{position:relative;outline:none;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{-webkit-user-select:text;user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf;border-radius:var(--alxgrn-unit-small)}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;left:calc(-2px - var(--alxgrn-unit-double));right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none;border-radius:var(--alxgrn-unit-small)}.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:"";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor,.ProseViewer{display:block}.ProseViewer .unknown_node_type{display:block;color:red}.ProseNotes p:first-child,.ProseEditor p:first-child,.ProseViewer p:first-child{margin-top:0}.ProseNotes p:last-child,.ProseEditor p:last-child,.ProseViewer p:last-child{margin-bottom:0}.ProseNotes ul,.ProseEditor ul,.ProseViewer ul,.ProseNotes ol,.ProseEditor ol,.ProseViewer ol,.ProseNotes ul p,.ProseEditor ul p,.ProseViewer ul p,.ProseNotes ol p,.ProseEditor ol p,.ProseViewer ol p{margin:0;padding:0}.ProseNotes li,.ProseEditor li,.ProseViewer li{padding:0;margin:0;margin-left:var(--alxgrn-unit-double)}.ProseNotes blockquote,.ProseEditor blockquote,.ProseViewer blockquote{display:block;margin:0;border-left:var(--alxgrn-unit-small) solid var(--alxgrn-color-accent);margin:var(--alxgrn-unit) 0;padding:var(--alxgrn-unit-half);border-radius:var(--alxgrn-unit-small);background-color:var(--alxgrn-bg-accent)}.ProseNotes div.image,.ProseEditor div.image,.ProseViewer div.image,.ProseNotes div.video,.ProseEditor div.video,.ProseViewer div.video{display:block;margin:var(--alxgrn-unit) auto;text-align:center;position:relative}.ProseNotes div.image img,.ProseEditor div.image img,.ProseViewer div.image img{display:block;border-radius:var(--alxgrn-unit-small);max-width:100%;max-height:75vh;margin:0 auto}.ProseViewer div.image .image-title{font-style:italic;display:block;width:80%;margin:0 auto}.ProseViewer div.image img{cursor:pointer}.ProseViewer div.image:fullscreen{background-color:#000;border-radius:0;display:flex;justify-content:center;align-items:center}.ProseViewer div.image:fullscreen .image-title{display:none}.ProseViewer div.image:fullscreen img{border-radius:0;max-width:100%;max-height:100%}.ProseEditor div.image div.image-buttons{position:absolute;gap:var(--alxgrn-unit-half);top:0;right:0;width:auto;margin:var(--alxgrn-unit-half);display:flex;align-items:stretch;justify-content:stretch}.ProseEditor div.carousel div.carousel-buttons{z-index:10;position:absolute;gap:var(--alxgrn-unit-half);top:0;left:0;width:auto;margin:var(--alxgrn-unit-half);display:flex;align-items:stretch;justify-content:stretch}.ProseViewer div.image div.image-full,.ProseEditor div.image div.image-buttons div,.ProseEditor div.carousel div.carousel-buttons div{display:flex;align-items:center;justify-content:center;color:#fff;background-color:var(--alxgrn-color-light);border-radius:var(--alxgrn-unit-small);cursor:pointer;height:var(--alxgrn-unit-double);width:var(--alxgrn-unit-double);padding:0}.ProseViewer div.image div.image-full{position:absolute;top:var(--alxgrn-unit-half);right:var(--alxgrn-unit-half)}.ProseViewer div.image div.image-full:hover{background-color:var(--alxgrn-color-accent)}.ProseEditor div.image div.image-buttons div.text-button,.ProseEditor div.carousel div.carousel-buttons div.text-button{width:unset;padding:0 var(--alxgrn-unit-half);font-style:normal;font-weight:600;font-size:var(--alxgrn-font-size-small)}.ProseEditor div.image div.image-buttons div:hover,.ProseEditor div.carousel div.carousel-buttons div:hover{background-color:var(--alxgrn-color-accent)}.ProseNotes div.image div.image-buttons{display:none}.ProseNotes div.video iframe,.ProseEditor div.video iframe,.ProseViewer div.video iframe{display:block;border-radius:var(--alxgrn-unit-small);width:100%;aspect-ratio:16 / 9;border:none;margin:0 auto;background-color:var(--alxgrn-border)}.ProseViewer div.video:after{content:attr(title);font-style:italic;display:block;width:80%;margin:0 auto}.ProseNotes div.image>div,.ProseEditor div.image>div,.ProseNotes div.video>div,.ProseEditor div.video>div{font-style:italic;width:80%;margin:0 auto}.ProseNotes pre,.ProseEditor pre,.ProseViewer pre{white-space:pre-wrap;background-color:var(--alxgrn-bg-light);border-radius:var(--alxgrn-unit-small);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseViewer hr,.ProseEditor hr{display:block;border:none;border-top:1px solid var(--alxgrn-border);margin:var(--alxgrn-unit) 0}.ProseViewer table{width:100%;margin:var(--alxgrn-unit) 0;border-spacing:0}.ProseViewer th,.ProseViewer td{text-align:left;vertical-align:top;min-width:var(--alxgrn-unit);border-right:1px solid var(--alxgrn-border);border-bottom:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseViewer th{font-weight:700;text-align:center;vertical-align:middle;background-color:var(--alxgrn-bg-light)}.ProseViewer th:first-child,.ProseViewer td:first-child{border-left:1px solid var(--alxgrn-border)}.ProseViewer tr:first-child>th,.ProseViewer tr:first-child>td{border-top:1px solid var(--alxgrn-border)}.ProseViewer tr:first-child>th:first-child,.ProseViewer tr:first-child>td:first-child{border-top-left-radius:var(--alxgrn-unit-small)}.ProseViewer tr:first-child>th:last-child,.ProseViewer tr:first-child>td:last-child{border-top-right-radius:var(--alxgrn-unit-small)}.ProseViewer tr:last-child>th:first-child,.ProseViewer tr:last-child>td:first-child{border-bottom-left-radius:var(--alxgrn-unit-small)}.ProseViewer tr:last-child>th:last-child,.ProseViewer tr:last-child>td:last-child{border-bottom-right-radius:var(--alxgrn-unit-small)}.ProseNotes{display:flex;gap:var(--alxgrn-unit-half);flex-direction:column}.ProseNotesContent{border:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small);border-radius:var(--alxgrn-unit-small)}.ProseNotesTitle,.ProseNotesTitle:focus{width:100%;color:var(--alxgrn-color-text);border:1px solid var(--alxgrn-border);border-radius:var(--alxgrn-unit-small);background-color:transparent;outline:none;padding:var(--alxgrn-unit-half);font-size:var(--alxgrn-font-size)}.ProseNotesTitle::placeholder{color:var(--alxgrn-color-text);opacity:.5;font-style:italic}.ProseNotes .ProseMirror{overflow:auto;min-height:20vh;max-height:45vh;padding:var(--alxgrn-unit-small);padding-right:var(--alxgrn-unit-half);margin-top:var(--alxgrn-unit-small)}.ProseNotesButtons{display:flex;gap:var(--alxgrn-unit);align-items:center;justify-content:flex-end}.ProseNotes .ProseMirror::-webkit-scrollbar{width:var(--alxgrn-unit-small);height:var(--alxgrn-unit-small)}.ProseNotes .ProseMirror::-webkit-scrollbar-track{background-color:transparent;border-radius:var(--alxgrn-unit-small)}.ProseNotes .ProseMirror::-webkit-scrollbar-thumb{background-color:var(--alxgrn-color-scroll);border-radius:var(--alxgrn-unit-small);cursor:default}.ProseNotes .ProseMirror::-webkit-scrollbar-corner{background-color:transparent}.MenuBar{display:flex;align-items:center;gap:var(--alxgrn-unit-small);flex-wrap:wrap;border:none;border-bottom:2px solid var(--alxgrn-color-text)!important;position:sticky;top:var(--alxgrn-layout-header-height);background-color:var(--alxgrn-bg-panel);z-index:100;padding:var(--alxgrn-unit-half) 0}.ProseMirror .tableWrapper,.ProseMirror .table-wrapper{overflow:hidden;margin:var(--alxgrn-unit) 0}.ProseMirror .table-resizer{height:var(--alxgrn-unit);position:relative;margin-left:var(--alxgrn-unit)}.ProseMirror .table-resizer div{top:0;height:100%;width:5px;border:1px solid var(--alxgrn-bg-panel);position:absolute;background-color:var(--alxgrn-border);cursor:ew-resize;cursor:col-resize;z-index:100;border-top-left-radius:3px;border-top-right-radius:3px}.ProseMirror .table-resizer div:last-child{display:none}.ProseMirror table{position:relative;border-collapse:collapse;table-layout:fixed;width:calc(100% - var(--alxgrn-unit));margin-left:var(--alxgrn-unit)}.ProseMirror td,.ProseMirror th{text-align:left;vertical-align:top;box-sizing:border-box;position:relative;min-width:1em;border:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseMirror th{font-weight:700;text-align:center;vertical-align:middle;background-color:var(--alxgrn-bg-light)}.ProseMirror td:not([data-colwidth]):not(.column-resize-dragging),.ProseMirror th:not([data-colwidth]):not(.column-resize-dragging){min-width:var(--default-cell-min-width)}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}.ProseMirror.resize-cursor{cursor:ew-resize;cursor:col-resize}.ProseMirror .selectedCell{background-color:#adf}.ProseMirror table caption{position:absolute;top:calc(-1 * var(--alxgrn-unit));left:calc(-1 * var(--alxgrn-unit));display:flex;align-items:center;justify-content:center;padding:0;border:none;width:var(--alxgrn-unit);height:var(--alxgrn-unit);font-size:var(--alxgrn-font-size-small);cursor:pointer;color:var(--alxgrn-color-light);background-color:transparent}.ProseMirror table caption:hover{color:var(--alxgrn-color-accent)}.ProseMirror table tbody tr th:first-child:after,.ProseMirror table tbody tr td:first-child:after{content:" ";display:block;background-color:var(--alxgrn-border);position:absolute;top:0;bottom:0;right:100%;width:var(--alxgrn-unit);border-top-left-radius:var(--alxgrn-unit-small);border-bottom-left-radius:var(--alxgrn-unit-small);cursor:pointer}.ProseMirror table tbody tr:last-child th:first-child:after,.ProseMirror table tbody tr:last-child td:first-child:after{bottom:-1px}.ProseMirror table tbody tr:first-child th:before,.ProseMirror table tbody tr:first-child td:before{content:" ";display:block;background-color:var(--alxgrn-border);position:absolute;left:2px;right:2px;bottom:100%;height:var(--alxgrn-unit);border-top-left-radius:var(--alxgrn-unit-small);border-top-right-radius:var(--alxgrn-unit-small);cursor:pointer}.ProseMirror table tbody tr:first-child th:first-child:before,.ProseMirror table tbody tr:first-child td:first-child:before{left:0}.ProseMirror table tbody tr:first-child th:last-child:before,.ProseMirror table tbody tr:first-child td:last-child:before{right:-1px}.ProseMirror table tr .col-menu:hover,.ProseMirror table tr .row-menu:hover{background-color:var(--alxgrn-color-text)}div.carousel{width:100%;position:relative;text-align:center;margin:var(--alxgrn-unit) 0;border-radius:var(--alxgrn-unit-small);overflow:hidden;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.carousel:fullscreen{display:flex;border-radius:0;background-color:#000;justify-content:center;align-items:center}div.carousel div.carousel-numb,div.carousel div.carousel-full,div.carousel div.carousel-prev,div.carousel div.carousel-next{position:absolute;top:calc(50% - var(--alxgrn-unit));left:var(--alxgrn-unit-half);height:var(--alxgrn-unit-double);width:var(--alxgrn-unit-double);color:#fff;background-color:var(--alxgrn-color-light);cursor:pointer;border-radius:var(--alxgrn-unit-small);display:flex;justify-content:center;align-items:center}div.carousel div.carousel-next{left:unset;right:var(--alxgrn-unit-half)}div.carousel div.carousel-numb{top:var(--alxgrn-unit-half);font-size:var(--alxgrn-font-size-small);font-weight:600;font-style:normal;padding:0 var(--alxgrn-unit-half);width:unset}div.carousel div.carousel-full{top:var(--alxgrn-unit-half);left:unset;right:var(--alxgrn-unit-half)}div.carousel:hover div.carousel-numb:hover,div.carousel:hover div.carousel-full:hover,div.carousel:hover div.carousel-prev:hover,div.carousel:hover div.carousel-next:hover{background-color:var(--alxgrn-color-accent)}div.carousel div.carousel-list{display:flex;align-items:center;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}div.carousel div.carousel-list div.image{scroll-snap-align:start;flex:0 0 auto;width:100%;margin:0}div.carousel:fullscreen div.carousel-list div.image .image-title{display:none}div.carousel:fullscreen div.carousel-list div.image img{border-radius:0;max-width:100%;max-height:100%}div.carousel div.carousel-list::-webkit-scrollbar{width:0;height:0}div.carousel div.carousel-list::-webkit-scrollbar-thumb{border:none;background:transparent}div.carousel div.carousel-list::-webkit-scrollbar-track{border:none;background:transparent}
|
|
1
|
+
(function(G,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-dom"),require("@alxgrn/telefrag-ui")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","@alxgrn/telefrag-ui"],m):(G=typeof globalThis<"u"?globalThis:G||self,m(G.ProseEditor={},G.React,G.ReactDOM,G["@alxgrn/telefrag-ui"]))})(this,function(G,m,Ye,E){"use strict";var D0=Object.defineProperty;var O0=(G,m,Ye)=>m in G?D0(G,m,{enumerable:!0,configurable:!0,writable:!0,value:Ye}):G[m]=Ye;var j=(G,m,Ye)=>O0(G,typeof m!="symbol"?m+"":m,Ye);var ci=document.createElement("style");ci.textContent=`placeholder.ProseMirror-widget{display:flex;align-items:center;justify-content:center;margin:var(--alxgrn-unit) auto;border-radius:var(--alxgrn-unit-small);width:100%;height:200px;background-color:var(--alxgrn-logo-color-beige);font-style:normal;font-weight:400;font-size:var(--alxgrn-font-size)}placeholder.ProseMirror-widget:after{content:"Загрузка..."}div.carousel div.carousel-list span{display:block;scroll-snap-align:start;flex:0 0 auto;width:100%;margin:0}div.carousel placeholder.ProseMirror-widget{height:unset;aspect-ratio:16 / 9;margin:0}.MenuItem{display:flex;align-items:center;justify-content:center;cursor:pointer;padding:var(--alxgrn-unit-smallest)}.MenuItem.active{background:var(--alxgrn-bg-accent);border-radius:var(--alxgrn-unit-smallest)}.MenuItem.disabled{cursor:default;opacity:.3}.MenuBlock{flex:0 0 auto;display:flex;align-items:center;gap:var(--alxgrn-unit-small);border-right:1px solid var(--alxgrn-border);padding-right:var(--alxgrn-unit-small)}.MenuBlock:last-child{border-right:none;padding-right:0;flex:1 1 auto;justify-content:flex-end}.SimpleMenuBar{display:flex;align-items:center;gap:var(--alxgrn-unit-small);flex-wrap:wrap;padding:var(--alxgrn-unit-small)}.ProseMirror{position:relative;outline:none;word-wrap:break-word;white-space:pre-wrap;white-space:break-spaces;-webkit-font-variant-ligatures:none;font-variant-ligatures:none;font-feature-settings:"liga" 0}.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{-webkit-user-select:text;user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf;border-radius:var(--alxgrn-unit-small)}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;left:calc(-2px - var(--alxgrn-unit-double));right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none;border-radius:var(--alxgrn-unit-small)}.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:"";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor,.ProseViewer{display:block}.ProseViewer .unknown_node_type{display:block;color:red}.ProseNotes p:first-child,.ProseEditor p:first-child,.ProseViewer p:first-child{margin-top:0}.ProseNotes p:last-child,.ProseEditor p:last-child,.ProseViewer p:last-child{margin-bottom:0}.ProseNotes ul,.ProseEditor ul,.ProseViewer ul,.ProseNotes ol,.ProseEditor ol,.ProseViewer ol,.ProseNotes ul p,.ProseEditor ul p,.ProseViewer ul p,.ProseNotes ol p,.ProseEditor ol p,.ProseViewer ol p{margin:0;padding:0}.ProseNotes li,.ProseEditor li,.ProseViewer li{padding:0;margin:0;margin-left:var(--alxgrn-unit-double)}.ProseNotes blockquote,.ProseEditor blockquote,.ProseViewer blockquote{display:block;margin:0;border-left:var(--alxgrn-unit-small) solid var(--alxgrn-color-accent);margin:var(--alxgrn-unit) 0;padding:var(--alxgrn-unit-half);border-radius:var(--alxgrn-unit-small);background-color:var(--alxgrn-bg-accent)}.ProseNotes div.image,.ProseEditor div.image,.ProseViewer div.image,.ProseNotes div.video,.ProseEditor div.video,.ProseViewer div.video{display:block;margin:var(--alxgrn-unit) auto;text-align:center;position:relative}.ProseNotes div.image img,.ProseEditor div.image img,.ProseViewer div.image img{display:block;border-radius:var(--alxgrn-unit-small);max-width:100%;max-height:75vh;margin:0 auto}.ProseViewer div.image .image-title{font-style:italic;display:block;width:80%;margin:0 auto}.ProseViewer div.image img{cursor:pointer}.ProseViewer div.image:fullscreen{background-color:#000;border-radius:0;display:flex;justify-content:center;align-items:center}.ProseViewer div.image:fullscreen .image-title{display:none}.ProseViewer div.image:fullscreen img{border-radius:0;max-width:100%;max-height:100%}.ProseEditor div.image div.image-buttons{position:absolute;gap:var(--alxgrn-unit-half);top:0;right:0;width:auto;margin:var(--alxgrn-unit-half);display:flex;align-items:stretch;justify-content:stretch}.ProseEditor div.carousel div.carousel-buttons{z-index:10;position:absolute;gap:var(--alxgrn-unit-half);top:0;left:0;width:auto;margin:var(--alxgrn-unit-half);display:flex;align-items:stretch;justify-content:stretch}.ProseViewer div.image div.image-full,.ProseEditor div.image div.image-buttons div,.ProseEditor div.carousel div.carousel-buttons div{display:flex;align-items:center;justify-content:center;color:#fff;background-color:var(--alxgrn-color-light);border-radius:var(--alxgrn-unit-small);cursor:pointer;height:var(--alxgrn-unit-double);width:var(--alxgrn-unit-double);padding:0}.ProseViewer div.image div.image-full{position:absolute;top:var(--alxgrn-unit-half);right:var(--alxgrn-unit-half)}.ProseViewer div.image div.image-full:hover{background-color:var(--alxgrn-color-accent)}.ProseEditor div.image div.image-buttons div.text-button,.ProseEditor div.carousel div.carousel-buttons div.text-button{width:unset;padding:0 var(--alxgrn-unit-half);font-style:normal;font-weight:600;font-size:var(--alxgrn-font-size-small)}.ProseEditor div.image div.image-buttons div:hover,.ProseEditor div.carousel div.carousel-buttons div:hover{background-color:var(--alxgrn-color-accent)}.ProseNotes div.image div.image-buttons{display:none}.ProseNotes div.video iframe,.ProseEditor div.video iframe,.ProseViewer div.video iframe{display:block;border-radius:var(--alxgrn-unit-small);width:100%;aspect-ratio:16 / 9;border:none;margin:0 auto;background-color:var(--alxgrn-border)}.ProseViewer div.video:after{content:attr(title);font-style:italic;display:block;width:80%;margin:0 auto}.ProseNotes div.image>div,.ProseEditor div.image>div,.ProseNotes div.video>div,.ProseEditor div.video>div{font-style:italic;width:80%;margin:0 auto}.ProseNotes pre,.ProseEditor pre,.ProseViewer pre{white-space:pre-wrap;background-color:var(--alxgrn-bg-light);border-radius:var(--alxgrn-unit-small);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseViewer hr,.ProseEditor hr{display:block;border:none;border-top:1px solid var(--alxgrn-border);margin:var(--alxgrn-unit) 0}.ProseViewer table{width:100%;margin:var(--alxgrn-unit) 0;border-spacing:0}.ProseViewer th,.ProseViewer td{text-align:left;vertical-align:top;min-width:var(--alxgrn-unit);border-right:1px solid var(--alxgrn-border);border-bottom:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseViewer th{font-weight:700;text-align:center;vertical-align:middle;background-color:var(--alxgrn-bg-light)}.ProseViewer th:first-child,.ProseViewer td:first-child{border-left:1px solid var(--alxgrn-border)}.ProseViewer tr:first-child>th,.ProseViewer tr:first-child>td{border-top:1px solid var(--alxgrn-border)}.ProseViewer tr:first-child>th:first-child,.ProseViewer tr:first-child>td:first-child{border-top-left-radius:var(--alxgrn-unit-small)}.ProseViewer tr:first-child>th:last-child,.ProseViewer tr:first-child>td:last-child{border-top-right-radius:var(--alxgrn-unit-small)}.ProseViewer tr:last-child>th:first-child,.ProseViewer tr:last-child>td:first-child{border-bottom-left-radius:var(--alxgrn-unit-small)}.ProseViewer tr:last-child>th:last-child,.ProseViewer tr:last-child>td:last-child{border-bottom-right-radius:var(--alxgrn-unit-small)}.ProseNotes{display:flex;gap:var(--alxgrn-unit-half);flex-direction:column}.ProseNotesContent{border:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small);border-radius:var(--alxgrn-unit-small)}.ProseNotesTitle,.ProseNotesTitle:focus{width:100%;color:var(--alxgrn-color-text);border:1px solid var(--alxgrn-border);border-radius:var(--alxgrn-unit-small);background-color:transparent;outline:none;padding:var(--alxgrn-unit-half);font-size:var(--alxgrn-font-size)}.ProseNotesTitle::placeholder{color:var(--alxgrn-color-text);opacity:.5;font-style:italic}.ProseNotes .ProseMirror{overflow:auto;min-height:20vh;max-height:45vh;padding:var(--alxgrn-unit-small);padding-right:var(--alxgrn-unit-half);margin-top:var(--alxgrn-unit-small)}.ProseNotesButtons{display:flex;gap:var(--alxgrn-unit);align-items:center;justify-content:flex-end}.ProseNotes .ProseMirror::-webkit-scrollbar{width:var(--alxgrn-unit-small);height:var(--alxgrn-unit-small)}.ProseNotes .ProseMirror::-webkit-scrollbar-track{background-color:transparent;border-radius:var(--alxgrn-unit-small)}.ProseNotes .ProseMirror::-webkit-scrollbar-thumb{background-color:var(--alxgrn-color-scroll);border-radius:var(--alxgrn-unit-small);cursor:default}.ProseNotes .ProseMirror::-webkit-scrollbar-corner{background-color:transparent}.MenuBar{display:flex;align-items:center;gap:var(--alxgrn-unit-small);flex-wrap:wrap;border:none;border-bottom:2px solid var(--alxgrn-color-text)!important;position:sticky;top:var(--alxgrn-layout-header-height);background-color:var(--alxgrn-bg-panel);z-index:100;padding:var(--alxgrn-unit-half) 0}.ProseMirror .tableWrapper,.ProseMirror .table-wrapper{overflow:hidden;margin:var(--alxgrn-unit) 0}.ProseMirror .table-resizer{height:var(--alxgrn-unit);position:relative;margin-left:var(--alxgrn-unit)}.ProseMirror .table-resizer div{top:0;height:100%;width:7px;position:absolute;background-color:transparent;cursor:ew-resize;cursor:col-resize;z-index:100}.ProseMirror .table-resizer div:last-child{display:none}.ProseMirror table{position:relative;border-collapse:collapse;table-layout:fixed;width:calc(100% - var(--alxgrn-unit));margin-left:var(--alxgrn-unit)}.ProseMirror td,.ProseMirror th{text-align:left;vertical-align:top;box-sizing:border-box;position:relative;min-width:1em;border:1px solid var(--alxgrn-border);padding:var(--alxgrn-unit-small) var(--alxgrn-unit-half)}.ProseMirror th{font-weight:700;text-align:center;vertical-align:middle;background-color:var(--alxgrn-bg-light)}.ProseMirror td:not([data-colwidth]):not(.column-resize-dragging),.ProseMirror th:not([data-colwidth]):not(.column-resize-dragging){min-width:var(--default-cell-min-width)}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}.ProseMirror.resize-cursor{cursor:ew-resize;cursor:col-resize}.ProseMirror .selectedCell{background-color:#adf}.ProseMirror table caption{position:absolute;top:calc(-1 * var(--alxgrn-unit));left:calc(-1 * var(--alxgrn-unit));display:flex;align-items:center;justify-content:center;padding:0;border:none;width:var(--alxgrn-unit);height:var(--alxgrn-unit);font-size:var(--alxgrn-font-size-small);cursor:pointer;color:var(--alxgrn-color-light);background-color:transparent}.ProseMirror table caption:hover{color:var(--alxgrn-color-accent)}.ProseMirror table tbody tr th:first-child:after,.ProseMirror table tbody tr td:first-child:after{content:" ";display:block;background-color:var(--alxgrn-border);position:absolute;top:0;bottom:0;right:100%;width:var(--alxgrn-unit);border-top-left-radius:var(--alxgrn-unit-small);border-bottom-left-radius:var(--alxgrn-unit-small);cursor:pointer}.ProseMirror table tbody tr:last-child th:first-child:after,.ProseMirror table tbody tr:last-child td:first-child:after{bottom:-1px}.ProseMirror table tbody tr:first-child th:before,.ProseMirror table tbody tr:first-child td:before{content:" ";display:block;background-color:var(--alxgrn-border);position:absolute;left:0;right:0;bottom:100%;height:var(--alxgrn-unit);border-top-left-radius:var(--alxgrn-unit-small);border-top-right-radius:var(--alxgrn-unit-small);cursor:pointer}.ProseMirror table tbody tr:first-child th:first-child:before,.ProseMirror table tbody tr:first-child td:first-child:before{left:0}.ProseMirror table tbody tr:first-child th:last-child:before,.ProseMirror table tbody tr:first-child td:last-child:before{right:-1px}.ProseMirror table tr .col-menu:hover,.ProseMirror table tr .row-menu:hover{background-color:var(--alxgrn-color-text)}div.carousel{width:100%;position:relative;text-align:center;margin:var(--alxgrn-unit) 0;border-radius:var(--alxgrn-unit-small);overflow:hidden;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.carousel:fullscreen{display:flex;border-radius:0;background-color:#000;justify-content:center;align-items:center}div.carousel div.carousel-numb,div.carousel div.carousel-full,div.carousel div.carousel-prev,div.carousel div.carousel-next{position:absolute;top:calc(50% - var(--alxgrn-unit));left:var(--alxgrn-unit-half);height:var(--alxgrn-unit-double);width:var(--alxgrn-unit-double);color:#fff;background-color:var(--alxgrn-color-light);cursor:pointer;border-radius:var(--alxgrn-unit-small);display:flex;justify-content:center;align-items:center}div.carousel div.carousel-next{left:unset;right:var(--alxgrn-unit-half)}div.carousel div.carousel-numb{top:var(--alxgrn-unit-half);font-size:var(--alxgrn-font-size-small);font-weight:600;font-style:normal;padding:0 var(--alxgrn-unit-half);width:unset}div.carousel div.carousel-full{top:var(--alxgrn-unit-half);left:unset;right:var(--alxgrn-unit-half)}div.carousel:hover div.carousel-numb:hover,div.carousel:hover div.carousel-full:hover,div.carousel:hover div.carousel-prev:hover,div.carousel:hover div.carousel-next:hover{background-color:var(--alxgrn-color-accent)}div.carousel div.carousel-list{display:flex;align-items:center;overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}div.carousel div.carousel-list div.image{scroll-snap-align:start;flex:0 0 auto;width:100%;margin:0}div.carousel:fullscreen div.carousel-list div.image .image-title{display:none}div.carousel:fullscreen div.carousel-list div.image img{border-radius:0;max-width:100%;max-height:100%}div.carousel div.carousel-list::-webkit-scrollbar{width:0;height:0}div.carousel div.carousel-list::-webkit-scrollbar-thumb{border:none;background:transparent}div.carousel div.carousel-list::-webkit-scrollbar-track{border:none;background:transparent}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(ci);function gf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var co={exports:{}},Cn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -62,5 +62,5 @@ Check the top-level render call using <`+x+">."),v}var M=m,O=Symbol.for("react.t
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var Du;function nb(){return Du||(Du=1,process.env.NODE_ENV!=="production"&&function(){function n(s){var i=s,l=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,i.flags&4098&&(l=i.return),s=i.return;while(s)}return i.tag===3?l:null}function e(s){if(n(s)!==s)throw Error("Unable to find node on an unmounted component.")}function t(s){var i=s.alternate;if(!i){if(i=n(s),i===null)throw Error("Unable to find node on an unmounted component.");return i!==s?null:s}for(var l=s,a=i;;){var c=l.return;if(c===null)break;var u=c.alternate;if(u===null){if(a=c.return,a!==null){l=a;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===l)return e(c),s;if(u===a)return e(c),i;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(l.return!==a.return)l=c,a=u;else{for(var f=!1,d=c.child;d;){if(d===l){f=!0,l=c,a=u;break}if(d===a){f=!0,a=c,l=u;break}d=d.sibling}if(!f){for(d=u.child;d;){if(d===l){f=!0,l=u,a=c;break}if(d===a){f=!0,a=u,l=c;break}d=d.sibling}if(!f)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(l.alternate!==a)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(l.tag!==3)throw Error("Unable to find node on an unmounted component.");return l.stateNode.current===l?s:i}function r(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=r(s),i!==null)return i;s=s.sibling}return null}function o(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(s.tag!==4&&(i=o(s),i!==null))return i;s=s.sibling}return null}ve.doesFiberContain=function(s,i){for(var l=s.alternate;i!==null;){if(i===s||i===l)return!0;i=i.return}return!1},ve.findCurrentFiberUsingSlowPath=t,ve.findCurrentHostFiber=function(s){return s=t(s),s!==null?r(s):null},ve.findCurrentHostFiberWithNoPortals=function(s){return s=t(s),s!==null?o(s):null},ve.getContainerFromFiber=function(s){return s.tag===3?s.stateNode.containerInfo:null},ve.getNearestMountedFiber=n,ve.getSuspenseInstanceFromFiber=function(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null},ve.isFiberMounted=function(s){return n(s)===s},ve.isFiberSuspenseAndTimedOut=function(s){var i=s.memoizedState;return s.tag===13&&i!==null&&i.dehydrated===null},ve.isMounted=function(s){return(s=s._reactInternals)?n(s)===s:!1}}()),ve}process.env.NODE_ENV==="production"?Us.exports=tb():Us.exports=nb();var rb=Us.exports;function ob(n){return n._reactInternals}function P0(n){return n}function sb(n){const e=ob(n);if(e===void 0){if(typeof n.render=="function")throw new Error("Unable to find node on an unmounted component.");{const r=Object.keys(n).join(",");throw new Error(`Argument appears to not be a ReactComponent. Keys: ${r}`)}}const t=rb.findCurrentHostFiber(e);return t===null?null:t.stateNode}function ib(n){return sb(n)}function lb(n,e){if(n===e)return!0;if(!n||!e)return!1;const t=Object.keys(n),r=Object.keys(e),o=t.length;if(r.length!==o)return!1;for(let s=0;s<o;s++){const i=t[s];if(n[i]!==e[i]||!Object.prototype.hasOwnProperty.call(e,i))return!1}return!0}class ab extends m.Component{constructor(){super(...arguments);j(this,"viewDescRef",null);j(this,"renderRef",null)}updateEffect(){const{view:t,decorations:r,siblingsRef:o,parentRef:s,getPos:i,node:l}=this.props,a=ib(this);if(!a){if(!(t!=null&&t.composing))return;this.viewDescRef=new eo(s.current,()=>i.current(),document.createElement("div"),document.createTextNode(l.text??""),l.text??"");return}let c=a;for(;c.firstChild;)c=c.firstChild;!this.viewDescRef||this.viewDescRef instanceof eo?this.viewDescRef=new Oy(void 0,[],()=>i.current(),l,r,H.empty,a,c):(this.viewDescRef.parent=s.current,this.viewDescRef.children=[],this.viewDescRef.node=l,this.viewDescRef.getPos=()=>i.current(),this.viewDescRef.outerDeco=r,this.viewDescRef.innerDeco=H.empty,this.viewDescRef.dom=a,this.viewDescRef.dom.pmViewDesc=this.viewDescRef,this.viewDescRef.nodeDOM=c),o.current.includes(this.viewDescRef)||o.current.push(this.viewDescRef),o.current.sort(Kt)}shouldComponentUpdate(t){return!lb(this.props,t)}componentDidMount(){this.updateEffect()}componentDidUpdate(){this.updateEffect()}componentWillUnmount(){const{siblingsRef:t}=this.props;if(this.viewDescRef&&t.current.includes(this.viewDescRef)){const r=t.current.indexOf(this.viewDescRef);t.current.splice(r,1)}}render(){const{view:t,getPos:r,node:o,decorations:s}=this.props;return t!=null&&t.composing&&t.state.selection.from>=r.current()&&t.state.selection.from<=r.current()+o.nodeSize?this.renderRef:(this.renderRef=s.reduce(to,o.text),this.renderRef)}}function cb(n){let{getPos:e}=n;const{siblingsRef:t,parentRef:r}=m.useContext(Ce),o=m.useRef(null),s=m.useRef(null);return J(()=>{const i=t.current;return()=>{if(o.current&&i.includes(o.current)){const l=i.indexOf(o.current);i.splice(l,1)}}},[t]),J(()=>{s.current&&(o.current?(o.current.parent=r.current,o.current.dom=s.current,o.current.getPos=()=>e.current()):o.current=new er(r.current,[],()=>e.current(),s.current,null),t.current.includes(o.current)||t.current.push(o.current),t.current.sort(Kt))}),m.createElement("br",{ref:s,className:"ProseMirror-trailingBreak"})}function ub(n){let{widget:e,getPos:t}=n;const{siblingsRef:r,parentRef:o}=m.useContext(Ce),s=m.useRef(null),i=m.useRef(()=>t.current()).current,l=m.useRef(null);J(()=>{const c=r.current;return()=>{if(s.current&&c.includes(s.current)){const u=c.indexOf(s.current);c.splice(u,1)}}},[r]),J(()=>{l.current&&(s.current?(s.current.parent=o.current,s.current.widget=e,s.current.getPos=()=>t.current(),s.current.dom=l.current):s.current=new Ks(o.current,()=>t.current(),e,l.current),r.current.includes(s.current)||r.current.push(s.current),r.current.sort(Kt))});const{Component:a}=e.type;return a&&m.createElement(a,{ref:l,widget:e,getPos:i,contentEditable:!1})}function to(n,e){const{nodeName:t,...r}=e.type.attrs,o=Su(r);return t||typeof n=="string"?m.createElement(t??"span",o,n):m.cloneElement(n,ku(n.props,o))}function Qs(n,e){var t,r,o;return n.type===e.type&&n.marks.every(s=>s.isInSet(e.marks))&&e.marks.every(s=>s.isInSet(n.marks))&&n.key===e.key&&(n.type==="node"?((t=n.outerDeco)==null?void 0:t.length)===((r=e.outerDeco)==null?void 0:r.length)&&((o=n.outerDeco)==null?void 0:o.every(s=>{var i;return(i=e.outerDeco)==null?void 0:i.some(l=>s.from===l.from&&s.to&&l.to&&s.type.eq(l.type))}))&&n.innerDeco.eq(e.innerDeco):!0)&&n.node===e.node&&n.widget===e.widget}const fb=m.memo(function(e){let{child:t,getInnerPos:r}=e;const{view:o}=m.useContext(wt),s=m.useRef(()=>r.current()+t.offset);return s.current=()=>r.current()+t.offset,t.type==="widget"?m.createElement(ub,{key:t.key,widget:t.widget,getPos:s}):t.type==="native-widget"?m.createElement(Ky,{key:t.key,widget:t.widget,getPos:s}):t.node.isText?m.createElement(Ce.Consumer,{key:t.key},i=>{let{siblingsRef:l,parentRef:a}=i;return m.createElement(ab,{view:o,node:t.node,getPos:s,siblingsRef:l,parentRef:a,decorations:t.outerDeco})}):m.createElement(Nu,{key:t.key,node:t.node,getPos:s,outerDeco:t.outerDeco,innerDeco:t.innerDeco})}),db=m.memo(function(e){let{childViews:t,getInnerPos:r}=e;const o=t[0],s=m.useRef(()=>r.current()+o.offset);s.current=()=>r.current()+o.offset;const i=o.marks[0];return i?m.createElement(wu,{getPos:s,key:o.key,mark:i},m.createElement(Zs,{key:o.key,getInnerPos:r,childViews:t.map(l=>({...l,marks:l.marks.slice(1)}))})):m.createElement(m.Fragment,null,t.map(l=>m.createElement(fb,{key:l.key,child:l,getInnerPos:r})))}),Zs=m.memo(function(e){let{getInnerPos:t,childViews:r}=e;const o=r.reduce((s,i)=>{var c;const l=s[s.length-1];if(!l)return[[i]];const a=l[l.length-1];return a?!i.marks.length&&!a.marks.length||i.marks.length&&a.marks.length&&((c=i.marks[0])!=null&&c.eq(a.marks[0]))?[...s.slice(0,s.length-1),[...l.slice(0,l.length),i]]:[...s,[i]]:[...s.slice(0,s.length),[i]]},[]);return m.createElement(m.Fragment,null,o.map(s=>{const i=s[0];return i?m.createElement(db,{key:i.key,childViews:s,getInnerPos:t}):null}))});function ei(n,e,t,r,o,s){const i=n+e,l=r==null?void 0:r.get(i);if(t==="widget"||t==="native-widget")return o.type.spec.key?o.type.spec.key:(console.warn(`Widget at position ${i} doesn't have a key specified. This may cause issues.`),`${l}-${s}`);if(l)return l;const a=n-1,c=r==null?void 0:r.get(a);return c?`${c}-${e}`:i}function hb(n,e){if(!e||e.widget.type.side>=0||!n||!n.node.isInline)return;const t=n.marks;e.marks=e.marks.reduce((r,o)=>o.addToSet(r),t)}function pb(n,e){if(!e.node.isInline)return;const t=e.marks;for(let r=n.length-1;r>=0;r--){const o=n[r];o.widget.type.side<0||(o.marks=o.marks.reduce((s,i)=>i.addToSet(s),t))}}const mb=m.memo(function(e){let{child:t,getInnerPos:r}=e;const o=m.useRef(()=>r.current()+t.offset);return o.current=()=>r.current()+t.offset,t.type==="node"?t.marks.reduce((s,i)=>m.createElement(wu,{getPos:o,mark:i},s),m.createElement(Nu,{key:t.key,outerDeco:t.outerDeco,node:t.node,innerDeco:t.innerDeco,getPos:o})):m.createElement(Zs,{key:t.key,childViews:[t],getInnerPos:r})});function gb(n,e){return n.length?n.every(t=>t.type!=="node"||t.node.isInline)?[m.createElement(Zs,{key:n[0].key,childViews:n,getInnerPos:e})]:n.map(t=>m.createElement(mb,{key:t.key,child:t,getInnerPos:e})):[]}const tr=m.memo(function(e){let{getPos:t,node:r,innerDecorations:o}=e;const s=Ly(),i=m.useRef(()=>t.current()+1),l=m.useRef(new Map).current;if(!r)return null;const a=new Set;let c=[],u=null;Fy(r,o,(h,b,g,k)=>{const w=h.type.spec.marks??[];let M;if(b){M=ei(i.current(),g,"native-widget",s==null?void 0:s.posToKey,h,k);const I={type:"native-widget",widget:h,marks:w,offset:g,index:k,key:M},C=l.get(M);C&&Qs(C,I)?C.offset=g:l.set(M,I),a.add(M)}else{M=ei(i.current(),g,"widget",s==null?void 0:s.posToKey,h,k);const I={type:"widget",widget:h,marks:w,offset:g,index:k,key:M},C=l.get(M);C&&Qs(C,I)?C.offset=g:l.set(M,I),a.add(M)}const O=l.get(M);c.push(O),hb(u,l.get(M))},(h,b,g,k)=>{const w=ei(i.current(),k,"node",s==null?void 0:s.posToKey),M={type:"node",node:h,marks:h.marks,innerDeco:g,outerDeco:b,offset:k,key:w},O=l.get(w);O&&Qs(O,M)?(O.offset=k,u=O):(l.set(w,M),u=M),a.add(w),pb(c,u),c=[]});for(const h of l.keys())a.has(h)||l.delete(h);const f=Array.from(l.values()).sort((h,b)=>h.offset-b.offset),d=gb(f,i),p=f[f.length-1];return(!p||p.type!=="node"||p.node.isInline&&!p.node.isText||/\n$/.test(p.node.text))&&d.push(m.createElement(eb,{getPos:i,key:"trailing-hack-img"}),m.createElement(cb,{getPos:i,key:"trailing-hack-br"})),m.createElement(m.Fragment,null,d)}),ti={current(){return-1}},yb=m.memo(m.forwardRef(function(e,t){let{className:r,node:o,innerDeco:s,outerDeco:i,as:l,viewDesc:a,...c}=e;const u=m.useRef(null);m.useImperativeHandle(t,()=>u.current,[]);const{childDescriptors:f,nodeViewDescRef:d}=Gs(o,()=>ti.current(),u,u,s,i,a),p=m.useMemo(()=>({parentRef:d,siblingsRef:f}),[f,d]),h={...c,ref:u,className:r,suppressContentEditableWarning:!0},b=l?m.cloneElement(l,h,m.createElement(Ce.Provider,{value:p},m.createElement(tr,{getPos:ti,node:o,innerDecorations:s}))):m.createElement("div",h,m.createElement(Ce.Provider,{value:p},m.createElement(tr,{getPos:ti,node:o,innerDecorations:s})));if(!o)return b;const g=i.filter(w=>!w.inline);return g.length?g.reduce(to,b):b})),Ou=m.createContext(null);function bb(n,e){let{as:t,...r}=n;const o=m.useRef([]),s=m.useRef(null),{setMount:i,...l}=m.useContext(Ou),a=m.useRef(void 0);m.useImperativeHandle(e,()=>s.current,[]);const c=m.useMemo(()=>({parentRef:a,siblingsRef:o}),[o,a]);return m.createElement(Ce.Provider,{value:c},m.createElement(yb,{ref:u=>{s.current=u,i(u)},...r,...l,as:t}))}const Tu=m.forwardRef(bb),xb=[];function kb(n){var h;let{className:e,children:t,nodeViews:r,customNodeViews:o,...s}=n;const[i,l]=m.useState(null),{editor:a,state:c}=$y(i,{...s,nodeViews:o}),u=a.view?ty(a.view,a.cursorWrapper):H.empty,f=a.view?Ug(a.view):xb,d=m.useMemo(()=>({nodeViews:r??{}}),[r]),p=m.useMemo(()=>{var b;return{className:e,setMount:l,node:(b=a.view)==null?void 0:b.state.doc,innerDeco:u,outerDeco:f,viewDesc:a.docViewDescRef.current}},[e,a.docViewDescRef,(h=a.view)==null?void 0:h.state.doc,u,f]);return m.createElement(wt.Provider,{value:a},m.createElement(Xg.Provider,{value:c},m.createElement(qc.Provider,{value:d},m.createElement(Ou.Provider,{value:p},t))))}function vu(n){return m.createElement(jy,null,m.createElement(kb,n))}function re(n){const e=m.useRef(n),{view:t}=m.useContext(wt);return Ke(()=>{e.current=n},[n]),m.useCallback(function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return e.current(t,...o)},[t])}function Au(n){const e=m.useContext(Mu),t=re(n);Ke(()=>{e(t)},[e,t])}const Pu=n=>[Gg(),Ro({Tab:jc(1),"Shift-Tab":jc(-1)}),hm(n.schema),Ro(lm(n.schema)),Ro(Hd),Kd({color:"#F00",width:2}),Ap(),Sd(),pm(n),fy()],Sb=["p",0],Cb=["blockquote",0],wb=["hr"],Mb=["pre",["code",0]],Nb=["br"],Eb={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return Sb}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return Cb}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return wb}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(n){return["h"+n.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return Mb}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(n){return{src:n.getAttribute("src"),title:n.getAttribute("title"),alt:n.getAttribute("alt")}}}],toDOM(n){let{src:e,alt:t,title:r}=n.attrs;return["img",{src:e,alt:t,title:r}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return Nb}}},Db=["em",0],Ob=["strong",0],Tb=["code",0],vb={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(n){return{href:n.getAttribute("href"),title:n.getAttribute("title")}}}],toDOM(n){let{href:e,title:t}=n.attrs;return["a",{href:e,title:t},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:n=>n.type.name=="em"}],toDOM(){return Db}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name=="strong"},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}],toDOM(){return Ob}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return Tb}}},Iu=new gr({nodes:Eb,marks:vb}),Vu=Iu.spec.marks.append({underline:{parseDOM:[{tag:"u"},{style:"font-style=underline"}],toDOM(){return["u",0]}},strikethrough:{parseDOM:[{tag:"s"},{style:"font-style=strike"},{style:"font-style=strikethrough"}],toDOM(){return["s",0]}}}),no="https://dailytelefrag.ru/api",ro="https://dailytelefrag.ru/error_image.png",Ru="https://dailytelefrag.ru/error_embed.png",Ab=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="vkvideo.ru"&&t.hostname!=="vk.com")throw new Error;let r,o;if(t.pathname==="/video_ext.php")r=t.searchParams.get("id"),o=t.searchParams.get("oid");else if(t.pathname.startsWith("/video"))[o,r]=t.pathname.slice(6).split("_");else throw new Error;if(!r||!o)throw new Error;return e?`https://vkvideo.ru/video_ext.php?oid=${o}&id=${r}&hd=2`:!0}catch{return""}},Pb=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="rutube.ru")throw new Error;let r;if(t.pathname.startsWith("/video/"))r=t.pathname.split("/")[2];else if(t.pathname.startsWith("/play/embed/"))r=t.pathname.split("/")[3];else throw new Error;if(!r)throw new Error;return e?`https://rutube.ru/play/embed/${r}`:!0}catch{return""}},Ib=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="youtube.com"&&t.hostname!=="www.youtube.com"&&t.hostname!=="youtu.be")throw new Error;if(t.hostname==="youtu.be")return e?`https://youtube.com/embed${t.pathname}`:!0;let r;if(t.pathname==="/watch")r=t.searchParams.get("v");else if(t.pathname.startsWith("/live/"))r=t.pathname.split("/")[2];else if(t.pathname.startsWith("/embed/"))r=t.pathname.split("/")[2];else throw new Error;if(!r)throw new Error;return e?`https://youtube.com/embed/${r}`:!0}catch{return""}},oo=n=>{try{const e=new URL(n);switch(e.hostname){case"vkvideo.ru":case"vk.com":return Ab(e,!0)+"";case"rutube.ru":return Pb(e,!0)+"";case"youtube.com":case"www.youtube.com":case"youtu.be":return Ib(e,!0)+"";default:throw new Error}}catch{return""}},Vb={atom:!0,attrs:{fid:{default:null,validate:"string|null|number"},src:{default:null,validate:"string|null"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"block",parseDOM:[{tag:"img[src]",getAttrs(n){return{fid:n.getAttribute("fid"),src:n.getAttribute("src"),alt:n.getAttribute("alt"),title:n.getAttribute("title")}}}],toDOM(n){let{fid:e,src:t,alt:r,title:o}=n.attrs;return e&&(t=`${no}/files/${e}`),t||(t=ro),["div",{title:o,class:"image"},["img",{fid:e,src:t,alt:r,title:o}]]}},Rb={atom:!0,attrs:{src:{validate:"string"},title:{default:null,validate:"string|null"}},group:"block",parseDOM:[{tag:"iframe[src]",getAttrs(n){return{src:n.getAttribute("src"),title:n.getAttribute("title")}}}],toDOM(n){const{src:e,title:t}=n.attrs,r="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";return oo(e)?["div",{title:t,class:"video"},["iframe",{src:e,title:t,allow:r}]]:["div",{title:t,class:"image"},["img",{src:Ru}]]}},zb={content:"inline*",group:"block",attrs:{align:{default:null,validate:"string|null"}},parseDOM:[{tag:"p",getAttrs(n){let e=n.getAttribute("align");return e!=="right"&&e!=="center"&&e!=="justify"&&(e=null),{align:e}}}],toDOM(n){const{align:e}=n.attrs;return["p",{align:e},0]}},$b={attrs:{level:{default:1,validate:"number"}},content:"inline*",marks:"underline strikethrough",group:"block",parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(n){return["h"+n.attrs.level,0]}},jb={atom:!0,content:"image*",group:"block",toDOM(){return["div",{class:"carousel"},0]}},zu=Iu.spec.nodes.remove("image").append({image:Vb,video:Rb}),so=new gr({nodes:zu.remove("horizontal_rule").remove("heading"),marks:Vu}),Bb=zu.remove("heading").remove("paragraph").prepend({paragraph:zb}).append({heading:$b}).append({carousel:jb}).append(ug({tableGroup:"block",cellContent:"(paragraph | ordered_list | bullet_list)+",cellAttributes:{halign:{default:null,getFromDOM(n){const e=n.getAttribute("align")||null;return e==="left"||e==="right"||e==="center"?e:null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`text-align: ${n};`)}},valign:{default:null,getFromDOM(n){const e=n.style.verticalAlign||null;return e==="top"||e==="bottom"||e==="middle"?e:null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`vertical-align: ${n};`)}}}})),Nt=new gr({nodes:Wp(Bb,"(paragraph | ordered_list | bullet_list)+","block"),marks:Vu}),Fb=n=>{if(n)try{const e=be.fromJSON(Nt,JSON.parse(n)),t=$e.fromSchema(Nt).serializeFragment(e.content);return Pt.fromSchema(so).parse(t)}catch(e){console.error(`Can not convert content to simple schema: ${e}`)}},nr=({ref:n,item:e})=>{const[t,r]=m.useState(!0),[o,s]=m.useState(!1),[i,l]=m.useState(!1);Ke(c=>{c&&(r(e.isActive&&e.isActive(c.state)),l(e.isSelected&&!e.isSelected(c.state)),e.isDisabled?s(e.isDisabled(c.state)):s(!e.command(c.state)))});const a=re(c=>{c&&(o||e.command(c.state,c.dispatch,c),c.focus())});return i?null:y.jsx("div",{ref:n,className:`MenuItem ${t?"active":""} ${o?"disabled":""}`,onClick:c=>{c.stopPropagation(),c.preventDefault(),a()},children:e.icon})},$u=({schema:n})=>{const[e,t]=m.useState(void 0),[r,o]=m.useState(void 0);return m.useEffect(()=>{if(t(void 0),o(void 0),n.nodes.paragraph){const s=n.nodes.paragraph;t({icon:y.jsx(E.Icons.Type,{}),command:on(s)})}if(n.nodes.code_block){const s=n.nodes.code_block;o({icon:y.jsx(E.Icons.CodeXml,{}),command:on(s)})}},[n]),y.jsxs(y.Fragment,{children:[e&&y.jsx(nr,{item:e}),r&&y.jsx(nr,{item:r})]})},rr=({items:n})=>y.jsx("div",{className:"MenuBlock",children:n.map((e,t)=>y.jsx(nr,{item:e},t))}),Lb=({schema:n,isOpen:e,onClose:t})=>{const r=re((o,s)=>{o&&(ke(n.marks.link,{href:s})(o.state,o.dispatch),t(),o.focus())});return y.jsx(E.Prompt,{title:"Введите URL для ссылки",isOpen:e,onCancel:t,onSubmit:r})},ju=({schema:n})=>{const[e,t]=m.useState([]),[r,o]=m.useState(!1);return m.useEffect(()=>{const s=[];if(n.marks.strong){const i=n.marks.strong;s.push({icon:y.jsx(E.Icons.Bold,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.em){const i=n.marks.em;s.push({icon:y.jsx(E.Icons.Italic,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.underline){const i=n.marks.underline;s.push({icon:y.jsx(E.Icons.Underline,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.strikethrough){const i=n.marks.strikethrough;s.push({icon:y.jsx(E.Icons.Strikethrough,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.code){const i=n.marks.code;s.push({icon:y.jsx(E.Icons.Code,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.link){const i=n.marks.link;s.push({icon:y.jsx(E.Icons.Link,{}),isActive:l=>Jt(l,i),isDisabled:l=>l.selection.empty?!0:!ke(i)(l),command:(l,a,c)=>(Jt(l,i)?(ke(i)(l,a),c==null||c.focus()):o(!0),!0)})}t(s)},[n]),e.length<1?null:y.jsxs(y.Fragment,{children:[y.jsx(rr,{items:e}),y.jsx(Lb,{isOpen:r,schema:n,onClose:()=>o(!1)})]})};function Jt(n,e){let{from:t,$from:r,to:o,empty:s}=n.selection;return s?!!e.isInSet(n.storedMarks||r.marks()):n.doc.rangeHasMark(t,o,e)}const Bu=()=>y.jsxs("div",{className:"MenuBlock",children:[y.jsx(nr,{item:{icon:y.jsx(E.Icons.Undo,{}),command:Ao}}),y.jsx(nr,{item:{icon:y.jsx(E.Icons.Redo,{}),command:Mr}})]}),Fu=({schema:n})=>{const[e,t]=m.useState([]);return m.useEffect(()=>{const r=[];if(n.nodes.bullet_list){const o=n.nodes.bullet_list;r.push({icon:y.jsx(E.Icons.List,{}),command:(s,i)=>Rr(o)(s,i)})}if(n.nodes.ordered_list){const o=n.nodes.ordered_list;r.push({icon:y.jsx(E.Icons.ListOrdered,{}),command:(s,i)=>Rr(o)(s,i)})}if(n.nodes.blockquote){const o=n.nodes.blockquote;r.push({icon:y.jsx(E.Icons.Quote,{}),command:(s,i)=>Cl(o)(s,i)})}t(r)},[n]),e.length<1?null:y.jsx(rr,{items:e})},Lu=({pos:n,isOpen:e,onClose:t})=>{const[r,o]=m.useState(""),[s,i]=m.useState(),[l,a]=m.useState(""),[c,u]=m.useState(!1);m.useEffect(()=>{o(""),a(""),i(void 0)},[e]),Ke(d=>{if(!d||!e)return;const p=tt.getState(d.state);u(p.upload!==void 0)},[e]);const f=re(d=>{d&&(c?gm(d,s,l,n):ym(d,r,l,n),d.focus(),t())});return y.jsxs(E.Modal,{isOpen:e,onClose:t,children:[y.jsx("h1",{children:"Вставка картинки"}),y.jsxs(E.Form,{submit:"Вставить",submitType:"Success",onSubmit:f,onCancel:t,children:[c?y.jsx(E.Image,{id:"image",value:s,onChange:i,text:y.jsxs("span",{children:[y.jsx(E.Icons.Image,{}),y.jsx("br",{}),"Выберите файл"]}),required:!0,label:"Картинка"}):y.jsx(E.Input,{id:"href",value:r,onChange:o,required:!0,label:"Ссылка на картинку"}),y.jsx(E.Input,{id:"value",value:l,onChange:a,label:"Подпись"})]})]})},Wb=({schema:n,isOpen:e,onClose:t})=>{const[r,o]=m.useState(""),[s,i]=m.useState("");m.useEffect(()=>{o(""),i("")},[e]);const l=re(a=>{const c=n.nodes.video;if(!a||!r||!c)return;const u=oo(r);a.dispatch(a.state.tr.replaceSelectionWith(c.create({src:u,title:s}))),a.focus(),t()});return n.nodes.video?y.jsxs(E.Modal,{isOpen:e,onClose:t,children:[y.jsx("h1",{children:"Вставка видео"}),y.jsxs(E.Form,{submit:"Вставить",submitType:"Success",onSubmit:l,onCancel:t,children:[y.jsx(E.Input,{id:"src",value:r,onChange:o,label:"Ссылка на видео",bottom:"Поддерживаются VK Video, RuTube и YouTube",required:!0}),y.jsx(E.Input,{id:"value",value:s,onChange:i,label:"Подпись"})]})]}):null},Wu=({schema:n})=>{const[e,t]=m.useState([]),[r,o]=m.useState(!1),[s,i]=m.useState(!1);return m.useEffect(()=>{const l=[];if(n.nodes.image){const a=n.nodes.image;l.push({icon:y.jsx(E.Icons.Image,{}),isDisabled:c=>!ni(c,a),command:()=>(o(!0),!0)})}if(n.nodes.video){const a=n.nodes.video;l.push({icon:y.jsx(E.Icons.Film,{}),isDisabled:c=>!ni(c,a),command:()=>(i(!0),!0)})}if(n.nodes.horizontal_rule){const a=n.nodes.horizontal_rule;l.push({icon:y.jsx(E.Icons.FlipVertical,{}),isDisabled:c=>!ni(c,a),command:(c,u)=>u?(u(c.tr.replaceSelectionWith(a.create())),!0):!1})}n.nodes.table&&l.push({icon:y.jsx(E.Icons.Table,{}),isDisabled:Oe,command:_b()}),t(l)},[n]),e.length<1?null:y.jsxs(y.Fragment,{children:[y.jsx(rr,{items:e}),y.jsx(Lu,{isOpen:r,onClose:()=>o(!1)}),y.jsx(Wb,{isOpen:s,schema:n,onClose:()=>i(!1)})]})},ni=(n,e)=>{let t=n.selection.$from;for(let r=t.depth;r>=0;r--){let o=t.index(r);if(t.node(r).canReplaceWith(o,o,e))return!0}return!1};function _b(){return(n,e)=>{const t=n.tr.selection.anchor+1,r=n.tr,o=n.schema.nodes.table_cell.createAndFill(),s=n.schema.nodes.table.create(null,S.fromArray([n.schema.nodes.table_row.create(null,S.fromArray([o,o,o])),n.schema.nodes.table_row.create(null,S.fromArray([o,o,o]))]));return e&&e(r.replaceSelectionWith(s).scrollIntoView().setSelection(P.near(r.doc.resolve(t)))),!0}}const _u=({schema:n})=>n.nodes.carousel?y.jsx(rr,{items:[{icon:y.jsx(E.Icons.JoinUp,{}),command:bl},{icon:y.jsx(E.Icons.IndentDecrease,{}),command:$o},{icon:y.jsx(E.Icons.SquareDashed,{}),command:Bo}]}):y.jsx(rr,{items:[{icon:y.jsx(E.Icons.IndentDecrease,{}),command:$o},{icon:y.jsx(E.Icons.SquareDashed,{}),command:Bo}]}),qb=({schema:n})=>y.jsxs("div",{className:"SimpleMenuBar",children:[y.jsx("div",{className:"MenuBlock",children:y.jsx($u,{schema:n})}),y.jsx(ju,{schema:n}),y.jsx(Wu,{schema:n}),y.jsx(Fu,{schema:n}),y.jsx(_u,{schema:n}),y.jsx(Bu,{})]}),qu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const[s,i]=m.useState(t.node.attrs.alt??""),[l,a]=m.useState(t.node.attrs.title??""),[c,u]=m.useState(!1),[f,d]=m.useState("");Au((k,w)=>k?!(w instanceof MouseEvent):!1),Ke(k=>{if(d(""),u(!1),!k||!k.state.schema.nodes.carousel)return;const w=t.getPos(),M=k.state.doc.resolve(w).parent;if(u(M.type.name!=="carousel"),M.type.name==="carousel"){let O=0;M.forEach((I,C)=>{I===t.node&&(O=C+1)}),d(O?`${O} / ${M.childCount}`:"")}});const p=re((k,w)=>{if(!k)return;i(w);const M=k.state.tr,O=t.getPos();k.dispatch(M.setNodeMarkup(O,null,{...t.node.attrs,alt:w})),k.focus()}),h=re((k,w)=>{if(!k)return;a(w);const M=k.state.tr,O=t.getPos();k.dispatch(M.setNodeMarkup(O,null,{...t.node.attrs,title:w})),k.focus()}),b=re(k=>{if(!k)return;const w=t.getPos(),M=t.node.nodeSize,O=t.node.attrs,I=k.state.schema,C=I.nodes.carousel.create(null,I.nodes.image.create(O));k.dispatch(k.state.tr.replaceWith(w,w+M,C))}),g=re(k=>{if(!k)return;const w=k.state.tr,M=t.getPos(),O=t.node.nodeSize;k.dispatch(w.delete(M,M+O))});return y.jsxs("div",{...r,ref:o,className:"image",title:t.node.attrs.title,children:[y.jsxs("div",{className:"image-buttons",children:[c&&y.jsx("div",{onClick:b,className:"text-button",children:"Сделать карусель"}),f&&y.jsx("div",{className:"text-button",children:f}),y.jsx("div",{onClick:g,children:y.jsx(E.Icons.Trash,{})})]}),y.jsx("div",{children:y.jsx(E.Editable,{value:s,placeholder:"Alt: описание изображения (не обязательно)",onChange:p,empty:!0,style:{textAlign:"center",cursor:"text"}})}),y.jsx("img",{title:t.node.attrs.title,alt:t.node.attrs.alt,src:t.node.attrs.fid?`${no}/files/${t.node.attrs.fid}`:t.node.attrs.src}),y.jsx("div",{children:y.jsx(E.Editable,{value:l,placeholder:"Title: подпись под изображением (не обязательно)",onChange:h,empty:!0,style:{textAlign:"center",cursor:"text"}})})]})}),Hu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const[s,i]=m.useState(""),[l,a]=m.useState(t.node.attrs.title??""),c="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";Au(()=>!0),m.useEffect(()=>{i(oo(t.node.attrs.src))},[t]);const u=re((f,d)=>{if(!f)return;a(d);const{$from:p,$to:h}=f.state.selection,b=p.blockRange(h);if(b){const g=f.state.doc;let k=f.state.tr;g.nodesBetween(b.start,b.end,(w,M)=>{w.type.name==="video"&&(k=k.setNodeMarkup(M,null,{...t.node.attrs,title:d}))}),f.dispatch(k)}f.focus()});return y.jsxs("div",{...r,ref:o,className:s?"video":"image",title:t.node.attrs.title,children:[s?y.jsx("iframe",{src:s,allow:c}):y.jsx("img",{src:Ru}),y.jsx("div",{children:y.jsx(E.Editable,{value:l,placeholder:"Подпись под видео (не обязательно)",onChange:u,empty:!0,style:{textAlign:"center",cursor:"text"}})})]})}),Ku=({onSave:n,disabled:e=!1,notEmpty:t=!0,wasChanged:r=!0})=>{const[o,s]=m.useState(!0);Ke(l=>{let a=!1;const c=l.state.doc,u=!!c.textBetween(0,c.content.size,void 0," ").length,f=!!Po(l.state);r&&t?a=u&&f:r?a=f:t&&(a=u),s(a)});const i=re(l=>{try{let a;const c=Is(l.state);if(c){const u=l.state.apply(c.setMeta("addToHistory",!1));a=JSON.stringify(u.doc.toJSON())}else a=JSON.stringify(l.state.doc.toJSON());n({content:a,format:"prose"})}catch(a){console.error(`Can not save doc: ${a}`)}});return y.jsx(E.Button,{type:"Accent",disabled:e||!o,label:"Сохранить",size:"Small",onClick:i})},Hb=({title:n=!1,content:e,onSave:t,onCancel:r,onChange:o,onUpload:s})=>{const[i,l]=m.useState(""),[a,c]=m.useState();m.useEffect(()=>{const p=Ge.create({doc:Fb(e),schema:so,plugins:Pu({schema:so,upload:s})});c(p),n!==!1&&l(typeof n=="string"?n:"")},[n,e]);const u=()=>n!==!1?i.trim().length>0:!0,f=p=>{!t||!u()||t({...p,name:i})},d=()=>{r&&r()};return a?y.jsxs("div",{className:"ProseNotes",children:[n!==!1&&y.jsx("input",{className:"ProseNotesTitle",onChange:p=>l(p.currentTarget.value),value:i,placeholder:"Укажите заголовок"}),y.jsxs(vu,{state:a,dispatchTransaction:p=>c(h=>{const b=h==null?void 0:h.apply(p);return b&&o&&o(!!Po(b)),b}),nodeViews:{image:qu,video:Hu},children:[y.jsxs("div",{className:"ProseNotesContent",children:[y.jsx(qb,{schema:so}),y.jsx(Tu,{})]}),(t||r)&&y.jsxs("div",{className:"ProseNotesButtons",children:[r&&y.jsx("span",{className:"a small",onClick:d,children:"Отменить"}),t&&y.jsx(Ku,{onSave:f,disabled:!u(),wasChanged:!1})]})]})]}):null},Kb=({schema:n})=>{const e=m.useRef(null),[t,r]=m.useState([]),[o,s]=m.useState([]),[i,l]=m.useState(!1);Ke(c=>{const u=n.nodes.heading;if(!c||!u||!i)return;const f=[],d=[];for(let p=2;p<7;p++){const b=on(u,{level:p});d[p]=b,f[p]={id:p,icon:y.jsx(Jb,{level:p}),text:`уровень ${p}`,disabled:!b(c.state)}}r(f),s(d)},[i]);const a=re((c,u)=>{!c||!u.id||(o[u.id](c.state,c.dispatch,c),l(!1),c.focus())});return n.nodes.heading?y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:e,className:"MenuItem",onClick:()=>l(!0),children:y.jsx(E.Icons.Heading,{})}),e.current&&y.jsx(E.Menu,{parent:e.current,items:t,isOpen:i,onClose:()=>l(!1),onClick:a,horizontal:"inner-left"})]}):null},Jb=({level:n})=>{switch(n){case 2:return y.jsx(E.Icons.Heading2,{});case 3:return y.jsx(E.Icons.Heading3,{});case 4:return y.jsx(E.Icons.Heading4,{});case 5:return y.jsx(E.Icons.Heading5,{});case 6:return y.jsx(E.Icons.Heading6,{});default:return y.jsx(E.Icons.Heading,{})}},Yb=[{id:"left",icon:y.jsx(E.Icons.AlignLeft,{}),text:"Прижать влево"},{id:"right",icon:y.jsx(E.Icons.AlignRight,{}),text:"Прижать вправо"},{id:"center",icon:y.jsx(E.Icons.AlignCenter,{}),text:"Отцентровать"},{id:"justify",icon:y.jsx(E.Icons.AlignJustify,{}),text:"Выровнять по краям"}],Gb=({schema:n})=>{const e=m.useRef(null),[t,r]=m.useState(!1),o=re((s,i)=>{if(!s||!i.id)return;const l=i.id==="left"?null:i.id,{$from:a,$to:c}=s.state.selection,u=a.blockRange(c);if(u){const f=s.state.doc;let d=s.state.tr;f.nodesBetween(u.start,u.end,(p,h)=>{p.type.name==="paragraph"&&(d=d.setNodeMarkup(h,null,{align:l}))}),s.dispatch(d)}s.focus(),r(!1)});return n.nodes.paragraph?y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:e,className:"MenuItem",onClick:()=>r(!0),children:y.jsx(E.Icons.AlignLeft,{})}),e.current&&y.jsx(E.Menu,{parent:e.current,items:Yb,isOpen:t,onClose:()=>r(!1),onClick:o,horizontal:"inner-left"})]}):null},Xb=({schema:n,onSave:e})=>y.jsxs("div",{className:"MenuBar",children:[y.jsxs("div",{className:"MenuBlock",children:[y.jsx(Kb,{schema:n}),y.jsx($u,{schema:n})]}),y.jsx(ju,{schema:n}),y.jsx(Wu,{schema:n}),y.jsx(Fu,{schema:n}),y.jsx(Gb,{schema:n}),y.jsx(_u,{schema:n}),y.jsx(Bu,{}),y.jsx("div",{className:"MenuBlock",children:y.jsx(Ku,{onSave:e})})]}),Ub=5,Ju=1,or=50,Qb=({width:n,onChange:e,onWidth:t})=>{const[r,o]=m.useState(!1),[s,i]=m.useState(0),[l,a]=m.useState(0),[c,u]=m.useState(n),f=h=>{const b=n[l],g=n[l+1],k=[...c];return b+h<or&&(h=or-b),g-h<or&&(h=g-or),k[l]=b+h,k[l+1]=g-h,k};m.useEffect(()=>{u(n)},[n]),m.useEffect(()=>{const h=g=>{if(!r)return;o(!1),g.preventDefault(),g.stopPropagation();const k=g.clientX-s,w=f(k);t(w)},b=g=>{if(!r)return;g.preventDefault(),g.stopPropagation();const k=g.clientX-s,w=f(k);u(w),e(w)};return document.addEventListener("mouseup",h),document.addEventListener("mousemove",b),()=>{document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",b)}},[r,l]);const d=(h,b)=>{b!==n.length-1&&(h.preventDefault(),h.stopPropagation(),o(!0),i(h.clientX),a(b))},p=h=>c.slice(0,h+1).reduce((b,g)=>b+g,0)+h+Ju-Math.floor(Ub/2);return y.jsx("div",{className:"table-resizer",children:c.map((h,b)=>y.jsx("div",{style:{left:p(b)+"px"},onMouseDown:g=>d(g,b)},b))})},Zb=m.forwardRef(function({children:e,nodeProps:t,...r},o){var f;const s=m.useRef(null),i=m.useRef(null),[l,a]=m.useState([]),c=re((d,p)=>{if(!d)return;const h=t.node,b=t.getPos()+1,g=Q.get(h),k=d.state.tr;for(let w=0;w<g.height;w++)for(let M=0;M<g.width;){const O=w*g.width+M,I=g.map[O],C=h.nodeAt(I).attrs,V=p.slice(M,M+C.colspan);w&&g.map[O]==g.map[O-g.width]||k.setNodeMarkup(b+I,null,{...C,colwidth:V}),M+=C.colspan}k.docChanged&&d.dispatch(k)});m.useEffect(()=>{if(!s.current||!i.current)return;const p=t.node.firstChild;if(!p)return;let h=[];for(let C=0;C<p.childCount;C++){const V=p.child(C),{colspan:z,colwidth:T}=V.attrs;h=h.concat(Array.isArray(T)?T:Array(z).fill(0))}const b=h.filter(C=>!C).length,g=h.reduce((C,V)=>C+V,0),k=(h.length+1)*Ju,w=Math.max(b?(s.current.offsetWidth-g-k)/b:0,or);h=h.map(C=>C||w);const M=h.reduce((C,V)=>C+V,0),O=i.current.offsetWidth-k-16,I=O/M;h=h.map(C=>Math.round(C*I)),h[h.length-1]+=O-h.reduce((C,V)=>C+V,0),a(h)},[t,s,i,(f=i.current)==null?void 0:f.offsetWidth]);const u=re(d=>{Fg(d.state,d.dispatch)});return y.jsxs("div",{...r,className:"table-wrapper",ref:d=>{i.current=d,o&&(typeof o=="function"?o(d):o.current=d)},children:[y.jsx(Qb,{width:l,onChange:a,onWidth:c}),y.jsxs("table",{ref:s,children:[y.jsx("colgroup",{children:l.map((d,p)=>y.jsx("col",{width:d},p))}),y.jsx("caption",{onClick:u,children:y.jsx(E.Icons.Trash,{})}),y.jsx("tbody",{children:e})]})]})}),e0=[{id:"toggleHeaderRow",text:"Toggle header row",icon:y.jsx(E.Icons.Heading,{})},{id:"addRowBefore",text:"Insert row before",icon:y.jsx(E.Icons.RowInsertBefore,{})},{id:"addRowAfter",text:"Insert row after",icon:y.jsx(E.Icons.RowInsertAfter,{})},{id:"deleteRow",text:"Delete row",icon:y.jsx(E.Icons.Trash,{})}],t0=[{id:"toggleHeaderColumn",text:"Toggle header column",icon:y.jsx(E.Icons.Heading,{})},{id:"addColumnBefore",text:"Insert column before",icon:y.jsx(E.Icons.ColumnInsertBefore,{})},{id:"addColumnAfter",text:"Insert column after",icon:y.jsx(E.Icons.ColumnInsertAfter,{})},{id:"deleteColumn",text:"Delete column",icon:y.jsx(E.Icons.Trash,{})}],n0=[{id:"toggleHeaderCell",text:"Toggle header",icon:y.jsx(E.Icons.Heading,{})},{id:"alignLeft",text:"Horizontal align left",icon:y.jsx(E.Icons.AlignLeft,{})},{id:"alignCenter",text:"Horizontal align center",icon:y.jsx(E.Icons.AlignCenter,{})},{id:"alignRight",text:"Horizontal align Right",icon:y.jsx(E.Icons.AlignRight,{})},{id:"alignTop",text:"Vertical align top",icon:y.jsx(E.Icons.AlignTop,{})},{id:"alignMiddle",text:"Vertical align middle",icon:y.jsx(E.Icons.AlignMiddle,{})},{id:"alignBottom",text:"Vertical align bottom",icon:y.jsx(E.Icons.AlignBottom,{})},{id:"mergeCells",text:"Merge cells",icon:y.jsx(E.Icons.CellsMerge,{})},{id:"splitCell",text:"Split cell",icon:y.jsx(E.Icons.CellsSplit,{})}],Yu=({parent:n,isRowMenuOpen:e,isCellMenuOpen:t,isColumnMenuOpen:r,onRowMenuClose:o,onCellMenuClose:s,onColumnMenuClose:i})=>{const l=re((a,c)=>{if(a){switch(c.id){case"toggleHeaderRow":zg(a.state,a.dispatch);break;case"addRowBefore":Dg(a.state,a.dispatch);break;case"addRowAfter":Og(a.state,a.dispatch);break;case"deleteRow":vg(a.state,a.dispatch);break;case"toggleHeaderColumn":$g(a.state,a.dispatch);break;case"addColumnBefore":Cg(a.state,a.dispatch);break;case"addColumnAfter":wg(a.state,a.dispatch);break;case"deleteColumn":Ng(a.state,a.dispatch);break;case"mergeCells":Pg(a.state,a.dispatch);break;case"splitCell":Ig(a.state,a.dispatch);break;case"toggleHeaderCell":jg(a.state,a.dispatch);break;case"alignLeft":mn("halign","left")(a.state,a.dispatch);break;case"alignCenter":mn("halign","center")(a.state,a.dispatch);break;case"alignRight":mn("halign","right")(a.state,a.dispatch);break;case"alignTop":mn("valign","top")(a.state,a.dispatch);break;case"alignMiddle":mn("valign","middle")(a.state,a.dispatch);break;case"alignBottom":mn("valign","bottom")(a.state,a.dispatch);break}o(),s(),i(),a.focus()}});return n?y.jsxs(y.Fragment,{children:[y.jsx(E.Menu,{parent:n,items:e0,isOpen:e,onClose:o,onClick:l,vertical:"top",horizontal:"inner-left"}),y.jsx(E.Menu,{parent:n,items:n0,isOpen:t,onClose:s,onClick:l,horizontal:"inner-left"}),y.jsx(E.Menu,{parent:n,items:t0,isOpen:r,onClose:i,onClick:l,vertical:"top",horizontal:"inner-left",margin:"var(--alxgrn-unit)"})]}):null},Gu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const s=m.useRef(null),[i,l]=m.useState(!1),[a,c]=m.useState(!1),[u,f]=m.useState(!1);m.useEffect(()=>{const h=b=>{s.current!==b.target&&(l(!1),c(!1),f(!1))};return document.addEventListener("contextmenu",h,!0),()=>document.removeEventListener("contextmenu",h,!0)},[]);const d=h=>{h.preventDefault(),h.stopPropagation(),l(!1),c(!1),f(!1);const b=h.currentTarget.getBoundingClientRect();h.clientY<b.y?f(!0):h.clientX<b.x?l(!0):c(!0)},p=h=>{l(!1),c(!1),f(!1);const b=h.currentTarget.getBoundingClientRect();if(h.clientY<b.y)f(!0);else if(h.clientX<b.x)l(!0);else return;h.preventDefault(),h.stopPropagation()};return t.node.type.spec.tableRole==="header_cell"?y.jsxs("th",{...r,datatype:`width-${t.node.attrs.colwidth}`,colSpan:t.node.attrs.colspan,rowSpan:t.node.attrs.rowspan,style:{textAlign:t.node.attrs.halign,verticalAlign:t.node.attrs.valign},onClick:p,onContextMenu:d,ref:h=>{s.current=h,o&&(typeof o=="function"?o(h):o.current=h)},children:[e,y.jsx(Yu,{parent:s.current,isRowMenuOpen:i,onRowMenuClose:()=>l(!1),isCellMenuOpen:a,onCellMenuClose:()=>c(!1),isColumnMenuOpen:u,onColumnMenuClose:()=>f(!1)})]}):y.jsxs("td",{...r,datatype:`width-${t.node.attrs.colwidth}`,colSpan:t.node.attrs.colspan,rowSpan:t.node.attrs.rowspan,style:{textAlign:t.node.attrs.halign,verticalAlign:t.node.attrs.valign},onClick:p,onContextMenu:d,ref:h=>{s.current=h,o&&(typeof o=="function"?o(h):o.current=h)},children:[e,y.jsx(Yu,{parent:s.current,isRowMenuOpen:i,onRowMenuClose:()=>l(!1),isCellMenuOpen:a,onCellMenuClose:()=>c(!1),isColumnMenuOpen:u,onColumnMenuClose:()=>f(!1)})]})}),r0=m.forwardRef(function({children:e,nodeProps:t,...r},o){var I;const s=m.useRef(null),[i,l]=m.useState(!1),[a,c]=m.useState(!1),[u,f]=m.useState(!1),[d,p]=m.useState(),[h,b]=m.useState(),g=C=>{const V=C.scrollLeft,z=C.clientWidth,T=C.scrollWidth;c(V>0),f(V<T-z*1.5)};m.useEffect(()=>{s.current&&(h&&s.current.scrollWidth>h&&(s.current.scrollLeft=s.current.scrollWidth-s.current.clientWidth),b(s.current.scrollWidth))},[(I=s.current)==null?void 0:I.scrollWidth]),m.useEffect(()=>{p(t.getPos()+t.node.nodeSize-1),s.current&&t.node.childCount>1&&g(s.current)},[t,s]),Ke(C=>{if(!C||t.node.childCount>0)return;const V=C.state.tr,z=t.getPos(),T=t.node.nodeSize;C.dispatch(V.delete(z,z+T))},[t]);const k=re(C=>{if(!C)return;const V=t.getPos(),z=t.node.nodeSize;C.dispatch(C.state.tr.delete(V,V+z))}),w=()=>{l(!0)},M=C=>{g(C.currentTarget)},O=(C,V)=>{if(C.stopPropagation(),!s.current)return;const z=s.current.clientWidth;let T=s.current.scrollLeft+V*z;s.current.scrollLeft=T};return y.jsxs("div",{ref:o,...r,className:"carousel",children:[y.jsx("div",{className:"carousel-list",ref:s,onScroll:M,children:e}),y.jsxs("div",{className:"carousel-buttons",children:[y.jsx("div",{onClick:k,className:"text-button",children:"Удалить карусель"}),y.jsx("div",{onClick:w,children:y.jsx(E.Icons.Plus,{})})]}),a&&y.jsx("div",{className:"carousel-prev",onClick:C=>O(C,-1),children:y.jsx(E.Icons.ChevronLeft,{})}),u&&y.jsx("div",{className:"carousel-next",onClick:C=>O(C,1),children:y.jsx(E.Icons.ChevronRight,{})}),y.jsx(Lu,{pos:d,isOpen:i,onClose:()=>l(!1)})]})}),o0=({content:n,onSave:e,onChange:t,onUpload:r})=>{const[o,s]=m.useState();return m.useEffect(()=>{let i;if(n)try{i=be.fromJSON(Nt,JSON.parse(n))}catch(c){console.error(`Can not parse Prose format: ${c}`)}let l=Ge.create({doc:i,schema:Nt,plugins:Pu({schema:Nt,upload:r})});const a=Is(l);a&&(l=l.apply(a.setMeta("addToHistory",!1))),s(l)},[n]),o?y.jsx("div",{className:"ProseEditor",children:y.jsxs(vu,{state:o,dispatchTransaction:i=>s(l=>{const a=l==null?void 0:l.apply(i);return a&&t&&t(!!Po(a)),a}),nodeViews:{image:qu,video:Hu,table:Zb,table_header:Gu,table_cell:Gu,carousel:r0},children:[y.jsx(Xb,{schema:Nt,onSave:e}),y.jsx(Tu,{})]})}):null},s0=({node:n})=>{const[e,t]=m.useState();return m.useEffect(()=>{var o;const r=(o=n.attrs)==null?void 0:o.align;t(r!=="right"&&r!=="center"&&r!=="justify"?void 0:{textAlign:r})},[n]),y.jsx("p",{style:e,children:Array.isArray(n.content)&&n.content.map((r,o)=>y.jsx(Y,{node:r},o))})},i0=({node:n})=>{if(!n.text)return null;const e=(t,r)=>{var i;if(!Array.isArray(n.marks))return y.jsx(y.Fragment,{children:r});if(!t.length)return y.jsx(y.Fragment,{children:r});const o=t[0].type,s=(i=t[0].attrs)==null?void 0:i.href;switch(o){case"em":return y.jsx("em",{children:e(t.slice(1),r)});case"code":return y.jsx("code",{children:e(t.slice(1),r)});case"strong":return y.jsx("strong",{children:e(t.slice(1),r)});case"underline":return y.jsx("u",{children:e(t.slice(1),r)});case"strikethrough":return y.jsx("s",{children:e(t.slice(1),r)});case"link":return s?y.jsx("a",{target:"_blank",href:s,children:e(t.slice(1),r)}):y.jsx(y.Fragment,{children:e(t.slice(1),r)});default:return y.jsx(y.Fragment,{children:e(t.slice(1),r)})}};return e(n.marks,n.text)},l0=({node:n,className:e})=>y.jsx("div",{className:e,children:Array.isArray(n.content)&&n.content.map((t,r)=>y.jsx(Y,{node:t},r))}),a0=({node:n})=>{const e=m.useRef(null),[t,r]=m.useState(""),[o,s]=m.useState(""),[i,l]=m.useState(""),[a,c]=m.useState(!1);m.useEffect(()=>{const f=()=>{c(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",f),()=>document.removeEventListener("fullscreenchange",f)},[]),m.useEffect(()=>{var p,h,b,g,k,w,M;let f=(p=n.attrs)==null?void 0:p.fid,d=(h=n.attrs)!=null&&h.src?`${(b=n.attrs)==null?void 0:b.src}`:"";f&&(d=`${no}/files/${f}`),d||(d=ro),r(d),s((g=n.attrs)!=null&&g.alt?`${(k=n.attrs)==null?void 0:k.alt}`:""),l((w=n.attrs)!=null&&w.title?`${(M=n.attrs)==null?void 0:M.title}`:"")},[n]);const u=f=>{var d;f.stopPropagation(),a?document.exitFullscreen():(d=e.current)==null||d.requestFullscreen()};return t?y.jsxs("div",{ref:e,className:"image",children:[y.jsx("img",{src:t,onClick:u,alt:o,title:i}),i&&y.jsx("div",{className:"image-title",children:i}),y.jsx("div",{className:"image-full",onClick:u,children:a?y.jsx(E.Icons.Minimize,{}):y.jsx(E.Icons.Maximize,{})})]}):null},c0=({node:n})=>y.jsx("blockquote",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),u0=50,f0=({node:n})=>{const[e,t]=m.useState([]);return m.useEffect(()=>{if(t([]),!Array.isArray(n.content))return;const r=n.content[0];if(!Array.isArray(r.content))return;let o=[];for(let i=0;i<r.content.length;i++){const l=r.content[i].attrs;if(!l)return;const{colspan:a,colwidth:c}=l;o=o.concat(Array.isArray(c)?c:Array(a).fill(u0))}const s=o.reduce((i,l)=>i+l,0);o=o.map(i=>Math.round(i*100/s)),o[o.length-1]+=100-o.reduce((i,l)=>i+l,0),t(o)},[n]),y.jsxs("table",{children:[e.length>0&&y.jsx("colgroup",{children:e.map((r,o)=>y.jsx("col",{width:`${r}%`},o))}),y.jsx("tbody",{children:Array.isArray(n.content)&&n.content.map((r,o)=>y.jsx(Y,{node:r},o))})]})},d0=({node:n})=>y.jsx("tr",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),h0=({node:n})=>{const[e,t]=m.useState(),[r,o]=m.useState(),[s,i]=m.useState(),[l,a]=m.useState();return m.useEffect(()=>{var c,u,f,d;t((c=n.attrs)==null?void 0:c.halign),o((u=n.attrs)==null?void 0:u.valign),i((f=n.attrs)!=null&&f.rowspan?parseInt(n.attrs.rowspan+""):1),a((d=n.attrs)!=null&&d.colspan?parseInt(n.attrs.colspan+""):1)},[n]),n.type==="table_header"?y.jsx("th",{colSpan:l,rowSpan:s,style:{textAlign:e,verticalAlign:r},children:Array.isArray(n.content)&&n.content.map((c,u)=>y.jsx(Y,{node:c},u))}):y.jsx("td",{colSpan:l,rowSpan:s,style:{textAlign:e,verticalAlign:r},children:Array.isArray(n.content)&&n.content.map((c,u)=>y.jsx(Y,{node:c},u))})},p0=({node:n})=>{var e;if(!Array.isArray(n.content))return null;switch((e=n.attrs)==null?void 0:e.level){case 1:return y.jsx("h1",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 2:return y.jsx("h2",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 3:return y.jsx("h3",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 4:return y.jsx("h4",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 5:return y.jsx("h5",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 6:return y.jsx("h6",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});default:return y.jsx("h2",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))})}},m0=({node:n})=>Array.isArray(n.content)?n.type==="bullet_list"?y.jsx("ul",{children:n.content.map((e,t)=>y.jsx(Y,{node:e},t))}):y.jsx("ol",{children:n.content.map((e,t)=>y.jsx(Y,{node:e},t))}):null,g0=({node:n})=>y.jsx("li",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),y0=({node:n})=>y.jsx("pre",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),b0=()=>y.jsx("hr",{}),x0=({node:n})=>{const[e,t]=m.useState(""),[r,o]=m.useState(""),s="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";return m.useEffect(()=>{var i,l,a,c;t((i=n.attrs)!=null&&i.src?`${(l=n.attrs)==null?void 0:l.src}`:""),o((a=n.attrs)!=null&&a.title?`${(c=n.attrs)==null?void 0:c.title}`:"")},[n]),oo(e)?y.jsx("div",{title:r,className:"video",children:y.jsx("iframe",{src:e,allow:s})}):y.jsx("div",{title:r,className:"image",children:y.jsx("img",{src:ro})})},k0=()=>y.jsx("br",{}),S0=({node:n})=>{const e=m.useRef(null),t=m.useRef(null),[r,o]=m.useState(!1),[s,i]=m.useState(!1),[l,a]=m.useState(!1),[c,u]=m.useState(1),[f,d]=m.useState(1),p=g=>{const k=g.scrollLeft,w=g.clientWidth,M=g.scrollWidth;i(k>w/2),a(k<M-w*1.5),u(Math.round(k/w+1))};m.useEffect(()=>{var g;a(Array.isArray(n.content)&&n.content.length>1),d(((g=n.content)==null?void 0:g.length)??1),u(1)},[n]),m.useEffect(()=>{const g=()=>{o(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",g),()=>document.removeEventListener("fullscreenchange",g)},[]),m.useEffect(()=>{if(!r)return;const g=k=>{k.key==="ArrowLeft"&&b(null,-1),k.key==="ArrowRight"&&b(null,1)};return document.body.addEventListener("keydown",g),()=>document.body.removeEventListener("keydown",g)},[r]);const h=g=>{var k;g.stopPropagation(),r?document.exitFullscreen():(k=t.current)==null||k.requestFullscreen()},b=(g,k)=>{if(g==null||g.stopPropagation(),!e.current)return;const w=e.current.clientWidth;let M=e.current.scrollLeft+k*w;e.current.scrollLeft=M};return Array.isArray(n.content)?y.jsxs("div",{className:"carousel",ref:t,children:[y.jsx("div",{className:"carousel-list",ref:e,onScroll:g=>p(g.currentTarget),children:n.content.map((g,k)=>y.jsx(C0,{node:g,onClick:h},k))}),y.jsxs("div",{className:"carousel-numb",children:[c," / ",f]}),y.jsx("div",{className:"carousel-full",onClick:h,children:r?y.jsx(E.Icons.Minimize,{}):y.jsx(E.Icons.Maximize,{})}),s&&y.jsx("div",{className:"carousel-prev",onClick:g=>b(g,-1),children:y.jsx(E.Icons.ChevronLeft,{})}),l&&y.jsx("div",{className:"carousel-next",onClick:g=>b(g,1),children:y.jsx(E.Icons.ChevronRight,{})})]}):null},C0=({node:n,onClick:e})=>{const[t,r]=m.useState(""),[o,s]=m.useState(""),[i,l]=m.useState("");return m.useEffect(()=>{var d,p,h,b;let a=(d=n.attrs)==null?void 0:d.fid,c=(p=n.attrs)!=null&&p.src?`${n.attrs.src}`:"",u=(h=n.attrs)!=null&&h.alt?`${n.attrs.alt}`:"",f=(b=n.attrs)!=null&&b.title?`${n.attrs.title}`:"";a&&(c=`${no}/files/${a}`),c||(c=ro),r(c),s(u),l(f)},[n]),n.type!=="image"?null:y.jsxs("div",{className:"image",children:[t&&y.jsx("img",{src:t,onClick:e,alt:o,title:i}),i&&y.jsx("div",{className:"image-title",children:i})]})},Y=({node:n,className:e})=>n?(r=>{switch(r.type){case"doc":return y.jsx(l0,{node:r,className:e});case"list_item":return y.jsx(g0,{node:r});case"bullet_list":case"ordered_list":return y.jsx(m0,{node:r});case"image":return y.jsx(a0,{node:r});case"video":return y.jsx(x0,{node:r});case"text":return y.jsx(i0,{node:r});case"table":return y.jsx(f0,{node:r});case"table_row":return y.jsx(d0,{node:r});case"table_cell":case"table_header":return y.jsx(h0,{node:r});case"heading":return y.jsx(p0,{node:r});case"code_block":return y.jsx(y0,{node:r});case"paragraph":return y.jsx(s0,{node:r});case"blockquote":return y.jsx(c0,{node:r});case"carousel":return y.jsx(S0,{node:r});case"horizontal_rule":return y.jsx(b0,{});case"hard_break":return y.jsx(k0,{});default:return y.jsx("span",{className:"unknown_node_type",children:r.type})}})(n):null,w0=({content:n})=>{const[e,t]=m.useState(),[r,o]=m.useState(!1);return m.useEffect(()=>{try{o(!1);const s=JSON.parse(n);t(s)}catch(s){o(!0),console.error(`Can not parse Prose format: ${s}`)}},[n]),r?y.jsx("div",{className:"error",children:"ОШИБКА"}):y.jsx(Y,{node:e,className:"ProseViewer"})},M0=({content:n})=>{const e=m.useRef(null),[t,r]=m.useState(!1);return m.useEffect(()=>{var o;try{r(!1);const s=be.fromJSON(Nt,JSON.parse(n)),i=$e.fromSchema(Nt).serializeFragment(s.content);(o=e.current)==null||o.appendChild(i)}catch(s){r(!0),console.error(`Can not parse Prose format: ${s}`)}},[e,n]),y.jsx("div",{ref:e,className:"ProseViewer",children:t&&y.jsx("div",{className:"error",children:"ОШИБКА"})})};G.DOM=M0,G.Editor=o0,G.Notes=Hb,G.Viewer=w0,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
|
|
65
|
+
*/var Du;function nb(){return Du||(Du=1,process.env.NODE_ENV!=="production"&&function(){function n(s){var i=s,l=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,i.flags&4098&&(l=i.return),s=i.return;while(s)}return i.tag===3?l:null}function e(s){if(n(s)!==s)throw Error("Unable to find node on an unmounted component.")}function t(s){var i=s.alternate;if(!i){if(i=n(s),i===null)throw Error("Unable to find node on an unmounted component.");return i!==s?null:s}for(var l=s,a=i;;){var c=l.return;if(c===null)break;var u=c.alternate;if(u===null){if(a=c.return,a!==null){l=a;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===l)return e(c),s;if(u===a)return e(c),i;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(l.return!==a.return)l=c,a=u;else{for(var f=!1,d=c.child;d;){if(d===l){f=!0,l=c,a=u;break}if(d===a){f=!0,a=c,l=u;break}d=d.sibling}if(!f){for(d=u.child;d;){if(d===l){f=!0,l=u,a=c;break}if(d===a){f=!0,a=u,l=c;break}d=d.sibling}if(!f)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(l.alternate!==a)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(l.tag!==3)throw Error("Unable to find node on an unmounted component.");return l.stateNode.current===l?s:i}function r(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=r(s),i!==null)return i;s=s.sibling}return null}function o(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(s.tag!==4&&(i=o(s),i!==null))return i;s=s.sibling}return null}ve.doesFiberContain=function(s,i){for(var l=s.alternate;i!==null;){if(i===s||i===l)return!0;i=i.return}return!1},ve.findCurrentFiberUsingSlowPath=t,ve.findCurrentHostFiber=function(s){return s=t(s),s!==null?r(s):null},ve.findCurrentHostFiberWithNoPortals=function(s){return s=t(s),s!==null?o(s):null},ve.getContainerFromFiber=function(s){return s.tag===3?s.stateNode.containerInfo:null},ve.getNearestMountedFiber=n,ve.getSuspenseInstanceFromFiber=function(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null},ve.isFiberMounted=function(s){return n(s)===s},ve.isFiberSuspenseAndTimedOut=function(s){var i=s.memoizedState;return s.tag===13&&i!==null&&i.dehydrated===null},ve.isMounted=function(s){return(s=s._reactInternals)?n(s)===s:!1}}()),ve}process.env.NODE_ENV==="production"?Us.exports=tb():Us.exports=nb();var rb=Us.exports;function ob(n){return n._reactInternals}function P0(n){return n}function sb(n){const e=ob(n);if(e===void 0){if(typeof n.render=="function")throw new Error("Unable to find node on an unmounted component.");{const r=Object.keys(n).join(",");throw new Error(`Argument appears to not be a ReactComponent. Keys: ${r}`)}}const t=rb.findCurrentHostFiber(e);return t===null?null:t.stateNode}function ib(n){return sb(n)}function lb(n,e){if(n===e)return!0;if(!n||!e)return!1;const t=Object.keys(n),r=Object.keys(e),o=t.length;if(r.length!==o)return!1;for(let s=0;s<o;s++){const i=t[s];if(n[i]!==e[i]||!Object.prototype.hasOwnProperty.call(e,i))return!1}return!0}class ab extends m.Component{constructor(){super(...arguments);j(this,"viewDescRef",null);j(this,"renderRef",null)}updateEffect(){const{view:t,decorations:r,siblingsRef:o,parentRef:s,getPos:i,node:l}=this.props,a=ib(this);if(!a){if(!(t!=null&&t.composing))return;this.viewDescRef=new eo(s.current,()=>i.current(),document.createElement("div"),document.createTextNode(l.text??""),l.text??"");return}let c=a;for(;c.firstChild;)c=c.firstChild;!this.viewDescRef||this.viewDescRef instanceof eo?this.viewDescRef=new Oy(void 0,[],()=>i.current(),l,r,H.empty,a,c):(this.viewDescRef.parent=s.current,this.viewDescRef.children=[],this.viewDescRef.node=l,this.viewDescRef.getPos=()=>i.current(),this.viewDescRef.outerDeco=r,this.viewDescRef.innerDeco=H.empty,this.viewDescRef.dom=a,this.viewDescRef.dom.pmViewDesc=this.viewDescRef,this.viewDescRef.nodeDOM=c),o.current.includes(this.viewDescRef)||o.current.push(this.viewDescRef),o.current.sort(Kt)}shouldComponentUpdate(t){return!lb(this.props,t)}componentDidMount(){this.updateEffect()}componentDidUpdate(){this.updateEffect()}componentWillUnmount(){const{siblingsRef:t}=this.props;if(this.viewDescRef&&t.current.includes(this.viewDescRef)){const r=t.current.indexOf(this.viewDescRef);t.current.splice(r,1)}}render(){const{view:t,getPos:r,node:o,decorations:s}=this.props;return t!=null&&t.composing&&t.state.selection.from>=r.current()&&t.state.selection.from<=r.current()+o.nodeSize?this.renderRef:(this.renderRef=s.reduce(to,o.text),this.renderRef)}}function cb(n){let{getPos:e}=n;const{siblingsRef:t,parentRef:r}=m.useContext(Ce),o=m.useRef(null),s=m.useRef(null);return J(()=>{const i=t.current;return()=>{if(o.current&&i.includes(o.current)){const l=i.indexOf(o.current);i.splice(l,1)}}},[t]),J(()=>{s.current&&(o.current?(o.current.parent=r.current,o.current.dom=s.current,o.current.getPos=()=>e.current()):o.current=new er(r.current,[],()=>e.current(),s.current,null),t.current.includes(o.current)||t.current.push(o.current),t.current.sort(Kt))}),m.createElement("br",{ref:s,className:"ProseMirror-trailingBreak"})}function ub(n){let{widget:e,getPos:t}=n;const{siblingsRef:r,parentRef:o}=m.useContext(Ce),s=m.useRef(null),i=m.useRef(()=>t.current()).current,l=m.useRef(null);J(()=>{const c=r.current;return()=>{if(s.current&&c.includes(s.current)){const u=c.indexOf(s.current);c.splice(u,1)}}},[r]),J(()=>{l.current&&(s.current?(s.current.parent=o.current,s.current.widget=e,s.current.getPos=()=>t.current(),s.current.dom=l.current):s.current=new Ks(o.current,()=>t.current(),e,l.current),r.current.includes(s.current)||r.current.push(s.current),r.current.sort(Kt))});const{Component:a}=e.type;return a&&m.createElement(a,{ref:l,widget:e,getPos:i,contentEditable:!1})}function to(n,e){const{nodeName:t,...r}=e.type.attrs,o=Su(r);return t||typeof n=="string"?m.createElement(t??"span",o,n):m.cloneElement(n,ku(n.props,o))}function Qs(n,e){var t,r,o;return n.type===e.type&&n.marks.every(s=>s.isInSet(e.marks))&&e.marks.every(s=>s.isInSet(n.marks))&&n.key===e.key&&(n.type==="node"?((t=n.outerDeco)==null?void 0:t.length)===((r=e.outerDeco)==null?void 0:r.length)&&((o=n.outerDeco)==null?void 0:o.every(s=>{var i;return(i=e.outerDeco)==null?void 0:i.some(l=>s.from===l.from&&s.to&&l.to&&s.type.eq(l.type))}))&&n.innerDeco.eq(e.innerDeco):!0)&&n.node===e.node&&n.widget===e.widget}const fb=m.memo(function(e){let{child:t,getInnerPos:r}=e;const{view:o}=m.useContext(wt),s=m.useRef(()=>r.current()+t.offset);return s.current=()=>r.current()+t.offset,t.type==="widget"?m.createElement(ub,{key:t.key,widget:t.widget,getPos:s}):t.type==="native-widget"?m.createElement(Ky,{key:t.key,widget:t.widget,getPos:s}):t.node.isText?m.createElement(Ce.Consumer,{key:t.key},i=>{let{siblingsRef:l,parentRef:a}=i;return m.createElement(ab,{view:o,node:t.node,getPos:s,siblingsRef:l,parentRef:a,decorations:t.outerDeco})}):m.createElement(Nu,{key:t.key,node:t.node,getPos:s,outerDeco:t.outerDeco,innerDeco:t.innerDeco})}),db=m.memo(function(e){let{childViews:t,getInnerPos:r}=e;const o=t[0],s=m.useRef(()=>r.current()+o.offset);s.current=()=>r.current()+o.offset;const i=o.marks[0];return i?m.createElement(wu,{getPos:s,key:o.key,mark:i},m.createElement(Zs,{key:o.key,getInnerPos:r,childViews:t.map(l=>({...l,marks:l.marks.slice(1)}))})):m.createElement(m.Fragment,null,t.map(l=>m.createElement(fb,{key:l.key,child:l,getInnerPos:r})))}),Zs=m.memo(function(e){let{getInnerPos:t,childViews:r}=e;const o=r.reduce((s,i)=>{var c;const l=s[s.length-1];if(!l)return[[i]];const a=l[l.length-1];return a?!i.marks.length&&!a.marks.length||i.marks.length&&a.marks.length&&((c=i.marks[0])!=null&&c.eq(a.marks[0]))?[...s.slice(0,s.length-1),[...l.slice(0,l.length),i]]:[...s,[i]]:[...s.slice(0,s.length),[i]]},[]);return m.createElement(m.Fragment,null,o.map(s=>{const i=s[0];return i?m.createElement(db,{key:i.key,childViews:s,getInnerPos:t}):null}))});function ei(n,e,t,r,o,s){const i=n+e,l=r==null?void 0:r.get(i);if(t==="widget"||t==="native-widget")return o.type.spec.key?o.type.spec.key:(console.warn(`Widget at position ${i} doesn't have a key specified. This may cause issues.`),`${l}-${s}`);if(l)return l;const a=n-1,c=r==null?void 0:r.get(a);return c?`${c}-${e}`:i}function hb(n,e){if(!e||e.widget.type.side>=0||!n||!n.node.isInline)return;const t=n.marks;e.marks=e.marks.reduce((r,o)=>o.addToSet(r),t)}function pb(n,e){if(!e.node.isInline)return;const t=e.marks;for(let r=n.length-1;r>=0;r--){const o=n[r];o.widget.type.side<0||(o.marks=o.marks.reduce((s,i)=>i.addToSet(s),t))}}const mb=m.memo(function(e){let{child:t,getInnerPos:r}=e;const o=m.useRef(()=>r.current()+t.offset);return o.current=()=>r.current()+t.offset,t.type==="node"?t.marks.reduce((s,i)=>m.createElement(wu,{getPos:o,mark:i},s),m.createElement(Nu,{key:t.key,outerDeco:t.outerDeco,node:t.node,innerDeco:t.innerDeco,getPos:o})):m.createElement(Zs,{key:t.key,childViews:[t],getInnerPos:r})});function gb(n,e){return n.length?n.every(t=>t.type!=="node"||t.node.isInline)?[m.createElement(Zs,{key:n[0].key,childViews:n,getInnerPos:e})]:n.map(t=>m.createElement(mb,{key:t.key,child:t,getInnerPos:e})):[]}const tr=m.memo(function(e){let{getPos:t,node:r,innerDecorations:o}=e;const s=Ly(),i=m.useRef(()=>t.current()+1),l=m.useRef(new Map).current;if(!r)return null;const a=new Set;let c=[],u=null;Fy(r,o,(h,b,g,k)=>{const w=h.type.spec.marks??[];let M;if(b){M=ei(i.current(),g,"native-widget",s==null?void 0:s.posToKey,h,k);const I={type:"native-widget",widget:h,marks:w,offset:g,index:k,key:M},C=l.get(M);C&&Qs(C,I)?C.offset=g:l.set(M,I),a.add(M)}else{M=ei(i.current(),g,"widget",s==null?void 0:s.posToKey,h,k);const I={type:"widget",widget:h,marks:w,offset:g,index:k,key:M},C=l.get(M);C&&Qs(C,I)?C.offset=g:l.set(M,I),a.add(M)}const O=l.get(M);c.push(O),hb(u,l.get(M))},(h,b,g,k)=>{const w=ei(i.current(),k,"node",s==null?void 0:s.posToKey),M={type:"node",node:h,marks:h.marks,innerDeco:g,outerDeco:b,offset:k,key:w},O=l.get(w);O&&Qs(O,M)?(O.offset=k,u=O):(l.set(w,M),u=M),a.add(w),pb(c,u),c=[]});for(const h of l.keys())a.has(h)||l.delete(h);const f=Array.from(l.values()).sort((h,b)=>h.offset-b.offset),d=gb(f,i),p=f[f.length-1];return(!p||p.type!=="node"||p.node.isInline&&!p.node.isText||/\n$/.test(p.node.text))&&d.push(m.createElement(eb,{getPos:i,key:"trailing-hack-img"}),m.createElement(cb,{getPos:i,key:"trailing-hack-br"})),m.createElement(m.Fragment,null,d)}),ti={current(){return-1}},yb=m.memo(m.forwardRef(function(e,t){let{className:r,node:o,innerDeco:s,outerDeco:i,as:l,viewDesc:a,...c}=e;const u=m.useRef(null);m.useImperativeHandle(t,()=>u.current,[]);const{childDescriptors:f,nodeViewDescRef:d}=Gs(o,()=>ti.current(),u,u,s,i,a),p=m.useMemo(()=>({parentRef:d,siblingsRef:f}),[f,d]),h={...c,ref:u,className:r,suppressContentEditableWarning:!0},b=l?m.cloneElement(l,h,m.createElement(Ce.Provider,{value:p},m.createElement(tr,{getPos:ti,node:o,innerDecorations:s}))):m.createElement("div",h,m.createElement(Ce.Provider,{value:p},m.createElement(tr,{getPos:ti,node:o,innerDecorations:s})));if(!o)return b;const g=i.filter(w=>!w.inline);return g.length?g.reduce(to,b):b})),Ou=m.createContext(null);function bb(n,e){let{as:t,...r}=n;const o=m.useRef([]),s=m.useRef(null),{setMount:i,...l}=m.useContext(Ou),a=m.useRef(void 0);m.useImperativeHandle(e,()=>s.current,[]);const c=m.useMemo(()=>({parentRef:a,siblingsRef:o}),[o,a]);return m.createElement(Ce.Provider,{value:c},m.createElement(yb,{ref:u=>{s.current=u,i(u)},...r,...l,as:t}))}const Tu=m.forwardRef(bb),xb=[];function kb(n){var h;let{className:e,children:t,nodeViews:r,customNodeViews:o,...s}=n;const[i,l]=m.useState(null),{editor:a,state:c}=$y(i,{...s,nodeViews:o}),u=a.view?ty(a.view,a.cursorWrapper):H.empty,f=a.view?Ug(a.view):xb,d=m.useMemo(()=>({nodeViews:r??{}}),[r]),p=m.useMemo(()=>{var b;return{className:e,setMount:l,node:(b=a.view)==null?void 0:b.state.doc,innerDeco:u,outerDeco:f,viewDesc:a.docViewDescRef.current}},[e,a.docViewDescRef,(h=a.view)==null?void 0:h.state.doc,u,f]);return m.createElement(wt.Provider,{value:a},m.createElement(Xg.Provider,{value:c},m.createElement(qc.Provider,{value:d},m.createElement(Ou.Provider,{value:p},t))))}function vu(n){return m.createElement(jy,null,m.createElement(kb,n))}function re(n){const e=m.useRef(n),{view:t}=m.useContext(wt);return Ke(()=>{e.current=n},[n]),m.useCallback(function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return e.current(t,...o)},[t])}function Au(n){const e=m.useContext(Mu),t=re(n);Ke(()=>{e(t)},[e,t])}const Pu=n=>[Gg(),Ro({Tab:jc(1),"Shift-Tab":jc(-1)}),hm(n.schema),Ro(lm(n.schema)),Ro(Hd),Kd({color:"#F00",width:2}),Ap(),Sd(),pm(n),fy()],Sb=["p",0],Cb=["blockquote",0],wb=["hr"],Mb=["pre",["code",0]],Nb=["br"],Eb={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return Sb}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return Cb}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return wb}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(n){return["h"+n.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return Mb}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(n){return{src:n.getAttribute("src"),title:n.getAttribute("title"),alt:n.getAttribute("alt")}}}],toDOM(n){let{src:e,alt:t,title:r}=n.attrs;return["img",{src:e,alt:t,title:r}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return Nb}}},Db=["em",0],Ob=["strong",0],Tb=["code",0],vb={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(n){return{href:n.getAttribute("href"),title:n.getAttribute("title")}}}],toDOM(n){let{href:e,title:t}=n.attrs;return["a",{href:e,title:t},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:n=>n.type.name=="em"}],toDOM(){return Db}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name=="strong"},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}],toDOM(){return Ob}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return Tb}}},Iu=new gr({nodes:Eb,marks:vb}),Vu=Iu.spec.marks.append({underline:{parseDOM:[{tag:"u"},{style:"font-style=underline"}],toDOM(){return["u",0]}},strikethrough:{parseDOM:[{tag:"s"},{style:"font-style=strike"},{style:"font-style=strikethrough"}],toDOM(){return["s",0]}}}),no="https://dailytelefrag.ru/api",ro="https://dailytelefrag.ru/error_image.png",Ru="https://dailytelefrag.ru/error_embed.png",Ab=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="vkvideo.ru"&&t.hostname!=="vk.com")throw new Error;let r,o;if(t.pathname==="/video_ext.php")r=t.searchParams.get("id"),o=t.searchParams.get("oid");else if(t.pathname.startsWith("/video"))[o,r]=t.pathname.slice(6).split("_");else throw new Error;if(!r||!o)throw new Error;return e?`https://vkvideo.ru/video_ext.php?oid=${o}&id=${r}&hd=2`:!0}catch{return""}},Pb=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="rutube.ru")throw new Error;let r;if(t.pathname.startsWith("/video/"))r=t.pathname.split("/")[2];else if(t.pathname.startsWith("/play/embed/"))r=t.pathname.split("/")[3];else throw new Error;if(!r)throw new Error;return e?`https://rutube.ru/play/embed/${r}`:!0}catch{return""}},Ib=(n,e)=>{try{const t=new URL(n);if(t.hostname!=="youtube.com"&&t.hostname!=="www.youtube.com"&&t.hostname!=="youtu.be")throw new Error;if(t.hostname==="youtu.be")return e?`https://youtube.com/embed${t.pathname}`:!0;let r;if(t.pathname==="/watch")r=t.searchParams.get("v");else if(t.pathname.startsWith("/live/"))r=t.pathname.split("/")[2];else if(t.pathname.startsWith("/embed/"))r=t.pathname.split("/")[2];else throw new Error;if(!r)throw new Error;return e?`https://youtube.com/embed/${r}`:!0}catch{return""}},oo=n=>{try{const e=new URL(n);switch(e.hostname){case"vkvideo.ru":case"vk.com":return Ab(e,!0)+"";case"rutube.ru":return Pb(e,!0)+"";case"youtube.com":case"www.youtube.com":case"youtu.be":return Ib(e,!0)+"";default:throw new Error}}catch{return""}},Vb={atom:!0,attrs:{fid:{default:null,validate:"string|null|number"},src:{default:null,validate:"string|null"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"block",parseDOM:[{tag:"img[src]",getAttrs(n){return{fid:n.getAttribute("fid"),src:n.getAttribute("src"),alt:n.getAttribute("alt"),title:n.getAttribute("title")}}}],toDOM(n){let{fid:e,src:t,alt:r,title:o}=n.attrs;return e&&(t=`${no}/files/${e}`),t||(t=ro),["div",{title:o,class:"image"},["img",{fid:e,src:t,alt:r,title:o}]]}},Rb={atom:!0,attrs:{src:{validate:"string"},title:{default:null,validate:"string|null"}},group:"block",parseDOM:[{tag:"iframe[src]",getAttrs(n){return{src:n.getAttribute("src"),title:n.getAttribute("title")}}}],toDOM(n){const{src:e,title:t}=n.attrs,r="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";return oo(e)?["div",{title:t,class:"video"},["iframe",{src:e,title:t,allow:r}]]:["div",{title:t,class:"image"},["img",{src:Ru}]]}},zb={content:"inline*",group:"block",attrs:{align:{default:null,validate:"string|null"}},parseDOM:[{tag:"p",getAttrs(n){let e=n.getAttribute("align");return e!=="right"&&e!=="center"&&e!=="justify"&&(e=null),{align:e}}}],toDOM(n){const{align:e}=n.attrs;return["p",{align:e},0]}},$b={attrs:{level:{default:1,validate:"number"}},content:"inline*",marks:"underline strikethrough",group:"block",parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(n){return["h"+n.attrs.level,0]}},jb={atom:!0,content:"image*",group:"block",toDOM(){return["div",{class:"carousel"},0]}},zu=Iu.spec.nodes.remove("image").append({image:Vb,video:Rb}),so=new gr({nodes:zu.remove("horizontal_rule").remove("heading"),marks:Vu}),Bb=zu.remove("heading").remove("paragraph").prepend({paragraph:zb}).append({heading:$b}).append({carousel:jb}).append(ug({tableGroup:"block",cellContent:"(paragraph | ordered_list | bullet_list)+",cellAttributes:{halign:{default:null,getFromDOM(n){const e=n.getAttribute("align")||null;return e==="left"||e==="right"||e==="center"?e:null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`text-align: ${n};`)}},valign:{default:null,getFromDOM(n){const e=n.style.verticalAlign||null;return e==="top"||e==="bottom"||e==="middle"?e:null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`vertical-align: ${n};`)}}}})),Nt=new gr({nodes:Wp(Bb,"(paragraph | ordered_list | bullet_list)+","block"),marks:Vu}),Fb=n=>{if(n)try{const e=be.fromJSON(Nt,JSON.parse(n)),t=$e.fromSchema(Nt).serializeFragment(e.content);return Pt.fromSchema(so).parse(t)}catch(e){console.error(`Can not convert content to simple schema: ${e}`)}},nr=({ref:n,item:e})=>{const[t,r]=m.useState(!0),[o,s]=m.useState(!1),[i,l]=m.useState(!1);Ke(c=>{c&&(r(e.isActive&&e.isActive(c.state)),l(e.isSelected&&!e.isSelected(c.state)),e.isDisabled?s(e.isDisabled(c.state)):s(!e.command(c.state)))});const a=re(c=>{c&&(o||e.command(c.state,c.dispatch,c),c.focus())});return i?null:y.jsx("div",{ref:n,className:`MenuItem ${t?"active":""} ${o?"disabled":""}`,onClick:c=>{c.stopPropagation(),c.preventDefault(),a()},children:e.icon})},$u=({schema:n})=>{const[e,t]=m.useState(void 0),[r,o]=m.useState(void 0);return m.useEffect(()=>{if(t(void 0),o(void 0),n.nodes.paragraph){const s=n.nodes.paragraph;t({icon:y.jsx(E.Icons.Type,{}),command:on(s)})}if(n.nodes.code_block){const s=n.nodes.code_block;o({icon:y.jsx(E.Icons.CodeXml,{}),command:on(s)})}},[n]),y.jsxs(y.Fragment,{children:[e&&y.jsx(nr,{item:e}),r&&y.jsx(nr,{item:r})]})},rr=({items:n})=>y.jsx("div",{className:"MenuBlock",children:n.map((e,t)=>y.jsx(nr,{item:e},t))}),Lb=({schema:n,isOpen:e,onClose:t})=>{const r=re((o,s)=>{o&&(ke(n.marks.link,{href:s})(o.state,o.dispatch),t(),o.focus())});return y.jsx(E.Prompt,{title:"Введите URL для ссылки",isOpen:e,onCancel:t,onSubmit:r})},ju=({schema:n})=>{const[e,t]=m.useState([]),[r,o]=m.useState(!1);return m.useEffect(()=>{const s=[];if(n.marks.strong){const i=n.marks.strong;s.push({icon:y.jsx(E.Icons.Bold,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.em){const i=n.marks.em;s.push({icon:y.jsx(E.Icons.Italic,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.underline){const i=n.marks.underline;s.push({icon:y.jsx(E.Icons.Underline,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.strikethrough){const i=n.marks.strikethrough;s.push({icon:y.jsx(E.Icons.Strikethrough,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.code){const i=n.marks.code;s.push({icon:y.jsx(E.Icons.Code,{}),command:ke(i),isActive:l=>Jt(l,i)})}if(n.marks.link){const i=n.marks.link;s.push({icon:y.jsx(E.Icons.Link,{}),isActive:l=>Jt(l,i),isDisabled:l=>l.selection.empty?!0:!ke(i)(l),command:(l,a,c)=>(Jt(l,i)?(ke(i)(l,a),c==null||c.focus()):o(!0),!0)})}t(s)},[n]),e.length<1?null:y.jsxs(y.Fragment,{children:[y.jsx(rr,{items:e}),y.jsx(Lb,{isOpen:r,schema:n,onClose:()=>o(!1)})]})};function Jt(n,e){let{from:t,$from:r,to:o,empty:s}=n.selection;return s?!!e.isInSet(n.storedMarks||r.marks()):n.doc.rangeHasMark(t,o,e)}const Bu=()=>y.jsxs("div",{className:"MenuBlock",children:[y.jsx(nr,{item:{icon:y.jsx(E.Icons.Undo,{}),command:Ao}}),y.jsx(nr,{item:{icon:y.jsx(E.Icons.Redo,{}),command:Mr}})]}),Fu=({schema:n})=>{const[e,t]=m.useState([]);return m.useEffect(()=>{const r=[];if(n.nodes.bullet_list){const o=n.nodes.bullet_list;r.push({icon:y.jsx(E.Icons.List,{}),command:(s,i)=>Rr(o)(s,i)})}if(n.nodes.ordered_list){const o=n.nodes.ordered_list;r.push({icon:y.jsx(E.Icons.ListOrdered,{}),command:(s,i)=>Rr(o)(s,i)})}if(n.nodes.blockquote){const o=n.nodes.blockquote;r.push({icon:y.jsx(E.Icons.Quote,{}),command:(s,i)=>Cl(o)(s,i)})}t(r)},[n]),e.length<1?null:y.jsx(rr,{items:e})},Lu=({pos:n,isOpen:e,onClose:t})=>{const[r,o]=m.useState(""),[s,i]=m.useState(),[l,a]=m.useState(""),[c,u]=m.useState(!1);m.useEffect(()=>{o(""),a(""),i(void 0)},[e]),Ke(d=>{if(!d||!e)return;const p=tt.getState(d.state);u(p.upload!==void 0)},[e]);const f=re(d=>{d&&(c?gm(d,s,l,n):ym(d,r,l,n),d.focus(),t())});return y.jsxs(E.Modal,{isOpen:e,onClose:t,children:[y.jsx("h1",{children:"Вставка картинки"}),y.jsxs(E.Form,{submit:"Вставить",submitType:"Success",onSubmit:f,onCancel:t,children:[c?y.jsx(E.Image,{id:"image",value:s,onChange:i,text:y.jsxs("span",{children:[y.jsx(E.Icons.Image,{}),y.jsx("br",{}),"Выберите файл"]}),required:!0,label:"Картинка"}):y.jsx(E.Input,{id:"href",value:r,onChange:o,required:!0,label:"Ссылка на картинку"}),y.jsx(E.Input,{id:"value",value:l,onChange:a,label:"Подпись"})]})]})},Wb=({schema:n,isOpen:e,onClose:t})=>{const[r,o]=m.useState(""),[s,i]=m.useState("");m.useEffect(()=>{o(""),i("")},[e]);const l=re(a=>{const c=n.nodes.video;if(!a||!r||!c)return;const u=oo(r);a.dispatch(a.state.tr.replaceSelectionWith(c.create({src:u,title:s}))),a.focus(),t()});return n.nodes.video?y.jsxs(E.Modal,{isOpen:e,onClose:t,children:[y.jsx("h1",{children:"Вставка видео"}),y.jsxs(E.Form,{submit:"Вставить",submitType:"Success",onSubmit:l,onCancel:t,children:[y.jsx(E.Input,{id:"src",value:r,onChange:o,label:"Ссылка на видео",bottom:"Поддерживаются VK Video, RuTube и YouTube",required:!0}),y.jsx(E.Input,{id:"value",value:s,onChange:i,label:"Подпись"})]})]}):null},Wu=({schema:n})=>{const[e,t]=m.useState([]),[r,o]=m.useState(!1),[s,i]=m.useState(!1);return m.useEffect(()=>{const l=[];if(n.nodes.image){const a=n.nodes.image;l.push({icon:y.jsx(E.Icons.Image,{}),isDisabled:c=>!ni(c,a),command:()=>(o(!0),!0)})}if(n.nodes.video){const a=n.nodes.video;l.push({icon:y.jsx(E.Icons.Film,{}),isDisabled:c=>!ni(c,a),command:()=>(i(!0),!0)})}if(n.nodes.horizontal_rule){const a=n.nodes.horizontal_rule;l.push({icon:y.jsx(E.Icons.FlipVertical,{}),isDisabled:c=>!ni(c,a),command:(c,u)=>u?(u(c.tr.replaceSelectionWith(a.create())),!0):!1})}n.nodes.table&&l.push({icon:y.jsx(E.Icons.Table,{}),isDisabled:Oe,command:_b()}),t(l)},[n]),e.length<1?null:y.jsxs(y.Fragment,{children:[y.jsx(rr,{items:e}),y.jsx(Lu,{isOpen:r,onClose:()=>o(!1)}),y.jsx(Wb,{isOpen:s,schema:n,onClose:()=>i(!1)})]})},ni=(n,e)=>{let t=n.selection.$from;for(let r=t.depth;r>=0;r--){let o=t.index(r);if(t.node(r).canReplaceWith(o,o,e))return!0}return!1};function _b(){return(n,e)=>{const t=n.tr.selection.anchor+1,r=n.tr,o=n.schema.nodes.table_cell.createAndFill(),s=n.schema.nodes.table.create(null,S.fromArray([n.schema.nodes.table_row.create(null,S.fromArray([o,o,o])),n.schema.nodes.table_row.create(null,S.fromArray([o,o,o]))]));return e&&e(r.replaceSelectionWith(s).scrollIntoView().setSelection(P.near(r.doc.resolve(t)))),!0}}const _u=({schema:n})=>n.nodes.carousel?y.jsx(rr,{items:[{icon:y.jsx(E.Icons.JoinUp,{}),command:bl},{icon:y.jsx(E.Icons.IndentDecrease,{}),command:$o},{icon:y.jsx(E.Icons.SquareDashed,{}),command:Bo}]}):y.jsx(rr,{items:[{icon:y.jsx(E.Icons.IndentDecrease,{}),command:$o},{icon:y.jsx(E.Icons.SquareDashed,{}),command:Bo}]}),qb=({schema:n})=>y.jsxs("div",{className:"SimpleMenuBar",children:[y.jsx("div",{className:"MenuBlock",children:y.jsx($u,{schema:n})}),y.jsx(ju,{schema:n}),y.jsx(Wu,{schema:n}),y.jsx(Fu,{schema:n}),y.jsx(_u,{schema:n}),y.jsx(Bu,{})]}),qu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const[s,i]=m.useState(t.node.attrs.alt??""),[l,a]=m.useState(t.node.attrs.title??""),[c,u]=m.useState(!1),[f,d]=m.useState("");Au((k,w)=>k?!(w instanceof MouseEvent):!1),Ke(k=>{if(d(""),u(!1),!k||!k.state.schema.nodes.carousel)return;const w=t.getPos(),M=k.state.doc.resolve(w).parent;if(u(M.type.name!=="carousel"),M.type.name==="carousel"){let O=0;M.forEach((I,C)=>{I===t.node&&(O=C+1)}),d(O?`${O} / ${M.childCount}`:"")}});const p=re((k,w)=>{if(!k)return;i(w);const M=k.state.tr,O=t.getPos();k.dispatch(M.setNodeMarkup(O,null,{...t.node.attrs,alt:w})),k.focus()}),h=re((k,w)=>{if(!k)return;a(w);const M=k.state.tr,O=t.getPos();k.dispatch(M.setNodeMarkup(O,null,{...t.node.attrs,title:w})),k.focus()}),b=re(k=>{if(!k)return;const w=t.getPos(),M=t.node.nodeSize,O=t.node.attrs,I=k.state.schema,C=I.nodes.carousel.create(null,I.nodes.image.create(O));k.dispatch(k.state.tr.replaceWith(w,w+M,C))}),g=re(k=>{if(!k)return;const w=k.state.tr,M=t.getPos(),O=t.node.nodeSize;k.dispatch(w.delete(M,M+O))});return y.jsxs("div",{...r,ref:o,className:"image",title:t.node.attrs.title,children:[y.jsxs("div",{className:"image-buttons",children:[c&&y.jsx("div",{onClick:b,className:"text-button",children:"Сделать карусель"}),f&&y.jsx("div",{className:"text-button",children:f}),y.jsx("div",{onClick:g,children:y.jsx(E.Icons.Trash,{})})]}),y.jsx("div",{children:y.jsx(E.Editable,{value:s,placeholder:"Alt: описание изображения (не обязательно)",onChange:p,empty:!0,style:{textAlign:"center",cursor:"text"}})}),y.jsx("img",{title:t.node.attrs.title,alt:t.node.attrs.alt,src:t.node.attrs.fid?`${no}/files/${t.node.attrs.fid}`:t.node.attrs.src}),y.jsx("div",{children:y.jsx(E.Editable,{value:l,placeholder:"Title: подпись под изображением (не обязательно)",onChange:h,empty:!0,style:{textAlign:"center",cursor:"text"}})})]})}),Hu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const[s,i]=m.useState(""),[l,a]=m.useState(t.node.attrs.title??""),c="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";Au(()=>!0),m.useEffect(()=>{i(oo(t.node.attrs.src))},[t]);const u=re((f,d)=>{if(!f)return;a(d);const{$from:p,$to:h}=f.state.selection,b=p.blockRange(h);if(b){const g=f.state.doc;let k=f.state.tr;g.nodesBetween(b.start,b.end,(w,M)=>{w.type.name==="video"&&(k=k.setNodeMarkup(M,null,{...t.node.attrs,title:d}))}),f.dispatch(k)}f.focus()});return y.jsxs("div",{...r,ref:o,className:s?"video":"image",title:t.node.attrs.title,children:[s?y.jsx("iframe",{src:s,allow:c}):y.jsx("img",{src:Ru}),y.jsx("div",{children:y.jsx(E.Editable,{value:l,placeholder:"Подпись под видео (не обязательно)",onChange:u,empty:!0,style:{textAlign:"center",cursor:"text"}})})]})}),Ku=({onSave:n,disabled:e=!1,notEmpty:t=!0,wasChanged:r=!0})=>{const[o,s]=m.useState(!0);Ke(l=>{let a=!1;const c=l.state.doc,u=!!c.textBetween(0,c.content.size,void 0," ").length,f=!!Po(l.state);r&&t?a=u&&f:r?a=f:t&&(a=u),s(a)});const i=re(l=>{try{let a;const c=Is(l.state);if(c){const u=l.state.apply(c.setMeta("addToHistory",!1));a=JSON.stringify(u.doc.toJSON())}else a=JSON.stringify(l.state.doc.toJSON());n({content:a,format:"prose"})}catch(a){console.error(`Can not save doc: ${a}`)}});return y.jsx(E.Button,{type:"Accent",disabled:e||!o,label:"Сохранить",size:"Small",onClick:i})},Hb=({title:n=!1,content:e,onSave:t,onCancel:r,onChange:o,onUpload:s})=>{const[i,l]=m.useState(""),[a,c]=m.useState();m.useEffect(()=>{const p=Ge.create({doc:Fb(e),schema:so,plugins:Pu({schema:so,upload:s})});c(p),n!==!1&&l(typeof n=="string"?n:"")},[n,e]);const u=()=>n!==!1?i.trim().length>0:!0,f=p=>{!t||!u()||t({...p,name:i})},d=()=>{r&&r()};return a?y.jsxs("div",{className:"ProseNotes",children:[n!==!1&&y.jsx("input",{className:"ProseNotesTitle",onChange:p=>l(p.currentTarget.value),value:i,placeholder:"Укажите заголовок"}),y.jsxs(vu,{state:a,dispatchTransaction:p=>c(h=>{const b=h==null?void 0:h.apply(p);return b&&o&&o(!!Po(b)),b}),nodeViews:{image:qu,video:Hu},children:[y.jsxs("div",{className:"ProseNotesContent",children:[y.jsx(qb,{schema:so}),y.jsx(Tu,{})]}),(t||r)&&y.jsxs("div",{className:"ProseNotesButtons",children:[r&&y.jsx("span",{className:"a small",onClick:d,children:"Отменить"}),t&&y.jsx(Ku,{onSave:f,disabled:!u(),wasChanged:!1})]})]})]}):null},Kb=({schema:n})=>{const e=m.useRef(null),[t,r]=m.useState([]),[o,s]=m.useState([]),[i,l]=m.useState(!1);Ke(c=>{const u=n.nodes.heading;if(!c||!u||!i)return;const f=[],d=[];for(let p=2;p<7;p++){const b=on(u,{level:p});d[p]=b,f[p]={id:p,icon:y.jsx(Jb,{level:p}),text:`уровень ${p}`,disabled:!b(c.state)}}r(f),s(d)},[i]);const a=re((c,u)=>{!c||!u.id||(o[u.id](c.state,c.dispatch,c),l(!1),c.focus())});return n.nodes.heading?y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:e,className:"MenuItem",onClick:()=>l(!0),children:y.jsx(E.Icons.Heading,{})}),e.current&&y.jsx(E.Menu,{parent:e.current,items:t,isOpen:i,onClose:()=>l(!1),onClick:a,horizontal:"inner-left"})]}):null},Jb=({level:n})=>{switch(n){case 2:return y.jsx(E.Icons.Heading2,{});case 3:return y.jsx(E.Icons.Heading3,{});case 4:return y.jsx(E.Icons.Heading4,{});case 5:return y.jsx(E.Icons.Heading5,{});case 6:return y.jsx(E.Icons.Heading6,{});default:return y.jsx(E.Icons.Heading,{})}},Yb=[{id:"left",icon:y.jsx(E.Icons.AlignLeft,{}),text:"Прижать влево"},{id:"right",icon:y.jsx(E.Icons.AlignRight,{}),text:"Прижать вправо"},{id:"center",icon:y.jsx(E.Icons.AlignCenter,{}),text:"Отцентровать"},{id:"justify",icon:y.jsx(E.Icons.AlignJustify,{}),text:"Выровнять по краям"}],Gb=({schema:n})=>{const e=m.useRef(null),[t,r]=m.useState(!1),o=re((s,i)=>{if(!s||!i.id)return;const l=i.id==="left"?null:i.id,{$from:a,$to:c}=s.state.selection,u=a.blockRange(c);if(u){const f=s.state.doc;let d=s.state.tr;f.nodesBetween(u.start,u.end,(p,h)=>{p.type.name==="paragraph"&&(d=d.setNodeMarkup(h,null,{align:l}))}),s.dispatch(d)}s.focus(),r(!1)});return n.nodes.paragraph?y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:e,className:"MenuItem",onClick:()=>r(!0),children:y.jsx(E.Icons.AlignLeft,{})}),e.current&&y.jsx(E.Menu,{parent:e.current,items:Yb,isOpen:t,onClose:()=>r(!1),onClick:o,horizontal:"inner-left"})]}):null},Xb=({schema:n,onSave:e})=>y.jsxs("div",{className:"MenuBar",children:[y.jsxs("div",{className:"MenuBlock",children:[y.jsx(Kb,{schema:n}),y.jsx($u,{schema:n})]}),y.jsx(ju,{schema:n}),y.jsx(Wu,{schema:n}),y.jsx(Fu,{schema:n}),y.jsx(Gb,{schema:n}),y.jsx(_u,{schema:n}),y.jsx(Bu,{}),y.jsx("div",{className:"MenuBlock",children:y.jsx(Ku,{onSave:e})})]}),Ub=7,Ju=1,or=50,Qb=({width:n,onChange:e,onWidth:t})=>{const[r,o]=m.useState(!1),[s,i]=m.useState(0),[l,a]=m.useState(0),[c,u]=m.useState(n),f=h=>{const b=n[l],g=n[l+1],k=[...c];return b+h<or&&(h=or-b),g-h<or&&(h=g-or),k[l]=b+h,k[l+1]=g-h,k};m.useEffect(()=>{u(n)},[n]),m.useEffect(()=>{const h=g=>{if(!r)return;o(!1),g.preventDefault(),g.stopPropagation();const k=g.clientX-s,w=f(k);t(w)},b=g=>{if(!r)return;g.preventDefault(),g.stopPropagation();const k=g.clientX-s,w=f(k);u(w),e(w)};return document.addEventListener("mouseup",h),document.addEventListener("mousemove",b),()=>{document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",b)}},[r,l]);const d=(h,b)=>{b!==n.length-1&&(h.preventDefault(),h.stopPropagation(),o(!0),i(h.clientX),a(b))},p=h=>c.slice(0,h+1).reduce((b,g)=>b+g,0)+h+Ju-Math.floor(Ub/2);return y.jsx("div",{className:"table-resizer",children:c.map((h,b)=>y.jsx("div",{style:{left:p(b)+"px"},onMouseDown:g=>d(g,b)},b))})},Zb=m.forwardRef(function({children:e,nodeProps:t,...r},o){var f;const s=m.useRef(null),i=m.useRef(null),[l,a]=m.useState([]),c=re((d,p)=>{if(!d)return;const h=t.node,b=t.getPos()+1,g=Q.get(h),k=d.state.tr;for(let w=0;w<g.height;w++)for(let M=0;M<g.width;){const O=w*g.width+M,I=g.map[O],C=h.nodeAt(I).attrs,V=p.slice(M,M+C.colspan);w&&g.map[O]==g.map[O-g.width]||k.setNodeMarkup(b+I,null,{...C,colwidth:V}),M+=C.colspan}k.docChanged&&d.dispatch(k)});m.useEffect(()=>{if(!s.current||!i.current)return;const p=t.node.firstChild;if(!p)return;let h=[];for(let C=0;C<p.childCount;C++){const V=p.child(C),{colspan:z,colwidth:T}=V.attrs;h=h.concat(Array.isArray(T)?T:Array(z).fill(0))}const b=h.filter(C=>!C).length,g=h.reduce((C,V)=>C+V,0),k=(h.length+1)*Ju,w=Math.max(b?(s.current.offsetWidth-g-k)/b:0,or);h=h.map(C=>C||w);const M=h.reduce((C,V)=>C+V,0),O=i.current.offsetWidth-k-16,I=O/M;h=h.map(C=>Math.round(C*I)),h[h.length-1]+=O-h.reduce((C,V)=>C+V,0),a(h)},[t,s,i,(f=i.current)==null?void 0:f.offsetWidth]);const u=re(d=>{Fg(d.state,d.dispatch)});return y.jsxs("div",{...r,className:"table-wrapper",ref:d=>{i.current=d,o&&(typeof o=="function"?o(d):o.current=d)},children:[y.jsx(Qb,{width:l,onChange:a,onWidth:c}),y.jsxs("table",{ref:s,children:[y.jsx("colgroup",{children:l.map((d,p)=>y.jsx("col",{width:d},p))}),y.jsx("caption",{onClick:u,children:y.jsx(E.Icons.Trash,{})}),y.jsx("tbody",{children:e})]})]})}),e0=[{id:"toggleHeaderRow",text:"Toggle header row",icon:y.jsx(E.Icons.Heading,{})},{id:"addRowBefore",text:"Insert row before",icon:y.jsx(E.Icons.RowInsertBefore,{})},{id:"addRowAfter",text:"Insert row after",icon:y.jsx(E.Icons.RowInsertAfter,{})},{id:"deleteRow",text:"Delete row",icon:y.jsx(E.Icons.Trash,{})}],t0=[{id:"toggleHeaderColumn",text:"Toggle header column",icon:y.jsx(E.Icons.Heading,{})},{id:"addColumnBefore",text:"Insert column before",icon:y.jsx(E.Icons.ColumnInsertBefore,{})},{id:"addColumnAfter",text:"Insert column after",icon:y.jsx(E.Icons.ColumnInsertAfter,{})},{id:"deleteColumn",text:"Delete column",icon:y.jsx(E.Icons.Trash,{})}],n0=[{id:"toggleHeaderCell",text:"Toggle header",icon:y.jsx(E.Icons.Heading,{})},{id:"alignLeft",text:"Horizontal align left",icon:y.jsx(E.Icons.AlignLeft,{})},{id:"alignCenter",text:"Horizontal align center",icon:y.jsx(E.Icons.AlignCenter,{})},{id:"alignRight",text:"Horizontal align Right",icon:y.jsx(E.Icons.AlignRight,{})},{id:"alignTop",text:"Vertical align top",icon:y.jsx(E.Icons.AlignTop,{})},{id:"alignMiddle",text:"Vertical align middle",icon:y.jsx(E.Icons.AlignMiddle,{})},{id:"alignBottom",text:"Vertical align bottom",icon:y.jsx(E.Icons.AlignBottom,{})},{id:"mergeCells",text:"Merge cells",icon:y.jsx(E.Icons.CellsMerge,{})},{id:"splitCell",text:"Split cell",icon:y.jsx(E.Icons.CellsSplit,{})}],Yu=({parent:n,isRowMenuOpen:e,isCellMenuOpen:t,isColumnMenuOpen:r,onRowMenuClose:o,onCellMenuClose:s,onColumnMenuClose:i})=>{const l=re((a,c)=>{if(a){switch(c.id){case"toggleHeaderRow":zg(a.state,a.dispatch);break;case"addRowBefore":Dg(a.state,a.dispatch);break;case"addRowAfter":Og(a.state,a.dispatch);break;case"deleteRow":vg(a.state,a.dispatch);break;case"toggleHeaderColumn":$g(a.state,a.dispatch);break;case"addColumnBefore":Cg(a.state,a.dispatch);break;case"addColumnAfter":wg(a.state,a.dispatch);break;case"deleteColumn":Ng(a.state,a.dispatch);break;case"mergeCells":Pg(a.state,a.dispatch);break;case"splitCell":Ig(a.state,a.dispatch);break;case"toggleHeaderCell":jg(a.state,a.dispatch);break;case"alignLeft":mn("halign","left")(a.state,a.dispatch);break;case"alignCenter":mn("halign","center")(a.state,a.dispatch);break;case"alignRight":mn("halign","right")(a.state,a.dispatch);break;case"alignTop":mn("valign","top")(a.state,a.dispatch);break;case"alignMiddle":mn("valign","middle")(a.state,a.dispatch);break;case"alignBottom":mn("valign","bottom")(a.state,a.dispatch);break}o(),s(),i(),a.focus()}});return n?y.jsxs(y.Fragment,{children:[y.jsx(E.Menu,{parent:n,items:e0,isOpen:e,onClose:o,onClick:l,vertical:"top",horizontal:"inner-left"}),y.jsx(E.Menu,{parent:n,items:n0,isOpen:t,onClose:s,onClick:l,horizontal:"inner-left"}),y.jsx(E.Menu,{parent:n,items:t0,isOpen:r,onClose:i,onClick:l,vertical:"top",horizontal:"inner-left",margin:"var(--alxgrn-unit)"})]}):null},Gu=m.forwardRef(function({children:e,nodeProps:t,...r},o){const s=m.useRef(null),[i,l]=m.useState(!1),[a,c]=m.useState(!1),[u,f]=m.useState(!1);m.useEffect(()=>{const h=b=>{s.current!==b.target&&(l(!1),c(!1),f(!1))};return document.addEventListener("contextmenu",h,!0),()=>document.removeEventListener("contextmenu",h,!0)},[]);const d=h=>{h.preventDefault(),h.stopPropagation(),l(!1),c(!1),f(!1);const b=h.currentTarget.getBoundingClientRect();h.clientY<b.y?f(!0):h.clientX<b.x?l(!0):c(!0)},p=h=>{l(!1),c(!1),f(!1);const b=h.currentTarget.getBoundingClientRect();if(h.clientY<b.y)f(!0);else if(h.clientX<b.x)l(!0);else return;h.preventDefault(),h.stopPropagation()};return t.node.type.spec.tableRole==="header_cell"?y.jsxs("th",{...r,datatype:`width-${t.node.attrs.colwidth}`,colSpan:t.node.attrs.colspan,rowSpan:t.node.attrs.rowspan,style:{textAlign:t.node.attrs.halign,verticalAlign:t.node.attrs.valign},onClick:p,onContextMenu:d,ref:h=>{s.current=h,o&&(typeof o=="function"?o(h):o.current=h)},children:[e,y.jsx(Yu,{parent:s.current,isRowMenuOpen:i,onRowMenuClose:()=>l(!1),isCellMenuOpen:a,onCellMenuClose:()=>c(!1),isColumnMenuOpen:u,onColumnMenuClose:()=>f(!1)})]}):y.jsxs("td",{...r,datatype:`width-${t.node.attrs.colwidth}`,colSpan:t.node.attrs.colspan,rowSpan:t.node.attrs.rowspan,style:{textAlign:t.node.attrs.halign,verticalAlign:t.node.attrs.valign},onClick:p,onContextMenu:d,ref:h=>{s.current=h,o&&(typeof o=="function"?o(h):o.current=h)},children:[e,y.jsx(Yu,{parent:s.current,isRowMenuOpen:i,onRowMenuClose:()=>l(!1),isCellMenuOpen:a,onCellMenuClose:()=>c(!1),isColumnMenuOpen:u,onColumnMenuClose:()=>f(!1)})]})}),r0=m.forwardRef(function({children:e,nodeProps:t,...r},o){var I;const s=m.useRef(null),[i,l]=m.useState(!1),[a,c]=m.useState(!1),[u,f]=m.useState(!1),[d,p]=m.useState(),[h,b]=m.useState(),g=C=>{const V=C.scrollLeft,z=C.clientWidth,T=C.scrollWidth;c(V>0),f(V<T-z*1.5)};m.useEffect(()=>{s.current&&(h&&s.current.scrollWidth>h&&(s.current.scrollLeft=s.current.scrollWidth-s.current.clientWidth),b(s.current.scrollWidth))},[(I=s.current)==null?void 0:I.scrollWidth]),m.useEffect(()=>{p(t.getPos()+t.node.nodeSize-1),s.current&&t.node.childCount>1&&g(s.current)},[t,s]),Ke(C=>{if(!C||t.node.childCount>0)return;const V=C.state.tr,z=t.getPos(),T=t.node.nodeSize;C.dispatch(V.delete(z,z+T))},[t]);const k=re(C=>{if(!C)return;const V=t.getPos(),z=t.node.nodeSize;C.dispatch(C.state.tr.delete(V,V+z))}),w=()=>{l(!0)},M=C=>{g(C.currentTarget)},O=(C,V)=>{if(C.stopPropagation(),!s.current)return;const z=s.current.clientWidth;let T=s.current.scrollLeft+V*z;s.current.scrollLeft=T};return y.jsxs("div",{ref:o,...r,className:"carousel",children:[y.jsx("div",{className:"carousel-list",ref:s,onScroll:M,children:e}),y.jsxs("div",{className:"carousel-buttons",children:[y.jsx("div",{onClick:k,className:"text-button",children:"Удалить карусель"}),y.jsx("div",{onClick:w,children:y.jsx(E.Icons.Plus,{})})]}),a&&y.jsx("div",{className:"carousel-prev",onClick:C=>O(C,-1),children:y.jsx(E.Icons.ChevronLeft,{})}),u&&y.jsx("div",{className:"carousel-next",onClick:C=>O(C,1),children:y.jsx(E.Icons.ChevronRight,{})}),y.jsx(Lu,{pos:d,isOpen:i,onClose:()=>l(!1)})]})}),o0=({content:n,onSave:e,onChange:t,onUpload:r})=>{const[o,s]=m.useState();return m.useEffect(()=>{let i;if(n)try{i=be.fromJSON(Nt,JSON.parse(n))}catch(c){console.error(`Can not parse Prose format: ${c}`)}let l=Ge.create({doc:i,schema:Nt,plugins:Pu({schema:Nt,upload:r})});const a=Is(l);a&&(l=l.apply(a.setMeta("addToHistory",!1))),s(l)},[n]),o?y.jsx("div",{className:"ProseEditor",children:y.jsxs(vu,{state:o,dispatchTransaction:i=>s(l=>{const a=l==null?void 0:l.apply(i);return a&&t&&t(!!Po(a)),a}),nodeViews:{image:qu,video:Hu,table:Zb,table_header:Gu,table_cell:Gu,carousel:r0},children:[y.jsx(Xb,{schema:Nt,onSave:e}),y.jsx(Tu,{})]})}):null},s0=({node:n})=>{const[e,t]=m.useState();return m.useEffect(()=>{var o;const r=(o=n.attrs)==null?void 0:o.align;t(r!=="right"&&r!=="center"&&r!=="justify"?void 0:{textAlign:r})},[n]),y.jsx("p",{style:e,children:Array.isArray(n.content)&&n.content.map((r,o)=>y.jsx(Y,{node:r},o))})},i0=({node:n})=>{if(!n.text)return null;const e=(t,r)=>{var i;if(!Array.isArray(n.marks))return y.jsx(y.Fragment,{children:r});if(!t.length)return y.jsx(y.Fragment,{children:r});const o=t[0].type,s=(i=t[0].attrs)==null?void 0:i.href;switch(o){case"em":return y.jsx("em",{children:e(t.slice(1),r)});case"code":return y.jsx("code",{children:e(t.slice(1),r)});case"strong":return y.jsx("strong",{children:e(t.slice(1),r)});case"underline":return y.jsx("u",{children:e(t.slice(1),r)});case"strikethrough":return y.jsx("s",{children:e(t.slice(1),r)});case"link":return s?y.jsx("a",{target:"_blank",href:s,children:e(t.slice(1),r)}):y.jsx(y.Fragment,{children:e(t.slice(1),r)});default:return y.jsx(y.Fragment,{children:e(t.slice(1),r)})}};return e(n.marks,n.text)},l0=({node:n,className:e})=>y.jsx("div",{className:e,children:Array.isArray(n.content)&&n.content.map((t,r)=>y.jsx(Y,{node:t},r))}),a0=({node:n})=>{const e=m.useRef(null),[t,r]=m.useState(""),[o,s]=m.useState(""),[i,l]=m.useState(""),[a,c]=m.useState(!1);m.useEffect(()=>{const f=()=>{c(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",f),()=>document.removeEventListener("fullscreenchange",f)},[]),m.useEffect(()=>{var p,h,b,g,k,w,M;let f=(p=n.attrs)==null?void 0:p.fid,d=(h=n.attrs)!=null&&h.src?`${(b=n.attrs)==null?void 0:b.src}`:"";f&&(d=`${no}/files/${f}`),d||(d=ro),r(d),s((g=n.attrs)!=null&&g.alt?`${(k=n.attrs)==null?void 0:k.alt}`:""),l((w=n.attrs)!=null&&w.title?`${(M=n.attrs)==null?void 0:M.title}`:"")},[n]);const u=f=>{var d;f.stopPropagation(),a?document.exitFullscreen():(d=e.current)==null||d.requestFullscreen()};return t?y.jsxs("div",{ref:e,className:"image",children:[y.jsx("img",{src:t,onClick:u,alt:o,title:i}),i&&y.jsx("div",{className:"image-title",children:i}),y.jsx("div",{className:"image-full",onClick:u,children:a?y.jsx(E.Icons.Minimize,{}):y.jsx(E.Icons.Maximize,{})})]}):null},c0=({node:n})=>y.jsx("blockquote",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),u0=50,f0=({node:n})=>{const[e,t]=m.useState([]);return m.useEffect(()=>{if(t([]),!Array.isArray(n.content))return;const r=n.content[0];if(!Array.isArray(r.content))return;let o=[];for(let i=0;i<r.content.length;i++){const l=r.content[i].attrs;if(!l)return;const{colspan:a,colwidth:c}=l;o=o.concat(Array.isArray(c)?c:Array(a).fill(u0))}const s=o.reduce((i,l)=>i+l,0);o=o.map(i=>Math.round(i*100/s)),o[o.length-1]+=100-o.reduce((i,l)=>i+l,0),t(o)},[n]),y.jsxs("table",{children:[e.length>0&&y.jsx("colgroup",{children:e.map((r,o)=>y.jsx("col",{width:`${r}%`},o))}),y.jsx("tbody",{children:Array.isArray(n.content)&&n.content.map((r,o)=>y.jsx(Y,{node:r},o))})]})},d0=({node:n})=>y.jsx("tr",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),h0=({node:n})=>{const[e,t]=m.useState(),[r,o]=m.useState(),[s,i]=m.useState(),[l,a]=m.useState();return m.useEffect(()=>{var c,u,f,d;t((c=n.attrs)==null?void 0:c.halign),o((u=n.attrs)==null?void 0:u.valign),i((f=n.attrs)!=null&&f.rowspan?parseInt(n.attrs.rowspan+""):1),a((d=n.attrs)!=null&&d.colspan?parseInt(n.attrs.colspan+""):1)},[n]),n.type==="table_header"?y.jsx("th",{colSpan:l,rowSpan:s,style:{textAlign:e,verticalAlign:r},children:Array.isArray(n.content)&&n.content.map((c,u)=>y.jsx(Y,{node:c},u))}):y.jsx("td",{colSpan:l,rowSpan:s,style:{textAlign:e,verticalAlign:r},children:Array.isArray(n.content)&&n.content.map((c,u)=>y.jsx(Y,{node:c},u))})},p0=({node:n})=>{var e;if(!Array.isArray(n.content))return null;switch((e=n.attrs)==null?void 0:e.level){case 1:return y.jsx("h1",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 2:return y.jsx("h2",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 3:return y.jsx("h3",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 4:return y.jsx("h4",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 5:return y.jsx("h5",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});case 6:return y.jsx("h6",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))});default:return y.jsx("h2",{children:n.content.map((t,r)=>y.jsx(Y,{node:t},r))})}},m0=({node:n})=>Array.isArray(n.content)?n.type==="bullet_list"?y.jsx("ul",{children:n.content.map((e,t)=>y.jsx(Y,{node:e},t))}):y.jsx("ol",{children:n.content.map((e,t)=>y.jsx(Y,{node:e},t))}):null,g0=({node:n})=>y.jsx("li",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),y0=({node:n})=>y.jsx("pre",{children:Array.isArray(n.content)&&n.content.map((e,t)=>y.jsx(Y,{node:e},t))}),b0=()=>y.jsx("hr",{}),x0=({node:n})=>{const[e,t]=m.useState(""),[r,o]=m.useState(""),s="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";return m.useEffect(()=>{var i,l,a,c;t((i=n.attrs)!=null&&i.src?`${(l=n.attrs)==null?void 0:l.src}`:""),o((a=n.attrs)!=null&&a.title?`${(c=n.attrs)==null?void 0:c.title}`:"")},[n]),oo(e)?y.jsx("div",{title:r,className:"video",children:y.jsx("iframe",{src:e,allow:s})}):y.jsx("div",{title:r,className:"image",children:y.jsx("img",{src:ro})})},k0=()=>y.jsx("br",{}),S0=({node:n})=>{const e=m.useRef(null),t=m.useRef(null),[r,o]=m.useState(!1),[s,i]=m.useState(!1),[l,a]=m.useState(!1),[c,u]=m.useState(1),[f,d]=m.useState(1),p=g=>{const k=g.scrollLeft,w=g.clientWidth,M=g.scrollWidth;i(k>w/2),a(k<M-w*1.5),u(Math.round(k/w+1))};m.useEffect(()=>{var g;a(Array.isArray(n.content)&&n.content.length>1),d(((g=n.content)==null?void 0:g.length)??1),u(1)},[n]),m.useEffect(()=>{const g=()=>{o(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",g),()=>document.removeEventListener("fullscreenchange",g)},[]),m.useEffect(()=>{if(!r)return;const g=k=>{k.key==="ArrowLeft"&&b(null,-1),k.key==="ArrowRight"&&b(null,1)};return document.body.addEventListener("keydown",g),()=>document.body.removeEventListener("keydown",g)},[r]);const h=g=>{var k;g.stopPropagation(),r?document.exitFullscreen():(k=t.current)==null||k.requestFullscreen()},b=(g,k)=>{if(g==null||g.stopPropagation(),!e.current)return;const w=e.current.clientWidth;let M=e.current.scrollLeft+k*w;e.current.scrollLeft=M};return Array.isArray(n.content)?y.jsxs("div",{className:"carousel",ref:t,children:[y.jsx("div",{className:"carousel-list",ref:e,onScroll:g=>p(g.currentTarget),children:n.content.map((g,k)=>y.jsx(C0,{node:g,onClick:h},k))}),y.jsxs("div",{className:"carousel-numb",children:[c," / ",f]}),y.jsx("div",{className:"carousel-full",onClick:h,children:r?y.jsx(E.Icons.Minimize,{}):y.jsx(E.Icons.Maximize,{})}),s&&y.jsx("div",{className:"carousel-prev",onClick:g=>b(g,-1),children:y.jsx(E.Icons.ChevronLeft,{})}),l&&y.jsx("div",{className:"carousel-next",onClick:g=>b(g,1),children:y.jsx(E.Icons.ChevronRight,{})})]}):null},C0=({node:n,onClick:e})=>{const[t,r]=m.useState(""),[o,s]=m.useState(""),[i,l]=m.useState("");return m.useEffect(()=>{var d,p,h,b;let a=(d=n.attrs)==null?void 0:d.fid,c=(p=n.attrs)!=null&&p.src?`${n.attrs.src}`:"",u=(h=n.attrs)!=null&&h.alt?`${n.attrs.alt}`:"",f=(b=n.attrs)!=null&&b.title?`${n.attrs.title}`:"";a&&(c=`${no}/files/${a}`),c||(c=ro),r(c),s(u),l(f)},[n]),n.type!=="image"?null:y.jsxs("div",{className:"image",children:[t&&y.jsx("img",{src:t,onClick:e,alt:o,title:i}),i&&y.jsx("div",{className:"image-title",children:i})]})},Y=({node:n,className:e})=>n?(r=>{switch(r.type){case"doc":return y.jsx(l0,{node:r,className:e});case"list_item":return y.jsx(g0,{node:r});case"bullet_list":case"ordered_list":return y.jsx(m0,{node:r});case"image":return y.jsx(a0,{node:r});case"video":return y.jsx(x0,{node:r});case"text":return y.jsx(i0,{node:r});case"table":return y.jsx(f0,{node:r});case"table_row":return y.jsx(d0,{node:r});case"table_cell":case"table_header":return y.jsx(h0,{node:r});case"heading":return y.jsx(p0,{node:r});case"code_block":return y.jsx(y0,{node:r});case"paragraph":return y.jsx(s0,{node:r});case"blockquote":return y.jsx(c0,{node:r});case"carousel":return y.jsx(S0,{node:r});case"horizontal_rule":return y.jsx(b0,{});case"hard_break":return y.jsx(k0,{});default:return y.jsx("span",{className:"unknown_node_type",children:r.type})}})(n):null,w0=({content:n})=>{const[e,t]=m.useState(),[r,o]=m.useState(!1);return m.useEffect(()=>{try{o(!1);const s=JSON.parse(n);t(s)}catch(s){o(!0),console.error(`Can not parse Prose format: ${s}`)}},[n]),r?y.jsx("div",{className:"error",children:"ОШИБКА"}):y.jsx(Y,{node:e,className:"ProseViewer"})},M0=({content:n})=>{const e=m.useRef(null),[t,r]=m.useState(!1);return m.useEffect(()=>{var o;try{r(!1);const s=be.fromJSON(Nt,JSON.parse(n)),i=$e.fromSchema(Nt).serializeFragment(s.content);(o=e.current)==null||o.appendChild(i)}catch(s){r(!0),console.error(`Can not parse Prose format: ${s}`)}},[e,n]),y.jsx("div",{ref:e,className:"ProseViewer",children:t&&y.jsx("div",{className:"error",children:"ОШИБКА"})})};G.DOM=M0,G.Editor=o0,G.Notes=Hb,G.Viewer=w0,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
|
|
66
66
|
//# sourceMappingURL=prose-editor.umd.js.map
|