lakelib 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/dist/codemirror.min.js +1 -1
- package/dist/lake.css +748 -298
- package/dist/lake.min.js +44 -45
- package/dist/lake.min.js.map +1 -0
- package/lib/lake.css +327 -298
- package/lib/lake.js +1909 -1252
- package/lib/lake.js.map +1 -0
- package/lib/types/boxes/code-block.d.ts +1 -1
- package/lib/types/config/menu-items.d.ts +9 -9
- package/lib/types/css/index.d.ts +3 -1
- package/lib/types/editor.d.ts +15 -7
- package/lib/types/i18n/en-US/index.d.ts +70 -0
- package/lib/types/i18n/index.d.ts +2 -0
- package/lib/types/i18n/ja/index.d.ts +70 -0
- package/lib/types/i18n/ko/index.d.ts +70 -0
- package/lib/types/i18n/types.d.ts +500 -0
- package/lib/types/i18n/zh-CN/index.d.ts +70 -0
- package/lib/types/index.d.ts +4 -2
- package/lib/types/managers/command.d.ts +15 -3
- package/lib/types/managers/plugin.d.ts +0 -1
- package/lib/types/managers/selection.d.ts +0 -1
- package/lib/types/models/nodes.d.ts +1 -0
- package/lib/types/types/dropdown.d.ts +16 -0
- package/lib/types/types/toolbar.d.ts +9 -21
- package/lib/types/ui/button.d.ts +17 -0
- package/lib/types/ui/dropdown.d.ts +23 -0
- package/lib/types/ui/link-popup.d.ts +10 -5
- package/lib/types/ui/toolbar.d.ts +2 -11
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/utils/modifier-text.d.ts +1 -0
- package/package.json +48 -29
- package/dist/lake-all.css +0 -1331
- package/dist/lake-all.min.js +0 -84
- package/lib/types/codemirror.d.ts +0 -5
package/dist/lake.min.js
CHANGED
|
@@ -1,75 +1,74 @@
|
|
|
1
|
-
var Lake=function(e,t,n,o,i){"use strict";class s extends HTMLElement{}customElements.define("lake-box",s);class r extends HTMLElement{}customElements.define("lake-bookmark",r);const a=new Map([["plus",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"></path></svg>'],["more",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["left",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>'],["right",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>'],["down",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>'],["check",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"></path></svg>'],["checkCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["warningCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"></path></svg>'],["open",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z" fill="#000000"/></svg>'],["copy",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>'],["remove",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>'],["maximize",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"></path></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'],["zoomIn",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["zoomOut",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["circleNotch",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg>'],["selectAll",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M104,40a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,40Zm40,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM40,80a8,8,0,0,0,8-8V48H72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,48V72A8,8,0,0,0,40,80ZM176,184H80a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8v96A8,8,0,0,1,176,184Zm-8-96H88v80h80Z"></path></svg>'],["undo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,144a64.07,64.07,0,0,1-64,64H80a8,8,0,0,1,0-16h88a48,48,0,0,0,0-96H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,45.66L51.31,80H168A64.07,64.07,0,0,1,232,144Z"></path></svg>'],["redo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.34,130.34,204.69,96H88a48,48,0,0,0,0,96h88a8,8,0,0,1,0,16H88A64,64,0,0,1,88,80H204.69L170.34,45.66a8,8,0,0,1,11.32-11.32l48,48a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32-11.32Z"></path></svg>'],["heading",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,56V200a8,8,0,0,1-16,0V136H64v64a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v64H192V56a8,8,0,0,1,16,0Z"></path></svg>'],["heading1",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm75.77,49a8,8,0,0,0-8.21.39l-24,16a8,8,0,1,0,8.88,13.32L216,127V208a8,8,0,0,0,16,0V112A8,8,0,0,0,227.77,105Z"></path></svg>'],["heading2",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm88,144H208l33.55-44.74a32,32,0,1,0-55.73-29.93,8,8,0,1,0,15.08,5.34,16.28,16.28,0,0,1,2.32-4.3,16,16,0,1,1,25.54,19.27L185.6,203.2A8,8,0,0,0,192,216h48a8,8,0,0,0,0-16Z"></path></svg>'],["heading3",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm73.52,90.63,21-30A8,8,0,0,0,240,104H192a8,8,0,0,0,0,16h32.63l-19.18,27.41A8,8,0,0,0,212,160a20,20,0,1,1-14.29,34,8,8,0,1,0-11.42,11.19A36,36,0,0,0,248,180,36.07,36.07,0,0,0,225.52,146.63Z"></path></svg>'],["heading4",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,112h-8V144a8,8,0,0,0-16,0v24H195.1l20.49-61.47a8,8,0,0,0-15.18-5.06l-24,72A8,8,0,0,0,184,184h40v24a8,8,0,0,0,16,0V184h8a8,8,0,0,0,0-16Z"></path></svg>'],["heading5",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm60,88a38.8,38.8,0,0,0-9.41,1.14L206.78,120H240a8,8,0,0,0,0-16H200a8,8,0,0,0-7.89,6.68l-8,48a8,8,0,0,0,13.6,6.92A19.73,19.73,0,0,1,212,160a20,20,0,0,1,0,40,19.73,19.73,0,0,1-14.29-5.6,8,8,0,1,0-11.42,11.2A35.54,35.54,0,0,0,212,216a36,36,0,0,0,0-72Z"></path></svg>'],["heading6",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,124a36,36,0,1,1-67.34-17.68c.07-.14.14-.28.22-.42l32.25-54a8,8,0,0,1,13.74,8.2l-16.69,28c.6,0,1.21-.05,1.82-.05A36,36,0,0,1,248,180Zm-16,0a20,20,0,1,0-20,20A20,20,0,0,0,232,180Z"></path></svg>'],["paragraph",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"></path></svg>'],["blockQuote",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"></path></svg>'],["list",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"></path></svg>'],["numberedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"></path></svg>'],["bulletedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"></path></svg>'],["checklist",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128ZM128,72h88a8,8,0,0,0,0-16H128a8,8,0,0,0,0,16Zm88,112H128a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16ZM82.34,42.34,56,68.69,45.66,58.34A8,8,0,0,0,34.34,69.66l16,16a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,82.34,42.34Zm0,64L56,132.69,45.66,122.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm0,64L56,196.69,45.66,186.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z"></path></svg>'],["alignLeft",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,48H168a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm176,24H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-48,40H40a8,8,0,0,0,0,16H168a8,8,0,0,0,0-16Z"></path></svg>'],["alignCenter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM64,96a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Zm152,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-24,40H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"></path></svg>'],["alignRight",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["alignJustify",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["increaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"></path></svg>'],["decreaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"></path></svg>'],["formatPainter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,88H216V64a16,16,0,0,0-16-16H48A16,16,0,0,0,32,64V88H16a8,8,0,0,0,0,16H32v24a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V104h16v50L131.6,182.65A16.07,16.07,0,0,0,120,198v34a8,8,0,0,0,16,0V198l100.4-28.68A16.07,16.07,0,0,0,248,154V104A16,16,0,0,0,232,88Zm-32,40H48V64H200v64Z"></path></svg>'],["bold",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.48,115.7A44,44,0,0,0,140,40H72a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM80,56h60a28,28,0,0,1,0,56H80Zm72,136H80V128h72a32,32,0,0,1,0,64Z"></path></svg>'],["italic",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"></path></svg>'],["underline",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"></path></svg>'],["strikethrough",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"></path></svg>'],["superscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z" fill="#000000"/><path d="M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z" fill="#000000"/></svg>'],["subscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z" fill="#000000"/></svg>'],["code",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z"></path></svg>'],["removeFormat",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M225,80.4,183.6,39a24,24,0,0,0-33.94,0L31,157.66a24,24,0,0,0,0,33.94l30.06,30.06A8,8,0,0,0,66.74,224H216a8,8,0,0,0,0-16h-84.7L225,114.34A24,24,0,0,0,225,80.4ZM108.68,208H70.05L42.33,180.28a8,8,0,0,1,0-11.31L96,115.31,148.69,168Zm105-105L160,156.69,107.31,104,161,50.34a8,8,0,0,1,11.32,0l41.38,41.38a8,8,0,0,1,0,11.31Z"></path></svg>'],["moreStyle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["fontColor",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="192 168 128 32 64 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="173.18" y1="128" x2="82.82" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["fontColorAccent",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="40" y1="216" x2="216" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["highlight",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z" fill="#000000"/><path d="M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z" fill="#000000"/></svg>'],["highlightAccent",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z" fill="#000000"/></svg>'],["link",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>'],["unlink",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M190.63,65.37a32,32,0,0,0-45.19-.06L133.79,77.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,190.63,65.37ZM122.21,178.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L54.19,133.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM208,152H184a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM48,104H72a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm112,72a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V184A8,8,0,0,0,160,176ZM96,80a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V72A8,8,0,0,0,96,80Z"></path></svg>'],["hr",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>'],["image",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"></path></svg>'],["codeBlock",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"></path></svg>'],["table",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>']]);function l(e,...t){let n=e[0];for(let o=0;o<t.length;o++){n+=String(t[o]),n+=e[o+1]}return n=n.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),n}const c=new Map([["&","&"],["<","<"],[">",">"],['"',"""],[" "," "]]);function d(e){return e.replace(/[&<>"\xA0]/g,(e=>{var t;return null!==(t=c.get(e))&&void 0!==t?t:""}))}function h(e,...t){let n=e[0];for(let o=0;o<t.length;o++){n+=d(String(t[o])),n+=e[o+1]}return n=n.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),n}function u(e){const t=e.split("-");let n="";return t.forEach(((e,t)=>{n+=t>0?e.charAt(0).toUpperCase()+e.substring(1):e})),n}function f(e,t,n){return void 0===n&&(n=","),(n+e+n).indexOf(n+t+n)>=0}function p(e){const t=Number.parseInt(e,10).toString(16).toLowerCase();return t.length>1?t:`0${t}`}function g(e){return e.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((e,t,n,o,i)=>void 0===i?`#${p(t)}${p(n)}${p(o)}`:`#${p(t)}${p(n)}${p(o)}${function(e){const t=Math.round(255*Number.parseFloat(e)).toString(16);return t.length>1?t:`0${t}`}(i)}`))}function m(e){e=e.replace(/"/gi,'"');const t={},n=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let o;for(;null!==(o=n.exec(e));){const e=o[1].toLowerCase().trim(),n=g(o[2]).trim();t[e]=n}return t}function v(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function x(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"<anchor />").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"<focus />")}function k(e,t){for(const n in e)if(!1===t(n,e[n]))break}function w(e,t){const n=u(t),o=window.getComputedStyle(e,null);return g(e.style[n]||o.getPropertyValue(t)||"")}function b(e,t){const n=[];if("string"!=typeof e)return n.push(e),n;if(""===e)return n;if("text"===t){const t=document.createTextNode(e);return n.push(t),n}if("html"===t||/<.+>/.test(e)){const t=document.createElement("div");t.innerHTML=e;for(const e of t.childNodes)n.push(e);return n}const o=document.querySelectorAll(e);for(const e of o)n.push(e);return n}const y=Node,B=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),A=new Set(["span","strong","em","i","u","s","sup","sub","code"]),C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S=new Set(["h1","h2","h3","h4","h5","h6"]),M=new Set(["ol","ul","li"]),T=new Set(["table","tr","td"]);function H(...e){window.DEBUG&&console.log.apply(console.log,e)}const E={};let N=0;class L{constructor(e){e=null!=e?e:[],this.nodeList=Array.isArray(e)?e:[e];for(let e=0;e<this.nodeList.length;e++)this.nodeList[e].lakeId||(this.nodeList[e].lakeId=++N);this.length=this.nodeList.length}get id(){return this.get(0).lakeId}get name(){if(0===this.length)return"";return this.get(0).nodeName.toLowerCase()}get isElement(){if(0===this.length)return!1;return this.get(0).nodeType===y.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===y.TEXT_NODE}get isBlock(){return 0!==this.length&&B.has(this.name)}get isMark(){return 0!==this.length&&A.has(this.name)}get isVoid(){return 0!==this.length&&C.has(this.name)}get isHeading(){return 0!==this.length&&S.has(this.name)}get isList(){return 0!==this.length&&M.has(this.name)}get isTable(){return 0!==this.length&&T.has(this.name)}get isBookmark(){return"lake-bookmark"===this.name}get isBox(){return"lake-box"===this.name}get isInlineBox(){return this.isBox&&"inline"===this.attr("type")}get isBlockBox(){return this.isBox&&"block"===this.attr("type")}get isContainer(){if(0===this.length)return!1;const e=this.get(0);return this.isElement&&"true"===e.getAttribute("contenteditable")}get isOutside(){return 0===this.closest('[contenteditable="true"]').length}get isInside(){return!this.isOutside&&!this.isContainer}get isTopInside(){if(0===this.length)return!1;const e=this.parent();return 0!==e.length&&(this.isInside&&e.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const e=this.get(0).parentNode;return!!e&&e.isContentEditable}if(!this.isElement)return!1;return this.get(0).isContentEditable}get isIndivisible(){return this.isContainer||this.isTable}get isEmpty(){if(this.isBox)return!1;const e=this.text(),t=""===e||/^[\r\n\u200B\u2060]+$/.test(e);return this.isElement&&t?0===this.find("lake-box").length:t}isSibling(e){if(0===this.length)return!1;const t=this.get(0).parentNode;return t&&t===e.parent().get(0)}get(e){return this.nodeList[e]}getAll(){return this.nodeList}eq(e){const t=this.get(e);return new L(t)}each(e){const t=this.getAll();for(let n=0;n<t.length;n++)if(!1===e(t[n],n))return this;return this}eachElement(e){const t=this.getAll();for(let n=0;n<t.length;n++)if(t[n].nodeType===y.ELEMENT_NODE&&!1===e(t[n],n))return this;return this}reverse(){const e=this.getAll().reverse();return new L(e)}matches(e){if(!this.isElement)return!1;return this.get(0).matches(e)}find(e){if("string"==typeof e){const t=this.get(0).querySelectorAll(e);return new L(Array.from(t))}let t=this.eq(0);for(const n of e)if(t=t.children()[n],!t)return new L;return t}closest(e){if(this.isText){const t=this.get(0).parentNode;return t?new L(t.closest(e)):new L}if(!this.isElement)return new L;const t=this.get(0);return new L(t.closest(e))}closestBlock(){let e=this.eq(0);for(;e.length>0&&!e.isTopInside&&!e.isBlock;)e=e.parent();return e.isBlock?e:new L}closestOperableBlock(){const e=this.closest("lake-box"),t=e.length>0?e.closestBlock():this.closestBlock();if(0===t.length)return t;if(t.isTable)return new L;const n=t.parent();return"li"===t.name&&n.isList?n:t}closestContainer(){return this.closest('div[contenteditable="true"]')}parent(){const e=this.get(0);return new L(e.parentNode)}prev(){const e=this.get(0);return new L(e.previousSibling)}next(){const e=this.get(0);return new L(e.nextSibling)}first(){const e=this.get(0);return new L(e.firstChild)}last(){const e=this.get(0);return new L(e.lastChild)}index(){let e=-1,t=this.get(0);for(;t;)e++,t=t.previousSibling;return e}path(){const e=[];let t=this.eq(0);if(t.isContainer)return e;for(;t.length>0;){const n=t.parent();if(0===n.length)break;if(e.push(t.index()),n.isContainer)break;t=n}return e.reverse()}children(){const e=[];let t=this.first();for(;t.length>0;)e.push(t),t=t.next();return e}*getWalker(){for(const e of function*e(t){if(t.isBox)return;let n=t.first();for(;n.length>0;){const t=n.next();yield n,yield*e(n),n=t}}(this.eq(0)))yield e}on(e,t){return this.eachElement((n=>{n.addEventListener(e,t,!1);const o=n.lakeId;E[o]||(E[o]=[]),E[o].push({type:e,listener:t})}))}off(e,t){return this.eachElement((n=>{var o;const i=n.lakeId,s=null!==(o=E[i])&&void 0!==o?o:[];s.forEach(((o,i)=>{e&&(e!==o.type||t&&t!==o.listener)||(n.removeEventListener(o.type,o.listener,!1),s[i]={type:"",listener:()=>{}})})),E[i]=s.filter((e=>""!==e.type))}))}emit(e,t){return this.eachElement((n=>{const o=n.lakeId;E[o].forEach((n=>{n.type===e&&n.listener(null!=t?t:new Event(e))}))}))}getEventListeners(e){const t=this.get(e).lakeId;return E[t]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(e=!1){const t=this.get(0);return new L(t.cloneNode(e))}hasAttr(e){return this.get(0).hasAttribute(e)}attr(e,t){var n;if("object"==typeof e)return k(e,((e,t)=>{this.attr(e,t)})),this;if(void 0===t){return null!==(n=this.get(0).getAttribute(e))&&void 0!==n?n:""}return this.eachElement((n=>{n.setAttribute(e,t)}))}removeAttr(e){return this.eachElement((t=>{t.removeAttribute(e)}))}hasClass(e){return f(this.get(0).className,e," ")}addClass(e){return Array.isArray(e)?(e.forEach((e=>{this.addClass(e)})),this):this.eachElement((t=>{f(t.className,e," ")||t.classList.add(e)}))}removeClass(e){return Array.isArray(e)?(e.forEach((e=>{this.removeClass(e)})),this):this.eachElement((t=>{f(t.className,e," ")&&(t.classList.remove(e),""===t.className&&t.removeAttribute("class"))}))}computedCSS(e){return w(this.get(0),e)}css(e,t){if("object"==typeof e)return k(e,((e,t)=>{this.css(e,t)})),this;if(void 0===t){return g(this.get(0).style[u(e)])}return this.eachElement((n=>{n.style[u(e)]=t,""===n.getAttribute("style")&&n.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}height(){return this.get(0).offsetHeight}show(e="block"){return this.css("display",e),this}hide(){return this.css("display","none"),this}html(e){if(void 0===e){return this.get(0).innerHTML}return this.eachElement((t=>{t.innerHTML=e}))}text(e){var t;if(void 0===e){const e=this.get(0);if(this.isText)return null!==(t=e.nodeValue)&&void 0!==t?t:"";return e.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((t=>{t.innerText=e}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(e){if("string"==typeof e)return this.eachElement((t=>{b(e).reverse().forEach((e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e),this}append(e){if("string"==typeof e)return this.eachElement((t=>{b(e).forEach((e=>{t.appendChild(e)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.appendChild(e),this}before(e){if("string"==typeof e)return this.each((t=>{b(e).forEach((e=>{t.parentNode&&t.parentNode.insertBefore(e,t)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.parentNode?(t.parentNode.insertBefore(e,t),this):this}after(e){if("string"==typeof e)return this.each((t=>{b(e).reverse().forEach((e=>{t.parentNode&&(t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e))}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.parentNode?(t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),this):this}replaceWith(e){return this.each((t=>{let n;n=e instanceof L?e.get(0):b(e)[0],t.parentNode&&t.parentNode.replaceChild(n,t)}))}remove(e=!1){return this.each((t=>{if(t.parentNode){if(e){let e=t.firstChild;for(;e;){const n=e.nextSibling;t.parentNode.insertBefore(e,t),e=n}}t.parentNode.removeChild(t)}})),this}splitText(e){if(!this.isText)return new L;const t=this.get(0).splitText(e);return new L(t)}toString(){if(0===this.length)return"";const e=this.get(0);let t=this.isText?e.nodeValue:this.outerHTML();return t&&t.length>50&&(t=`${t.substring(0,50)} ...`),`node (${e.lakeId}): ${t}`}debug(){H(this.toString())}}function V(e){if(e instanceof L)return e;const t=b(e);return new L(t)}class ${constructor(e){this.range=null!=e?e:document.createRange()}get startNode(){return new L(this.range.startContainer)}get startOffset(){return this.range.startOffset}get endNode(){return new L(this.range.endContainer)}get endOffset(){return this.range.endOffset}get commonAncestor(){return new L(this.range.commonAncestorContainer)}get isCollapsed(){return this.range.collapsed}get isBox(){return this.commonAncestor.closest("lake-box").length>0}get isBoxLeft(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareBeforeNode(t)>=0}get isBoxCenter(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===t.get(0)&&0===this.startOffset}get isBoxRight(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareAfterNode(t)<=0}get isInsideBox(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==t.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(t)<0&&this.compareAfterNode(t)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const e=this.startNode.closest("td"),t=this.endNode.closest("td");return e.length>0&&t.length>0&&e.get(0)!==t.get(0)}get(){return this.range}comparePoint(e,t){return this.range.comparePoint(e.get(0),t)}compareBeforeNode(e){const t=new $;return e.isText?t.setStart(e,0):t.setStartBefore(e),t.collapseToStart(),this.comparePoint(t.startNode,t.startOffset)}compareAfterNode(e){var t;const n=new $;if(e.isText){const o=null!==(t=e.get(0).nodeValue)&&void 0!==t?t:"";n.setStart(e,o.length)}else n.setStartAfter(e);return n.collapseToStart(),this.comparePoint(n.startNode,n.startOffset)}intersectsNode(e){return this.range.intersectsNode(e.get(0))}setStart(e,t){this.range.setStart(e.get(0),t)}setStartBefore(e){this.range.setStartBefore(e.get(0))}setStartAfter(e){this.range.setStartAfter(e.get(0))}setEnd(e,t){this.range.setEnd(e.get(0),t)}setEndBefore(e){this.range.setEndBefore(e.get(0))}setEndAfter(e){this.range.setEndAfter(e.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(e){this.range.selectNode(e.get(0))}selectNodeContents(e){this.range.selectNodeContents(e.get(0))}selectBox(e){const t=e.find(".lake-box-container");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.setStart(t,0),this.collapseToStart()}selectBoxLeft(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.selectNodeContents(t.eq(0)),this.collapseToEnd()}selectBoxRight(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.selectNodeContents(t.eq(1)),this.collapseToEnd()}shrinkBefore(e){if(e.isBox)return void this.selectBoxLeft(e);if(e.isText)return this.setStartBefore(e),void this.collapseToStart();let t;for(this.setStart(e,0);this.startNode.isElement&&(t=this.startNode.children()[0])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxLeft(t);this.setStart(t,0)}this.collapseToStart()}shrinkAfter(e){if(e.isBox)return void this.selectBoxRight(e);if(e.isText)return this.setEndAfter(e),void this.collapseToEnd();let t;for(this.setEnd(e,e.children().length);this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxRight(t);this.setEnd(t,t.children().length)}this.collapseToEnd()}shrink(){const e=this.isCollapsed;let t;for(;this.startNode.isElement&&(t=this.startNode.children()[this.startOffset])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setStart(t,0);if(e)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setEnd(t,t.children().length)}adaptBox(){const e=this.startNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToStart(),t.isBoxRight?this.setStartAfter(e):this.setStartBefore(e)}const t=this.endNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToEnd(),e.isBoxLeft?this.setEndBefore(t):this.setEndAfter(t)}}adaptTable(){const e=this.startNode.closest("table"),t=this.endNode.closest("table");if(0===e.length&&t.length>0&&t.isInside)return this.setEndBefore(t),void this.shrink();0===t.length&&e.length>0&&e.isInside&&(this.setStartAfter(e),this.shrink())}adaptBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let e=this.endNode;for(;0===e.prev().length;)e=e.parent();this.setEndBefore(e)}return void this.shrink()}if(this.startNode.isText)return;const e=this.startNode.children()[this.startOffset];e&&(e.isBlockBox||e.isBlock)&&this.shrinkBefore(e)}adapt(){this.adaptBox(),this.adaptTable(),this.adaptBlock()}getPrevNode(){let e;return e=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=e?e:new L}getNextNode(){let e;return e=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=e?e:new L}getBoxes(){if(this.isCollapsed){const e=this.startNode.closest("lake-box");return e.length>0?[e]:[]}const e=[],t=this.clone();t.adaptBox();for(const n of t.commonAncestor.getWalker())n.isBox&&t.intersectsNode(n)&&e.push(n);return e}getBlocks(){if(this.isCollapsed){const e=this.startNode.closestOperableBlock();return e.isTable?[]:e.isInside?[e]:[]}const e=this.startNode.closestOperableBlock(),t=this.endNode.closestOperableBlock();if(e.isInside&&e.get(0)&&e.get(0)===t.get(0))return e.isTable?[]:[e];const n=[],o=this.clone();o.collapseToEnd();for(const e of this.commonAncestor.getWalker())e.isBlock&&!e.isTable&&e.isTopInside&&0!==o.comparePoint(e,0)&&this.intersectsNode(e)&&n.push(e);if(n.length>0)return n;for(const o of this.commonAncestor.getWalker())o.isBlock&&!o.isTable&&(e.isSibling(o)||t.isSibling(o))&&this.intersectsNode(o)&&n.push(o);return n}getMarks(e=!1){const t=[];if(this.commonAncestor.isText&&e&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return t.push(this.commonAncestor),t;const n=this.clone();n.collapseToStart();const o=this.clone();o.collapseToEnd();for(const i of this.commonAncestor.getWalker()){const s=document.createRange();if(s.setStartAfter(i.get(0)),s.collapse(!0),o.compareBeforeNode(i)>=0)break;n.compareAfterNode(i)>0&&(i.isMark||i.isText&&e)&&t.push(i)}return t}getLeftText(){const e=this.startNode,t=this.startOffset;let n=e.closestBlock();if(n.isOutside&&(n=e.closestContainer()),0===n.length)return"";const o=new $;o.setStartBefore(n),o.setEnd(e,t);const i=V("<div />");i.append(o.cloneContents());const s=i.text();return""===s&&i.find("lake-box").length>0?"":s}getRightText(){const e=this.endNode,t=this.endOffset;let n=e.closestBlock();if(n.isOutside&&(n=e.closestContainer()),0===n.length)return"";const o=new $;o.setStart(e,t),o.setEndAfter(n);const i=V("<div />");i.append(o.cloneContents());const s=i.text();return""===s&&i.find("lake-box").length>0?"":s}clone(){return new $(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){H("--- range information ---"),H("start node:",this.startNode.toString(),", offset:",this.startOffset),H("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function Z(e,t,n){const o=new $;let i;if(e.isText){i=e.parent();const n=e.splitText(t);o.setStartAfter(e),""===e.text()&&e.remove(),""===n.text()&&n.remove()}else o.setStart(e,t),i=e;if("body"===i.name||"html"===i.name)return null;if(i.get(0)===n.get(0))return null;o.collapseToStart();const s=i.clone();let r=i.first();for(;r.length>0&&!(o.compareBeforeNode(r)>=0);){const e=r.next();s.append(r),r=e}return i.before(s),i.parent().length>0&&i.parent().get(0)!==n.get(0)?Z(i.parent(),i.index(),n):{left:s,right:i}}function I(e,t){let n=e;for(;n.length>0;){let e=n.first();for(;e.isText&&e.isEmpty;)e=e.next();if(n.isText||n.isBox)break;if(n.isElement&&1===n.children().length&&e.isBookmark){n.prepend(t);break}if(n.isElement&&!n.isVoid&&0===e.length){n.append(t);break}n=e}}function O(e){if(0===e.length)return;const t=[];let n=e.first();for(;n.length>0;){const e=n.next();n.isText&&""===n.text()||t.push(n),n=e}(1===t.length&&"br"===t[0].name||2===t.length&&"br"===t[0].name&&t[1].isBookmark)&&t[0].remove(),2===t.length&&t[0].isBookmark&&"br"===t[1].name&&t[1].remove()}function D(e){if(e.isText)return{node:e,offset:e.text().length};const t=new $;return t.setEndAfter(e),{node:t.endNode,offset:t.endOffset}}function R(e,t){const n=t;if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(t.length-1)}if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(0)}if(e.isText||t.isText||e.isVoid||t.isVoid)return D(e);O(e),O(t),e.isBlock&&e.isEmpty&&t.isEmpty&&I(e,V("<br />"));const o=e.last(),i=t.first();let s=i;for(;s.length>0;){const t=s.next();e.append(s),s=t}return n.remove(),o.length>0&&i.length>0&&o.isElement&&!o.isBox&&o.clone(!1).get(0).isEqualNode(i.clone(!1).get(0))?R(o,i):0===o.length?{node:e,offset:0}:D(o)}function z(e){let t=e;for(;t.length>0;){let e=t.first();if(e.isText&&e.isEmpty&&(e=e.next()),t.isElement&&!t.isVoid&&0===e.length)break;t=e}return t}function j(e,t){if(t=null!=t?t:V("<p />"),0===e.length)return t;const n=z(t=t.clone(!0));return e[0].before(t),e.forEach((e=>{n.append(e)})),t}function P(e){for(const t of e.getWalker())if(t.isText&&t.text().length>1){const e=t.text();/\u200B/.test(t.text())&&(t.get(0).nodeValue=e.replace(/\u200B/g,""))}}function F(e,t){const n=e.get(0),o=V(h`<${t} />`);for(const e of n.attributes)o.attr(e.name,e.value);let i=e.first();for(;i.length>0;){const e=i.next();o.append(i),i=e}return e.replaceWith(o),o}function q(e){if(0===e.length)return;const t=e[0],n=e[e.length-1],o=[];let i=t.prev();for(;i.length>0&&"ol"===i.name;)o.push(i),i=i.prev();o.reverse(),o.push(...e);let s=n.next();for(;s.length>0&&"ol"===s.name;)o.push(s),s=s.next();let r=1;for(const e of o){const t=e.prev();if(0!==t.length&&"ol"===t.name||(r=1),"ol"===e.name){"ol"===t.name&&t.attr("indent")!==e.attr("indent")&&(r=1);const n=e.attr("start"),o=r.toString(10);n!==o&&e.attr("start",o),r++}}}function U(e,t){if(e.isList){let n=Number.parseInt(e.attr("indent"),10)||0;if("increase"===t?n++:n--,n<=0)n=0;else if(n>10)return;return 0===n?e.removeAttr("indent"):e.attr("indent",n.toString(10)),void q([e])}let n=Number.parseInt(e.css("margin-left"),10)||0;"decrease"!==t||0!==n||""===e.css("text-indent")?("increase"===t?n+=40:n-=40,n<=0&&(n=0),0===n?e.css("margin-left",""):e.css("margin-left",`${n}px`)):e.css("text-indent","")}const _=new Set;function W(){}const K={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:W,afterNodeAdded:W,beforeNodeMorphed:W,afterNodeMorphed:W,beforeNodeRemoved:W,afterNodeRemoved:W,beforeAttributeUpdated:W,afterAttributeUpdated:W,beforeChildrenUpdated:W},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:W,afterHeadMorphed:W}};function J(e,t){return!e.deadIds.has(t)}function X(e,t,n){return(e.idMap.get(n)||_).has(t)}function G(e,t){const n=e.idMap.get(t)||_;for(const t of n)e.deadIds.add(t)}function Q(e,t,n){const o=e.idMap.get(t)||_;let i=0;for(const t of o)J(e,t)&&X(e,t,n)&&++i;return i}function Y(e,t){const n=e.parentElement,o=e.querySelectorAll("[id]");for(const e of o){let o=e;for(;o!==n&&null!=o;){let n=t.get(o);null==n&&(n=new Set,t.set(o,n)),n.add(e.id),o=o.parentElement}}}function ee(e,t){const n=new Map;return Y(e,n),Y(t,n),n}function te(e,t,n){return{target:e,newContent:t,config:n=function(e){const t={};return Object.assign(t,K),Object.assign(t,e),t.callbacks={},Object.assign(t.callbacks,K.callbacks),Object.assign(t.callbacks,e.callbacks),t.head={},Object.assign(t.head,K.head),Object.assign(t.head,e.head),t}(n),morphStyle:n.morphStyle,ignoreActive:n.ignoreActive,ignoreActiveValue:n.ignoreActiveValue,idMap:ee(e,t),deadIds:new Set,callbacks:n.callbacks,head:n.head}}function ne(e,t,n){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName&&(""!==e.id&&e.id===t.id||Q(n,e,t)>0))}function oe(e,t){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName)}function ie(e,t){G(t,e),!1!==t.callbacks.beforeNodeRemoved(e)&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function se(e,t,n){let o=e;for(;o&&o!==t;){const e=o;o=o.nextSibling,ie(e,n)}return G(n,t),t.nextSibling}function re(e,t,n,o,i){const s=Q(i,n,t);let r=null;if(s>0){r=o;let t=0;for(;null!=r;){if(ne(n,r,i))return r;if(t+=Q(i,r,e),t>s)return null;r=r.nextSibling}}return r}function ae(e,t,n,o,i){let s=o,r=n.nextSibling,a=0;for(;null!=s;){if(Q(i,s,e)>0)return null;if(oe(n,s))return s;if(oe(r,s)&&(a++,r=r?r.nextSibling:null,a>=2))return null;s=s?s.nextSibling:null}return s}function le(e,t,n){return oe(e,t)?.5+Q(n,e,t):0}function ce(e,t,n,o){return!("value"!==e||!o.ignoreActiveValue||t!==document.activeElement)||!1===o.callbacks.beforeAttributeUpdated(e,t,n)}function de(e,t,n){var o;if(!n.ignoreActive||e!==document.activeElement)return null==t?!1===n.callbacks.beforeNodeRemoved(e)?e:(e.remove(),n.callbacks.afterNodeRemoved(e),null):oe(e,t)?(!1===n.callbacks.beforeNodeMorphed(e,t)||(function(e,t,n){const o=e.nodeType;if(1===o){const o=e.attributes,i=t.attributes;for(const e of o)ce(e.name,t,"update",n)||t.getAttribute(e.name)!==e.value&&(t.setAttribute(e.name,e.value),n.callbacks.afterAttributeUpdated(e.name,t,"update"));for(let o=i.length-1;o>=0;o--){const s=i[o];ce(s.name,t,"remove",n)||e.hasAttribute(s.name)||(t.removeAttribute(s.name),n.callbacks.afterAttributeUpdated(s.name,t,"remove"))}}8!==o&&3!==o||t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue)}(t,e,n),!1===n.callbacks.beforeChildrenUpdated(e,t)||function(e,t){return t.ignoreActiveValue&&e===document.activeElement}(e,n)||he(t,e,n),n.callbacks.afterNodeMorphed(e,t)),e):!1===n.callbacks.beforeNodeRemoved(e)||!1===n.callbacks.beforeNodeAdded(t)?e:(null===(o=e.parentElement)||void 0===o||o.replaceChild(t,e),n.callbacks.afterNodeAdded(t),n.callbacks.afterNodeRemoved(e),t)}function he(e,t,n){let o,i=e.firstChild,s=t.firstChild;for(;i;){if(o=i,i=o.nextSibling,null==s){if(!1===n.callbacks.beforeNodeAdded(o))return;t.appendChild(o),n.callbacks.afterNodeAdded(o),G(n,o);continue}if(ne(o,s,n)){de(s,o,n),s=s.nextSibling,G(n,o);continue}const r=re(e,t,o,s,n);if(r){s=se(s,r,n),de(r,o,n),G(n,o);continue}const a=ae(e,0,o,s,n);if(a)s=se(s,a,n),de(a,o,n),G(n,o);else{if(!1===n.callbacks.beforeNodeAdded(o))return;t.insertBefore(o,s),n.callbacks.afterNodeAdded(o),G(n,o)}}for(;null!==s;){const e=s;s=s.nextSibling,ie(e,n)}}function ue(e,t,n){if("innerHTML"===n.morphStyle)return he(t,e,n),e.children;if("outerHTML"===n.morphStyle||null==n.morphStyle){const o=function(e,t,n){let o;o=e.firstChild;let i=o,s=0;for(;o;){const e=le(o,t,n);e>s&&(i=o,s=e),o=o.nextSibling}return i}(t,e,n),i=null==o?void 0:o.previousSibling,s=null==o?void 0:o.nextSibling,r=de(e,o,n);return o?function(e,t,n){var o,i;const s=[],r=[];let a=e;for(;null!=a;)s.push(a),a=a.previousSibling;for(;s.length>0;){const e=s.pop();r.push(e),e&&(null===(o=t.parentElement)||void 0===o||o.insertBefore(e,t))}r.push(t);let l=n;for(;null!=l;)s.push(l),r.push(l),l=l.nextSibling;for(;s.length>0;){const e=s.pop();e&&(null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling))}return r}(i,r,s):[]}throw`Do not understand how to morph style ${n.morphStyle}`}function fe(e,t,n={}){const o=function(e){if(null==e)return document.createElement("div");if(e instanceof Node){if(e.generatedByIdiomorph)return e;const t=document.createElement("div");return t.append(e),t}const t=document.createElement("div");for(const n of[...e])t.append(n);return t}(t.get(0)),i=te(e.get(0),o,n);ue(e.get(0),o,i)}function pe(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function ge(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const n=new FormData,o=e.data||{};Object.keys(o).forEach((e=>{const t=o[e];Array.isArray(t)?t.forEach((t=>{n.append(`${e}[]`,t)})):n.append(e,t)}));const i=e.filename||"file";e.file instanceof Blob?n.append(i,e.file,e.file.name):n.append(i,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const n=`Cannot ${e.method} ${e.action} ${t.status}'`,o=new Error(n);return o.status=t.status,o.method=e.method,o.url=e.action,o}(e,t),pe(t))}if(e.onSuccess)return e.onSuccess(pe(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const s=e.headers||{};return null!==s["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(s).forEach((e=>{null!==s[e]&&t.setRequestHeader(e,s[e])})),t.send(n),t}var me=Object.freeze({__proto__:null,appendDeepest:I,camelCase:u,changeTagName:F,debug:H,denormalizeValue:x,encode:d,fixNumberedList:q,forEach:k,getCSS:w,getDeepest:z,inString:f,mergeNodes:R,morph:fe,normalizeValue:v,parseStyle:m,query:V,removeBr:O,removeZWS:P,request:ge,safeTemplate:h,setBlockIndent:U,splitNodes:Z,template:l,toHex:g,toNodeList:b,wrapNodeList:j});class ve{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}find(e){const t=[];let n=new L(this.fragment.firstChild);for(;n.length>0;)n.matches(e)?t.push(n.get(0)):n.isElement&&n.find(e).each((e=>{t.push(e)})),n=n.next();return new L(t)}append(e){e.each((e=>{this.fragment.appendChild(e)}))}}const xe="function"==typeof Buffer,ke="function"==typeof TextDecoder?new TextDecoder:void 0,we="function"==typeof TextEncoder?new TextEncoder:void 0,be=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ye=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(be),Be=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ae=String.fromCharCode.bind(String),Ce="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),Se=e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")),Me=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Te=e=>{let t,n,o,i,s="";const r=e.length%3;for(let r=0;r<e.length;){if((n=e.charCodeAt(r++))>255||(o=e.charCodeAt(r++))>255||(i=e.charCodeAt(r++))>255)throw new TypeError("invalid character found");t=n<<16|o<<8|i,s+=be[t>>18&63]+be[t>>12&63]+be[t>>6&63]+be[63&t]}return r?s.slice(0,r-3)+"===".substring(r):s},He="function"==typeof btoa?e=>btoa(e):xe?e=>Buffer.from(e,"binary").toString("base64"):Te,Ee=xe?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,o=e.length;n<o;n+=4096)t.push(Ae.apply(null,e.subarray(n,n+4096)));return He(t.join(""))},Ne=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Ae(192|t>>>6)+Ae(128|63&t):Ae(224|t>>>12&15)+Ae(128|t>>>6&63)+Ae(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Ae(240|t>>>18&7)+Ae(128|t>>>12&63)+Ae(128|t>>>6&63)+Ae(128|63&t)},Le=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ve=e=>e.replace(Le,Ne),$e=xe?e=>Buffer.from(e,"utf8").toString("base64"):we?e=>Ee(we.encode(e)):e=>He(Ve(e)),Ze=(e,t=!1)=>t?Se($e(e)):$e(e),Ie=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Oe=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return Ae(55296+(t>>>10))+Ae(56320+(1023&t));case 3:return Ae((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Ae((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},De=e=>e.replace(Ie,Oe),Re=e=>{if(e=e.replace(/\s+/g,""),!Be.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,o,i="";for(let s=0;s<e.length;)t=ye[e.charAt(s++)]<<18|ye[e.charAt(s++)]<<12|(n=ye[e.charAt(s++)])<<6|(o=ye[e.charAt(s++)]),i+=64===n?Ae(t>>16&255):64===o?Ae(t>>16&255,t>>8&255):Ae(t>>16&255,t>>8&255,255&t);return i},ze="function"==typeof atob?e=>atob(Me(e)):xe?e=>Buffer.from(e,"base64").toString("binary"):Re,je=xe?e=>Ce(Buffer.from(e,"base64")):e=>Ce(ze(e).split("").map((e=>e.charCodeAt(0)))),Pe=xe?e=>Buffer.from(e,"base64").toString("utf8"):ke?e=>ke.decode(je(e)):e=>De(ze(e)),Fe=e=>Me(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),qe=e=>Pe(Fe(e)),Ue=Ze,_e=qe;var We="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ke(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Je={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,o,s,r){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new i(o,s||e,r),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,o,i=[];if(0===this._eventsCount)return i;for(o in e=this._events)t.call(e,o)&&i.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var i=0,s=o.length,r=new Array(s);i<s;i++)r[i]=o[i].fn;return r},a.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,i,s,r){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,d=this._events[a],h=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),h){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,o),!0;case 4:return d.fn.call(d.context,t,o,i),!0;case 5:return d.fn.call(d.context,t,o,i,s),!0;case 6:return d.fn.call(d.context,t,o,i,s,r),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];d.fn.apply(d.context,l)}else{var u,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),h){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,o);break;case 4:d[c].fn.call(d[c].context,t,o,i);break;default:if(!l)for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];d[c].fn.apply(d[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,o,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return r(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||o&&a.context!==o||r(this,s);else{for(var l=0,c=[],d=a.length;l<d;l++)(a[l].fn!==t||i&&!a[l].once||o&&a[l].context!==o)&&c.push(a[l]);c.length?this._events[s]=1===c.length?c[0]:c:r(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&r(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(Je);var Xe=Ke(Je.exports);const Ge=new Map,Qe=new Map,Ye={},et={},tt=h`
|
|
1
|
+
var Lake=function(t){"use strict";class e extends HTMLElement{}customElements.define("lake-box",e);class i extends HTMLElement{}customElements.define("lake-bookmark",i);const n=new Map([["plus",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"></path></svg>'],["more",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["left",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>'],["right",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>'],["down",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>'],["check",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"></path></svg>'],["checkCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["warningCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"></path></svg>'],["open",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z" fill="#000000"/></svg>'],["copy",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>'],["remove",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>'],["maximize",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"></path></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'],["zoomIn",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["zoomOut",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["circleNotch",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg>'],["selectAll",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M104,40a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,40Zm40,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM40,80a8,8,0,0,0,8-8V48H72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,48V72A8,8,0,0,0,40,80ZM176,184H80a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8v96A8,8,0,0,1,176,184Zm-8-96H88v80h80Z"></path></svg>'],["undo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,144a64.07,64.07,0,0,1-64,64H80a8,8,0,0,1,0-16h88a48,48,0,0,0,0-96H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,45.66L51.31,80H168A64.07,64.07,0,0,1,232,144Z"></path></svg>'],["redo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.34,130.34,204.69,96H88a48,48,0,0,0,0,96h88a8,8,0,0,1,0,16H88A64,64,0,0,1,88,80H204.69L170.34,45.66a8,8,0,0,1,11.32-11.32l48,48a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32-11.32Z"></path></svg>'],["heading",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,56V200a8,8,0,0,1-16,0V136H64v64a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v64H192V56a8,8,0,0,1,16,0Z"></path></svg>'],["heading1",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm75.77,49a8,8,0,0,0-8.21.39l-24,16a8,8,0,1,0,8.88,13.32L216,127V208a8,8,0,0,0,16,0V112A8,8,0,0,0,227.77,105Z"></path></svg>'],["heading2",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm88,144H208l33.55-44.74a32,32,0,1,0-55.73-29.93,8,8,0,1,0,15.08,5.34,16.28,16.28,0,0,1,2.32-4.3,16,16,0,1,1,25.54,19.27L185.6,203.2A8,8,0,0,0,192,216h48a8,8,0,0,0,0-16Z"></path></svg>'],["heading3",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm73.52,90.63,21-30A8,8,0,0,0,240,104H192a8,8,0,0,0,0,16h32.63l-19.18,27.41A8,8,0,0,0,212,160a20,20,0,1,1-14.29,34,8,8,0,1,0-11.42,11.19A36,36,0,0,0,248,180,36.07,36.07,0,0,0,225.52,146.63Z"></path></svg>'],["heading4",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,112h-8V144a8,8,0,0,0-16,0v24H195.1l20.49-61.47a8,8,0,0,0-15.18-5.06l-24,72A8,8,0,0,0,184,184h40v24a8,8,0,0,0,16,0V184h8a8,8,0,0,0,0-16Z"></path></svg>'],["heading5",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm60,88a38.8,38.8,0,0,0-9.41,1.14L206.78,120H240a8,8,0,0,0,0-16H200a8,8,0,0,0-7.89,6.68l-8,48a8,8,0,0,0,13.6,6.92A19.73,19.73,0,0,1,212,160a20,20,0,0,1,0,40,19.73,19.73,0,0,1-14.29-5.6,8,8,0,1,0-11.42,11.2A35.54,35.54,0,0,0,212,216a36,36,0,0,0,0-72Z"></path></svg>'],["heading6",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,124a36,36,0,1,1-67.34-17.68c.07-.14.14-.28.22-.42l32.25-54a8,8,0,0,1,13.74,8.2l-16.69,28c.6,0,1.21-.05,1.82-.05A36,36,0,0,1,248,180Zm-16,0a20,20,0,1,0-20,20A20,20,0,0,0,232,180Z"></path></svg>'],["paragraph",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"></path></svg>'],["blockQuote",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"></path></svg>'],["list",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"></path></svg>'],["numberedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"></path></svg>'],["bulletedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"></path></svg>'],["checklist",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128ZM128,72h88a8,8,0,0,0,0-16H128a8,8,0,0,0,0,16Zm88,112H128a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16ZM82.34,42.34,56,68.69,45.66,58.34A8,8,0,0,0,34.34,69.66l16,16a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,82.34,42.34Zm0,64L56,132.69,45.66,122.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm0,64L56,196.69,45.66,186.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z"></path></svg>'],["alignLeft",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,48H168a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm176,24H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-48,40H40a8,8,0,0,0,0,16H168a8,8,0,0,0,0-16Z"></path></svg>'],["alignCenter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM64,96a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Zm152,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-24,40H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"></path></svg>'],["alignRight",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["alignJustify",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["increaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"></path></svg>'],["decreaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"></path></svg>'],["formatPainter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,88H216V64a16,16,0,0,0-16-16H48A16,16,0,0,0,32,64V88H16a8,8,0,0,0,0,16H32v24a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V104h16v50L131.6,182.65A16.07,16.07,0,0,0,120,198v34a8,8,0,0,0,16,0V198l100.4-28.68A16.07,16.07,0,0,0,248,154V104A16,16,0,0,0,232,88Zm-32,40H48V64H200v64Z"></path></svg>'],["bold",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.48,115.7A44,44,0,0,0,140,40H72a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM80,56h60a28,28,0,0,1,0,56H80Zm72,136H80V128h72a32,32,0,0,1,0,64Z"></path></svg>'],["italic",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"></path></svg>'],["underline",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"></path></svg>'],["strikethrough",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"></path></svg>'],["superscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z" fill="#000000"/><path d="M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z" fill="#000000"/></svg>'],["subscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z" fill="#000000"/></svg>'],["code",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z"></path></svg>'],["removeFormat",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M225,80.4,183.6,39a24,24,0,0,0-33.94,0L31,157.66a24,24,0,0,0,0,33.94l30.06,30.06A8,8,0,0,0,66.74,224H216a8,8,0,0,0,0-16h-84.7L225,114.34A24,24,0,0,0,225,80.4ZM108.68,208H70.05L42.33,180.28a8,8,0,0,1,0-11.31L96,115.31,148.69,168Zm105-105L160,156.69,107.31,104,161,50.34a8,8,0,0,1,11.32,0l41.38,41.38a8,8,0,0,1,0,11.31Z"></path></svg>'],["moreStyle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["fontColor",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="192 168 128 32 64 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="173.18" y1="128" x2="82.82" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["fontColorAccent",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="40" y1="216" x2="216" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["highlight",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z" fill="#000000"/><path d="M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z" fill="#000000"/></svg>'],["highlightAccent",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z" fill="#000000"/></svg>'],["link",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>'],["unlink",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M190.63,65.37a32,32,0,0,0-45.19-.06L133.79,77.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,190.63,65.37ZM122.21,178.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L54.19,133.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM208,152H184a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM48,104H72a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm112,72a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V184A8,8,0,0,0,160,176ZM96,80a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V72A8,8,0,0,0,96,80Z"></path></svg>'],["hr",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>'],["image",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"></path></svg>'],["codeBlock",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"></path></svg>'],["table",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>']]);function s(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=String(e[n]),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}const o=new Map([["&","&"],["<","<"],[">",">"],['"',"""],[" "," "]]);function r(t){return t.replace(/[&<>"\xA0]/g,(t=>{var e;return null!==(e=o.get(t))&&void 0!==e?e:""}))}function a(t,...e){let i=t[0];for(let n=0;n<e.length;n++){i+=r(String(e[n])),i+=t[n+1]}return i=i.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),i}function l(t){const e=t.split("-");let i="";return e.forEach(((t,e)=>{i+=e>0?t.charAt(0).toUpperCase()+t.substring(1):t})),i}function h(t,e,i){return void 0===i&&(i=","),(i+t+i).indexOf(i+e+i)>=0}function c(t){const e=Number.parseInt(t,10).toString(16).toLowerCase();return e.length>1?e:`0${e}`}function d(t){return t.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((t,e,i,n,s)=>void 0===s?`#${c(e)}${c(i)}${c(n)}`:`#${c(e)}${c(i)}${c(n)}${function(t){const e=Math.round(255*Number.parseFloat(t)).toString(16);return e.length>1?e:`0${e}`}(s)}`))}function p(t){t=t.replace(/"/gi,'"');const e={},i=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let n;for(;null!==(n=i.exec(t));){const t=n[1].toLowerCase().trim(),i=d(n[2]).trim();e[t]=i}return e}function u(t){return t.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function m(t){return t.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"<anchor />").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"<focus />")}function f(t,e){const i=(e=null!=e?e:navigator.userAgent).indexOf("Mac OS X")>=0?"⌘":"Ctrl";return t.replace(/(^|\+|\s)mod(\+|\s|$)/g,`$1${i}$2`)}function g(t,e){for(const i in t)if(!1===e(i,t[i]))break}function v(t,e){const i=l(e),n=window.getComputedStyle(t,null);return d(t.style[i]||n.getPropertyValue(e)||"")}function w(t,e){const i=[];if("string"!=typeof t)return i.push(t),i;if(""===t)return i;if("text"===e){const e=document.createTextNode(t);return i.push(e),i}if("html"===e||/<.+>/.test(t)){const e=document.createElement("div");e.innerHTML=t;for(const t of e.childNodes)i.push(t);return i}const n=document.querySelectorAll(t);for(const t of n)i.push(t);return i}const y=Node,x=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),b=new Set(["span","strong","em","i","u","s","sup","sub","code"]),k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_=new Set(["h1","h2","h3","h4","h5","h6"]),S=new Set(["ol","ul","li"]),C=new Set(["table","tr","td"]);function A(...t){window.LAKE_DEBUG&&console.log.apply(console.log,t)}const B={};let L=0;class T{constructor(t){t=null!=t?t:[],this.nodeList=Array.isArray(t)?t:[t];for(let t=0;t<this.nodeList.length;t++)this.nodeList[t].lakeId||(this.nodeList[t].lakeId=++L);this.length=this.nodeList.length}get id(){return this.get(0).lakeId}get name(){if(0===this.length)return"";return this.get(0).nodeName.toLowerCase()}get isElement(){if(0===this.length)return!1;return this.get(0).nodeType===y.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===y.TEXT_NODE}get isBlock(){return 0!==this.length&&x.has(this.name)}get isMark(){return 0!==this.length&&b.has(this.name)}get isVoid(){return 0!==this.length&&k.has(this.name)}get isHeading(){return 0!==this.length&&_.has(this.name)}get isList(){return 0!==this.length&&S.has(this.name)}get isTable(){return 0!==this.length&&C.has(this.name)}get isBookmark(){return"lake-bookmark"===this.name}get isBox(){return"lake-box"===this.name}get isInlineBox(){return this.isBox&&"inline"===this.attr("type")}get isBlockBox(){return this.isBox&&"block"===this.attr("type")}get isContainer(){if(0===this.length)return!1;const t=this.get(0);return this.isElement&&"true"===t.getAttribute("contenteditable")}get isOutside(){return 0===this.closest('[contenteditable="true"]').length}get isInside(){return!this.isOutside&&!this.isContainer}get isTopInside(){if(0===this.length)return!1;const t=this.parent();return 0!==t.length&&(this.isInside&&t.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const t=this.get(0).parentNode;return!!t&&t.isContentEditable}if(!this.isElement)return!1;return this.get(0).isContentEditable}get isIndivisible(){return this.isContainer||this.isTable}get isEmpty(){if(this.isBox)return!1;const t=this.text(),e=""===t||/^[\r\n\u200B\u2060]+$/.test(t);return this.isElement&&e?0===this.find("lake-box").length:e}isSibling(t){if(0===this.length)return!1;const e=this.get(0).parentNode;return e&&e===t.parent().get(0)}get(t){return this.nodeList[t]}getAll(){return this.nodeList}eq(t){const e=this.get(t);return new T(e)}each(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(!1===t(e[i],i))return this;return this}eachElement(t){const e=this.getAll();for(let i=0;i<e.length;i++)if(e[i].nodeType===y.ELEMENT_NODE&&!1===t(e[i],i))return this;return this}reverse(){const t=this.getAll().reverse();return new T(t)}matches(t){if(!this.isElement)return!1;return this.get(0).matches(t)}find(t){if("string"==typeof t){const e=this.get(0).querySelectorAll(t);return new T(Array.from(e))}let e=this.eq(0);for(const i of t)if(e=e.children()[i],!e)return new T;return e}closest(t){if(this.isText){const e=this.get(0).parentNode;return e?new T(e.closest(t)):new T}if(!this.isElement)return new T;const e=this.get(0);return new T(e.closest(t))}closestBlock(){let t=this.eq(0);for(;t.length>0&&!t.isTopInside&&!t.isBlock;)t=t.parent();return t.isBlock?t:new T}closestOperableBlock(){const t=this.closest("lake-box"),e=t.length>0?t.closestBlock():this.closestBlock();if(0===e.length)return e;if(e.isTable)return new T;const i=e.parent();return"li"===e.name&&i.isList?i:e}closestContainer(){return this.closest('div[contenteditable="true"]')}parent(){const t=this.get(0);return new T(t.parentNode)}prev(){const t=this.get(0);return new T(t.previousSibling)}next(){const t=this.get(0);return new T(t.nextSibling)}first(){const t=this.get(0);return new T(t.firstChild)}last(){const t=this.get(0);return new T(t.lastChild)}index(){let t=-1,e=this.get(0);for(;e;)t++,e=e.previousSibling;return t}path(){const t=[];let e=this.eq(0);if(e.isContainer)return t;for(;e.length>0;){const i=e.parent();if(0===i.length)break;if(t.push(e.index()),i.isContainer)break;e=i}return t.reverse()}children(){const t=[];let e=this.first();for(;e.length>0;)t.push(e),e=e.next();return t}*getWalker(){for(const t of function*t(e){if(e.isBox)return;let i=e.first();for(;i.length>0;){const e=i.next();yield i,yield*t(i),i=e}}(this.eq(0)))yield t}on(t,e){return this.eachElement((i=>{i.addEventListener(t,e,!1);const n=i.lakeId;B[n]||(B[n]=[]),B[n].push({type:t,listener:e})}))}off(t,e){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=B[s])&&void 0!==n?n:[];o.forEach(((n,s)=>{t&&(t!==n.type||e&&e!==n.listener)||(i.removeEventListener(n.type,n.listener,!1),o[s]={type:"",listener:()=>{}})})),B[s]=o.filter((t=>""!==t.type))}))}emit(t,e){return this.eachElement((i=>{const n=i.lakeId;B[n].forEach((i=>{i.type===t&&i.listener(null!=e?e:new Event(t))}))}))}getEventListeners(t){const e=this.get(t).lakeId;return B[e]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(t=!1){const e=this.get(0);return new T(e.cloneNode(t))}hasAttr(t){return this.get(0).hasAttribute(t)}attr(t,e){var i;if("object"==typeof t)return g(t,((t,e)=>{this.attr(t,e)})),this;if(void 0===e){return null!==(i=this.get(0).getAttribute(t))&&void 0!==i?i:""}return this.eachElement((i=>{i.setAttribute(t,e)}))}removeAttr(t){return this.eachElement((e=>{e.removeAttribute(t)}))}hasClass(t){return h(this.get(0).className,t," ")}addClass(t){return Array.isArray(t)?(t.forEach((t=>{this.addClass(t)})),this):this.eachElement((e=>{h(e.className,t," ")||e.classList.add(t)}))}removeClass(t){return Array.isArray(t)?(t.forEach((t=>{this.removeClass(t)})),this):this.eachElement((e=>{h(e.className,t," ")&&(e.classList.remove(t),""===e.className&&e.removeAttribute("class"))}))}computedCSS(t){return v(this.get(0),t)}css(t,e){if("object"==typeof t)return g(t,((t,e)=>{this.css(t,e)})),this;if(void 0===e){return d(this.get(0).style[l(t)])}return this.eachElement((i=>{i.style[l(t)]=e,""===i.getAttribute("style")&&i.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}innerWidth(){const t=parseInt(this.computedCSS("padding-left"),10)||0,e=parseInt(this.computedCSS("padding-right"),10)||0;return this.width()-t-e}height(){return this.get(0).offsetHeight}show(t="block"){return this.css("display",t),this}hide(){return this.css("display","none"),this}html(t){if(void 0===t){return this.get(0).innerHTML}return this.eachElement((e=>{e.innerHTML=t}))}text(t){var e;if(void 0===t){const t=this.get(0);if(this.isText)return null!==(e=t.nodeValue)&&void 0!==e?e:"";return t.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((e=>{e.innerText=t}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(t){if("string"==typeof t)return this.eachElement((e=>{w(t).reverse().forEach((t=>{e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t),this}append(t){if("string"==typeof t)return this.eachElement((e=>{w(t).forEach((t=>{e.appendChild(t)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.appendChild(t),this}before(t){if("string"==typeof t)return this.each((e=>{w(t).forEach((t=>{e.parentNode&&e.parentNode.insertBefore(t,e)}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.parentNode.insertBefore(t,e),this):this}after(t){if("string"==typeof t)return this.each((e=>{w(t).reverse().forEach((t=>{e.parentNode&&(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t))}))}));const e=this.get(0);return t instanceof T&&(t=t.get(0)),e.parentNode?(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),this):this}replaceWith(t){return this.each((e=>{let i;i=t instanceof T?t.get(0):w(t)[0],e.parentNode&&e.parentNode.replaceChild(i,e)}))}remove(t=!1){return this.each((e=>{if(e.parentNode){if(t){let t=e.firstChild;for(;t;){const i=t.nextSibling;e.parentNode.insertBefore(t,e),t=i}}e.parentNode.removeChild(e)}})),this}splitText(t){if(!this.isText)return new T;const e=this.get(0).splitText(t);return new T(e)}toString(){if(0===this.length)return"";const t=this.get(0);let e=this.isText?t.nodeValue:this.outerHTML();return e&&e.length>50&&(e=`${e.substring(0,50)} ...`),`node (${t.lakeId}): ${e}`}debug(){A(this.toString())}}function I(t){if(t instanceof T)return t;const e=w(t);return new T(e)}class E{constructor(t){this.range=null!=t?t:document.createRange()}get startNode(){return new T(this.range.startContainer)}get startOffset(){return this.range.startOffset}get endNode(){return new T(this.range.endContainer)}get endOffset(){return this.range.endOffset}get commonAncestor(){return new T(this.range.commonAncestorContainer)}get isCollapsed(){return this.range.collapsed}get isBox(){return this.commonAncestor.closest("lake-box").length>0}get isBoxLeft(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareBeforeNode(e)>=0}get isBoxCenter(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===e.get(0)&&0===this.startOffset}get isBoxRight(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return this.compareAfterNode(e)<=0}get isInsideBox(){const t=this.commonAncestor.closest("lake-box");if(0===t.length)return!1;const e=t.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==e.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(e)<0&&this.compareAfterNode(e)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const t=this.startNode.closest("td"),e=this.endNode.closest("td");return t.length>0&&e.length>0&&t.get(0)!==e.get(0)}get(){return this.range}comparePoint(t,e){return this.range.comparePoint(t.get(0),e)}compareBeforeNode(t){const e=new E;return t.isText?e.setStart(t,0):e.setStartBefore(t),e.collapseToStart(),this.comparePoint(e.startNode,e.startOffset)}compareAfterNode(t){var e;const i=new E;if(t.isText){const n=null!==(e=t.get(0).nodeValue)&&void 0!==e?e:"";i.setStart(t,n.length)}else i.setStartAfter(t);return i.collapseToStart(),this.comparePoint(i.startNode,i.startOffset)}intersectsNode(t){return this.range.intersectsNode(t.get(0))}setStart(t,e){this.range.setStart(t.get(0),e)}setStartBefore(t){this.range.setStartBefore(t.get(0))}setStartAfter(t){this.range.setStartAfter(t.get(0))}setEnd(t,e){this.range.setEnd(t.get(0),e)}setEndBefore(t){this.range.setEndBefore(t.get(0))}setEndAfter(t){this.range.setEndAfter(t.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(t){this.range.selectNode(t.get(0))}selectNodeContents(t){this.range.selectNodeContents(t.get(0))}selectBox(t){const e=t.find(".lake-box-container");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.setStart(e,0),this.collapseToStart()}selectBoxLeft(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(0)),this.collapseToEnd()}selectBoxRight(t){const e=t.find(".lake-box-strip");if(0===e.length)throw new Error(`The box cannot be selected because the box '${t.attr("name")}' (id=${t.id}) has not been rendered yet.`);this.selectNodeContents(e.eq(1)),this.collapseToEnd()}shrinkBefore(t){if(t.isBox)return void this.selectBoxLeft(t);if(t.isText)return this.setStartBefore(t),void this.collapseToStart();let e;for(this.setStart(t,0);this.startNode.isElement&&(e=this.startNode.children()[0])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxLeft(e);this.setStart(e,0)}this.collapseToStart()}shrinkAfter(t){if(t.isBox)return void this.selectBoxRight(t);if(t.isText)return this.setEndAfter(t),void this.collapseToEnd();let e;for(this.setEnd(t,t.children().length);this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid;){if(e.isBox)return void this.selectBoxRight(e);this.setEnd(e,e.children().length)}this.collapseToEnd()}shrink(){const t=this.isCollapsed;let e;for(;this.startNode.isElement&&(e=this.startNode.children()[this.startOffset])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setStart(e,0);if(t)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(e=this.endNode.children()[this.endOffset-1])&&e.isElement&&!e.isVoid&&!e.isBox;)this.setEnd(e,e.children().length)}adaptBox(){const t=this.startNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToStart(),e.isBoxRight?this.setStartAfter(t):this.setStartBefore(t)}const e=this.endNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToEnd(),t.isBoxLeft?this.setEndBefore(e):this.setEndAfter(e)}}adaptTable(){const t=this.startNode.closest("table"),e=this.endNode.closest("table");if(0===t.length&&e.length>0&&e.isInside)return this.setEndBefore(e),void this.shrink();0===e.length&&t.length>0&&t.isInside&&(this.setStartAfter(t),this.shrink())}adaptBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let t=this.endNode;for(;0===t.prev().length;)t=t.parent();this.setEndBefore(t)}return void this.shrink()}if(this.startNode.isText)return;const t=this.startNode.children()[this.startOffset];t&&(t.isBlockBox||t.isBlock)&&this.shrinkBefore(t)}adapt(){this.adaptBox(),this.adaptTable(),this.adaptBlock()}getPrevNode(){let t;return t=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=t?t:new T}getNextNode(){let t;return t=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=t?t:new T}getBoxes(){if(this.isCollapsed){const t=this.startNode.closest("lake-box");return t.length>0?[t]:[]}const t=[],e=this.clone();e.adaptBox();for(const i of e.commonAncestor.getWalker())i.isBox&&e.intersectsNode(i)&&t.push(i);return t}getBlocks(){if(this.isCollapsed){const t=this.startNode.closestOperableBlock();return t.isTable?[]:t.isInside?[t]:[]}const t=this.startNode.closestOperableBlock(),e=this.endNode.closestOperableBlock();if(t.isInside&&t.get(0)&&t.get(0)===e.get(0))return t.isTable?[]:[t];const i=[],n=this.clone();n.collapseToEnd();for(const t of this.commonAncestor.getWalker())t.isBlock&&!t.isTable&&t.isTopInside&&0!==n.comparePoint(t,0)&&this.intersectsNode(t)&&i.push(t);if(i.length>0)return i;for(const n of this.commonAncestor.getWalker())n.isBlock&&!n.isTable&&(t.isSibling(n)||e.isSibling(n))&&this.intersectsNode(n)&&i.push(n);return i}getMarks(t=!1){const e=[];if(this.commonAncestor.isText&&t&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return e.push(this.commonAncestor),e;const i=this.clone();i.collapseToStart();const n=this.clone();n.collapseToEnd();for(const s of this.commonAncestor.getWalker()){const o=document.createRange();if(o.setStartAfter(s.get(0)),o.collapse(!0),n.compareBeforeNode(s)>=0)break;i.compareAfterNode(s)>0&&(s.isMark||s.isText&&t)&&e.push(s)}return e}getLeftText(){const t=this.startNode,e=this.startOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new E;n.setStartBefore(i),n.setEnd(t,e);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}getRightText(){const t=this.endNode,e=this.endOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new E;n.setStart(t,e),n.setEndAfter(i);const s=I("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"":o}clone(){return new E(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){A("--- range information ---"),A("start node:",this.startNode.toString(),", offset:",this.startOffset),A("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function M(t,e,i){const n=new E;let s;if(t.isText){s=t.parent();const i=t.splitText(e);n.setStartAfter(t),""===t.text()&&t.remove(),""===i.text()&&i.remove()}else n.setStart(t,e),s=t;if("body"===s.name||"html"===s.name)return null;if(s.get(0)===i.get(0))return null;n.collapseToStart();const o=s.clone();let r=s.first();for(;r.length>0&&!(n.compareBeforeNode(r)>=0);){const t=r.next();o.append(r),r=t}return s.before(o),s.parent().length>0&&s.parent().get(0)!==i.get(0)?M(s.parent(),s.index(),i):{left:o,right:s}}function P(t,e){let i=t;for(;i.length>0;){let t=i.first();for(;t.isText&&t.isEmpty;)t=t.next();if(i.isText||i.isBox)break;if(i.isElement&&1===i.children().length&&t.isBookmark){i.prepend(e);break}if(i.isElement&&!i.isVoid&&0===t.length){i.append(e);break}i=t}}function Z(t){if(0===t.length)return;const e=[];let i=t.first();for(;i.length>0;){const t=i.next();i.isText&&""===i.text()||e.push(i),i=t}(1===e.length&&"br"===e[0].name||2===e.length&&"br"===e[0].name&&e[1].isBookmark)&&e[0].remove(),2===e.length&&e[0].isBookmark&&"br"===e[1].name&&e[1].remove()}function z(t){if(t.isText)return{node:t,offset:t.text().length};const e=new E;return e.setEndAfter(t),{node:e.endNode,offset:e.endOffset}}function N(t,e){const i=e;if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(e.length-1)}if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(0)}if(t.isText||e.isText||t.isVoid||e.isVoid)return z(t);Z(t),Z(e),t.isBlock&&t.isEmpty&&e.isEmpty&&P(t,I("<br />"));const n=t.last(),s=e.first();let o=s;for(;o.length>0;){const e=o.next();t.append(o),o=e}return i.remove(),n.length>0&&s.length>0&&n.isElement&&!n.isBox&&n.clone(!1).get(0).isEqualNode(s.clone(!1).get(0))?N(n,s):0===n.length?{node:t,offset:0}:z(n)}function O(t){let e=t;for(;e.length>0;){let t=e.first();if(t.isText&&t.isEmpty&&(t=t.next()),e.isElement&&!e.isVoid&&0===t.length)break;e=t}return e}function H(t,e){if(e=null!=e?e:I("<p />"),0===t.length)return e;const i=O(e=e.clone(!0));return t[0].before(e),t.forEach((t=>{i.append(t)})),e}function D(t){for(const e of t.getWalker())if(e.isText&&e.text().length>1){const t=e.text();/\u200B/.test(e.text())&&(e.get(0).nodeValue=t.replace(/\u200B/g,""))}}function $(t,e){const i=t.get(0),n=I(a`<${e} />`);for(const t of i.attributes)n.attr(t.name,t.value);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),s=t}return t.replaceWith(n),n}function V(t){if(0===t.length)return;const e=t[0],i=t[t.length-1],n=[];let s=e.prev();for(;s.length>0&&"ol"===s.name;)n.push(s),s=s.prev();n.reverse(),n.push(...t);let o=i.next();for(;o.length>0&&"ol"===o.name;)n.push(o),o=o.next();let r=1;for(const t of n){const e=t.prev();if(0!==e.length&&"ol"===e.name||(r=1),"ol"===t.name){"ol"===e.name&&e.attr("indent")!==t.attr("indent")&&(r=1);const i=t.attr("start"),n=r.toString(10);i!==n&&t.attr("start",n),r++}}}function F(t,e){if(t.isList){let i=Number.parseInt(t.attr("indent"),10)||0;if("increase"===e?i++:i--,i<=0)i=0;else if(i>10)return;return 0===i?t.removeAttr("indent"):t.attr("indent",i.toString(10)),void V([t])}let i=Number.parseInt(t.css("margin-left"),10)||0;"decrease"!==e||0!==i||""===t.css("text-indent")?("increase"===e?i+=40:i-=40,i<=0&&(i=0),0===i?t.css("margin-left",""):t.css("margin-left",`${i}px`)):t.css("text-indent","")}const R=new Set;function W(){}const j={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:W,afterNodeAdded:W,beforeNodeMorphed:W,afterNodeMorphed:W,beforeNodeRemoved:W,afterNodeRemoved:W,beforeAttributeUpdated:W,afterAttributeUpdated:W,beforeChildrenUpdated:W},head:{style:"merge",shouldPreserve:t=>"true"===t.getAttribute("im-preserve"),shouldReAppend:t=>"true"===t.getAttribute("im-re-append"),shouldRemove:W,afterHeadMorphed:W}};function U(t,e){return!t.deadIds.has(e)}function q(t,e,i){return(t.idMap.get(i)||R).has(e)}function K(t,e){const i=t.idMap.get(e)||R;for(const e of i)t.deadIds.add(e)}function G(t,e,i){const n=t.idMap.get(e)||R;let s=0;for(const e of n)U(t,e)&&q(t,e,i)&&++s;return s}function X(t,e){const i=t.parentElement,n=t.querySelectorAll("[id]");for(const t of n){let n=t;for(;n!==i&&null!=n;){let i=e.get(n);null==i&&(i=new Set,e.set(n,i)),i.add(t.id),n=n.parentElement}}}function J(t,e){const i=new Map;return X(t,i),X(e,i),i}function Y(t,e,i){return{target:t,newContent:e,config:i=function(t){const e={};return Object.assign(e,j),Object.assign(e,t),e.callbacks={},Object.assign(e.callbacks,j.callbacks),Object.assign(e.callbacks,t.callbacks),e.head={},Object.assign(e.head,j.head),Object.assign(e.head,t.head),e}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:J(t,e),deadIds:new Set,callbacks:i.callbacks,head:i.head}}function Q(t,e,i){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName&&(""!==t.id&&t.id===e.id||G(i,t,e)>0))}function tt(t,e){return null!=t&&null!=e&&(t.nodeType===e.nodeType&&t.tagName===e.tagName)}function et(t,e){K(e,t),!1!==e.callbacks.beforeNodeRemoved(t)&&(t.remove(),e.callbacks.afterNodeRemoved(t))}function it(t,e,i){let n=t;for(;n&&n!==e;){const t=n;n=n.nextSibling,et(t,i)}return K(i,e),e.nextSibling}function nt(t,e,i,n,s){const o=G(s,i,e);let r=null;if(o>0){r=n;let e=0;for(;null!=r;){if(Q(i,r,s))return r;if(e+=G(s,r,t),e>o)return null;r=r.nextSibling}}return r}function st(t,e,i,n,s){let o=n,r=i.nextSibling,a=0;for(;null!=o;){if(G(s,o,t)>0)return null;if(tt(i,o))return o;if(tt(r,o)&&(a++,r=r?r.nextSibling:null,a>=2))return null;o=o?o.nextSibling:null}return o}function ot(t,e,i){return tt(t,e)?.5+G(i,t,e):0}function rt(t,e,i,n){return!("value"!==t||!n.ignoreActiveValue||e!==document.activeElement)||!1===n.callbacks.beforeAttributeUpdated(t,e,i)}function at(t,e,i){var n;if(!i.ignoreActive||t!==document.activeElement)return null==e?!1===i.callbacks.beforeNodeRemoved(t)?t:(t.remove(),i.callbacks.afterNodeRemoved(t),null):tt(t,e)?(!1===i.callbacks.beforeNodeMorphed(t,e)||(function(t,e,i){const n=t.nodeType;if(1===n){const n=t.attributes,s=e.attributes;for(const t of n)rt(t.name,e,"update",i)||e.getAttribute(t.name)!==t.value&&(e.setAttribute(t.name,t.value),i.callbacks.afterAttributeUpdated(t.name,e,"update"));for(let n=s.length-1;n>=0;n--){const o=s[n];rt(o.name,e,"remove",i)||t.hasAttribute(o.name)||(e.removeAttribute(o.name),i.callbacks.afterAttributeUpdated(o.name,e,"remove"))}}8!==n&&3!==n||e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue)}(e,t,i),!1===i.callbacks.beforeChildrenUpdated(t,e)||function(t,e){return e.ignoreActiveValue&&t===document.activeElement}(t,i)||lt(e,t,i),i.callbacks.afterNodeMorphed(t,e)),t):!1===i.callbacks.beforeNodeRemoved(t)||!1===i.callbacks.beforeNodeAdded(e)?t:(null===(n=t.parentElement)||void 0===n||n.replaceChild(e,t),i.callbacks.afterNodeAdded(e),i.callbacks.afterNodeRemoved(t),e)}function lt(t,e,i){let n,s=t.firstChild,o=e.firstChild;for(;s;){if(n=s,s=n.nextSibling,null==o){if(!1===i.callbacks.beforeNodeAdded(n))return;e.appendChild(n),i.callbacks.afterNodeAdded(n),K(i,n);continue}if(Q(n,o,i)){at(o,n,i),o=o.nextSibling,K(i,n);continue}const r=nt(t,e,n,o,i);if(r){o=it(o,r,i),at(r,n,i),K(i,n);continue}const a=st(t,0,n,o,i);if(a)o=it(o,a,i),at(a,n,i),K(i,n);else{if(!1===i.callbacks.beforeNodeAdded(n))return;e.insertBefore(n,o),i.callbacks.afterNodeAdded(n),K(i,n)}}for(;null!==o;){const t=o;o=o.nextSibling,et(t,i)}}function ht(t,e,i){if("innerHTML"===i.morphStyle)return lt(e,t,i),t.children;if("outerHTML"===i.morphStyle||null==i.morphStyle){const n=function(t,e,i){let n;n=t.firstChild;let s=n,o=0;for(;n;){const t=ot(n,e,i);t>o&&(s=n,o=t),n=n.nextSibling}return s}(e,t,i),s=null==n?void 0:n.previousSibling,o=null==n?void 0:n.nextSibling,r=at(t,n,i);return n?function(t,e,i){var n,s;const o=[],r=[];let a=t;for(;null!=a;)o.push(a),a=a.previousSibling;for(;o.length>0;){const t=o.pop();r.push(t),t&&(null===(n=e.parentElement)||void 0===n||n.insertBefore(t,e))}r.push(e);let l=i;for(;null!=l;)o.push(l),r.push(l),l=l.nextSibling;for(;o.length>0;){const t=o.pop();t&&(null===(s=e.parentElement)||void 0===s||s.insertBefore(t,e.nextSibling))}return r}(s,r,o):[]}throw`Do not understand how to morph style ${i.morphStyle}`}function ct(t,e,i={}){const n=function(t){if(null==t)return document.createElement("div");if(t instanceof Node){if(t.generatedByIdiomorph)return t;const e=document.createElement("div");return e.append(t),e}const e=document.createElement("div");for(const i of[...t])e.append(i);return e}(e.get(0)),s=Y(t.get(0),n,i);ht(t.get(0),n,s)}function dt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function pt(t){const e=new XMLHttpRequest;t.onProgress&&e.upload&&(e.upload.onprogress=e=>{e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress&&t.onProgress(e)});const i=new FormData,n=t.data||{};Object.keys(n).forEach((t=>{const e=n[t];Array.isArray(e)?e.forEach((e=>{i.append(`${t}[]`,e)})):i.append(t,e)}));const s=t.filename||"file";t.file instanceof Blob?i.append(s,t.file,t.file.name):i.append(s,t.file),e.onerror=e=>{t.onError&&t.onError(e)},e.onload=()=>{if(e.status<200||e.status>=300){if(!t.onError)return;return t.onError(function(t,e){const i=`Cannot ${t.method} ${t.action} ${e.status}'`,n=new Error(i);return n.status=e.status,n.method=t.method,n.url=t.action,n}(t,e),dt(e))}if(t.onSuccess)return t.onSuccess(dt(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const o=t.headers||{};return null!==o["X-Requested-With"]&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach((t=>{null!==o[t]&&e.setRequestHeader(t,o[t])})),e.send(i),e}var ut=Object.freeze({__proto__:null,appendDeepest:P,camelCase:l,changeTagName:$,debug:A,denormalizeValue:m,encode:r,fixNumberedList:V,forEach:g,getCSS:v,getDeepest:O,inString:h,mergeNodes:N,modifierText:f,morph:ct,normalizeValue:u,parseStyle:p,query:I,removeBr:Z,removeZWS:D,request:pt,safeTemplate:a,setBlockIndent:F,splitNodes:M,template:s,toHex:d,toNodeList:w,wrapNodeList:H});class mt{constructor(t){this.fragment=null!=t?t:document.createDocumentFragment()}find(t){const e=[];let i=new T(this.fragment.firstChild);for(;i.length>0;)i.matches(t)?e.push(i.get(0)):i.isElement&&i.find(t).each((t=>{e.push(t)})),i=i.next();return new T(e)}append(t){t.each((t=>{this.fragment.appendChild(t)}))}}const ft="function"==typeof Buffer,gt="function"==typeof TextDecoder?new TextDecoder:void 0,vt="function"==typeof TextEncoder?new TextEncoder:void 0,wt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),yt=(t=>{let e={};return t.forEach(((t,i)=>e[t]=i)),e})(wt),xt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bt=String.fromCharCode.bind(String),kt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),_t=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),St=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),Ct=t=>{let e,i,n,s,o="";const r=t.length%3;for(let r=0;r<t.length;){if((i=t.charCodeAt(r++))>255||(n=t.charCodeAt(r++))>255||(s=t.charCodeAt(r++))>255)throw new TypeError("invalid character found");e=i<<16|n<<8|s,o+=wt[e>>18&63]+wt[e>>12&63]+wt[e>>6&63]+wt[63&e]}return r?o.slice(0,r-3)+"===".substring(r):o},At="function"==typeof btoa?t=>btoa(t):ft?t=>Buffer.from(t,"binary").toString("base64"):Ct,Bt=ft?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let i=0,n=t.length;i<n;i+=4096)e.push(bt.apply(null,t.subarray(i,i+4096)));return At(e.join(""))},Lt=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?bt(192|e>>>6)+bt(128|63&e):bt(224|e>>>12&15)+bt(128|e>>>6&63)+bt(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return bt(240|e>>>18&7)+bt(128|e>>>12&63)+bt(128|e>>>6&63)+bt(128|63&e)},Tt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,It=t=>t.replace(Tt,Lt),Et=ft?t=>Buffer.from(t,"utf8").toString("base64"):vt?t=>Bt(vt.encode(t)):t=>At(It(t)),Mt=(t,e=!1)=>e?_t(Et(t)):Et(t),Pt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zt=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return bt(55296+(e>>>10))+bt(56320+(1023&e));case 3:return bt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return bt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},zt=t=>t.replace(Pt,Zt),Nt=t=>{if(t=t.replace(/\s+/g,""),!xt.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,i,n,s="";for(let o=0;o<t.length;)e=yt[t.charAt(o++)]<<18|yt[t.charAt(o++)]<<12|(i=yt[t.charAt(o++)])<<6|(n=yt[t.charAt(o++)]),s+=64===i?bt(e>>16&255):64===n?bt(e>>16&255,e>>8&255):bt(e>>16&255,e>>8&255,255&e);return s},Ot="function"==typeof atob?t=>atob(St(t)):ft?t=>Buffer.from(t,"base64").toString("binary"):Nt,Ht=ft?t=>kt(Buffer.from(t,"base64")):t=>kt(Ot(t).split("").map((t=>t.charCodeAt(0)))),Dt=ft?t=>Buffer.from(t,"base64").toString("utf8"):gt?t=>gt.decode(Ht(t)):t=>zt(Ot(t)),$t=t=>St(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),Vt=t=>Dt($t(t)),Ft=Mt,Rt=Vt;var Wt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function jt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ut={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,o||t,r),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function r(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,o=n.length,r=new Array(o);s<o;s++)r[s]=n[s].fn;return r},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,o,r){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,s),!0;case 5:return c.fn.call(c.context,e,n,s,o),!0;case 6:return c.fn.call(c.context,e,n,s,o,r),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var p,u=c.length;for(h=0;h<u;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),d){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,s);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return r(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||r(this,o);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||s&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[o]=1===h.length?h[0]:h:r(this,o)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&r(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a}(Ut);var qt=jt(Ut.exports);const Kt=new Map,Gt=new Map,Xt={},Jt={},Yt=a`
|
|
2
2
|
<span class="lake-box-strip"><br /></span>
|
|
3
3
|
<div class="lake-box-container" contenteditable="false"></div>
|
|
4
4
|
<span class="lake-box-strip"><br /></span>
|
|
5
|
-
`;class nt{constructor(e){if(this.event=new Xe,"string"==typeof e){const t=Ge.get(e);if(void 0===t)throw new Error(`Box '${e}' has not been defined yet.`);const n=d(t.type),o=d(t.name);this.node=V(h`<lake-box type="${n}" name="${o}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=V(e);const t=Ge.get(this.name);if(void 0===t)throw new Error(`Box '${this.name}' has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}Ye[this.node.id]||(Ye[this.node.id]={}),et[this.node.id]||(et[this.node.id]={setup:[],cleanup:[]})}addFramework(){let e=this.getContainer();0===e.length?(this.node.html(tt),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{H(`Box '${this.name}' (id = ${this.node.id}) value:`),H(this.value)}))}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(_e(e))}set value(e){this.node.attr("value",Ue(JSON.stringify(e)))}updateValue(e,t){const n=this.value;"string"==typeof e?n[e]=t:k(e,((e,t)=>{n[e]=t})),this.value=n}getData(e){return Ye[this.node.id][e]}setData(e,t){Ye[this.node.id][e]=t}getEditor(){const e=this.node.closestContainer();return e.length>0?Qe.get(e.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(e){et[this.node.id].setup.push(e)}render(){et[this.node.id].setup=[],et[this.node.id].cleanup=[];const e=Ge.get(this.name);if(void 0===e)return;this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer(),n=e.clone(!1);n.append(t),fe(e,n)}for(const e of et[this.node.id].setup){const t=e();void 0!==t&&et[this.node.id].cleanup.push(t)}H(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){for(const e of et[this.node.id].cleanup)e();Ye[this.node.id]={},et[this.node.id].setup=[],et[this.node.id].cleanup=[],this.node.empty(),H(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const e=Ge.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}const ot={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function it(){return{h1:Object.assign({},ot),h2:Object.assign({},ot),h3:Object.assign({},ot),h4:Object.assign({},ot),h5:Object.assign({},ot),h6:Object.assign({},ot),p:Object.assign({},ot),blockquote:Object.assign(Object.assign({},ot),{type:["success","info","warning","error"]}),ul:Object.assign(Object.assign({},ot),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},ot),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["left","center","right"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w-]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w-]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class st{constructor(e,t=it()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new L(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let n=e.name,o=t[n];if(!o)return"";"string"==typeof o&&(n=o,o=t[n]);const i=e.get(0);if(!i.hasAttributes())return n;const s=new Map;for(const e of i.attributes)if(o[e.name]&&("style"!==e.name&&st.matchRule(o[e.name],e.value)&&s.set(e.name,e.value),"style"===e.name)){const t=o.style,n=new Map;k(m(e.value),((e,o)=>{t[e]&&st.matchRule(t[e],o)&&n.set(e,o)})),s.set("style",n)}let r=n;for(const[e,t]of s)if("style"===e){let e="";for(const[n,o]of t)e+=`${n}: ${o.replace(/"/g,""")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let n=e.name;const o=t[n];return o?("string"==typeof o&&(n=o),n):""}static getTrimmedText(e){const t=e.parent(),n=e.prev(),o=e.next();let i=e.text();return(n.isBlock||n.isBlockBox)&&(o.isBlock||o.isBlockBox)||0===n.length&&0===o.length&&t.isBlock?i=i.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):n.isBlock||n.isBlockBox||0===n.length&&t.isBlock?i=i.replace(/^[\u0020\t\r\n]+/,""):(o.isBlock||o.isBlockBox||0===o.length&&t.isBlock)&&(i=i.replace(/[\u0020\t\r\n]+$/,"")),i}getHTML(){const e=this.rules;let t="";for(const n of function*t(n){let o=n.first();for(;o.length>0;){const n=o.next();if(o.isText)yield d(st.getTrimmedText(o));else if(o.isVoid){const t=st.getOpenTagString(o,e);""!==t&&(yield`<${t} />`)}else if(o.isElement){const n=st.getOpenTagString(o,e),i=st.getClosedTagString(o,e);""!==n&&(yield`<${n}>`),o.isBox||(yield*t(o)),""!==i&&(yield`</${i}>`)}o=n}}(this.source))t+=n;return t.trim()}getNodeList(){const e=this.getHTML();return this.parseHTML(e).children()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),n=document.createDocumentFragment();let o=t.first();for(;o.length>0;){const e=o.next();n.appendChild(o.get(0)),o=e}return n}}class rt{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g," "),e=d(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new st(this.getHTML()).getFragment()}}function at(e,t){if(e.commonAncestor.isOutside)return;const n=(t=V(t)).get(0),o=e.get();o.insertNode(n),o.setEndAfter(n),o.collapse(!1)}function lt(e){if(e.commonAncestor.isOutside)return{anchor:new L,focus:new L};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxLeft?t.attr("focus","left"):e.isBoxRight?t.attr("focus","right"):t.attr("focus","center"),{anchor:new L,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const n=V('<lake-bookmark type="focus" />');return at(t,n),{anchor:new L,focus:n}}const n=e.clone();n.collapseToStart();const o=V('<lake-bookmark type="anchor" />');at(n,o);const i=e.clone();i.collapseToEnd();const s=V('<lake-bookmark type="focus" />');return at(i,s),{anchor:o,focus:s}}function ct(e,t){const n=e.prev(),o=e.next();if(n.isText&&o.isText){const t=e.parent();P(t),e.remove(),t.get(0).normalize()}else if(0===n.length&&0===o.length){if(e.parent().isMark&&t){const n=new L(document.createTextNode(""));e.before(n),t.setStartAfter(n),t.collapseToStart()}e.remove()}else e.remove()}function dt(e,t){const n=t.anchor,o=t.focus;if(n.length>0&&0===o.length)ct(n);else{if(o.length>0&&0===n.length){if(o.isBox){const t=new nt(o);0===t.getContainer().length&&t.render();const n=o.attr("focus");return"left"===n?e.selectBoxLeft(o):"center"===n?e.selectBox(o):e.selectBoxRight(o),void o.removeAttr("focus")}return e.setStartBefore(o),e.collapseToStart(),void ct(o,e)}if(n.length>0&&o.length>0){const t=new $;t.selectNode(n),t.collapseToEnd(),-1===t.compareAfterNode(o)?(e.setStartBefore(o),ct(o),e.setEndBefore(n),ct(n)):(e.setStartBefore(n),ct(n),e.setEndBefore(o),ct(o))}}}function ht(e){if(e.commonAncestor.isOutside)return;q(e.getBlocks())}function ut(e){if(e.isCollapsed)return;if(e.adapt(),e.isInoperative)return;const t=e.startNode.closestBlock(),n=e.endNode.closestBlock(),o=t.get(0)===n.get(0);if(e.get().deleteContents(),e.adaptBlock(),o){const t=e.getBlocks()[0];return void(t&&t.isEmpty&&(I(t,V("<br />")),e.shrinkAfter(t)))}const i=e.getBlocks()[0];if(!i)return;const s=i.prev();if(0===s.length)return;const r=lt(e);R(s,i),dt(e,r),ht(e)}function ft(e,t){if(e.commonAncestor.isOutside)return;e.isCollapsed?e.adaptBox():ut(e);O(e.startNode.closestBlock());const n=lt(e);n.focus.before(t),dt(e,n),e.adaptBlock()}function pt(e,t){const n=V(t),o=document.createDocumentFragment();n.each((e=>{o.appendChild(e)})),ft(e,o)}function gt(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed&&e.isBox)return;if("string"!=typeof t){const n=e.getBlocks();for(const e of n)e.css(t);return}const n=V(t),o=n.name,i=n.get(0).attributes,s=e.getBlocks();if(s.length>0){const t=lt(e);for(const e of s)if(e.name===o&&0===n.first().length)for(const t of i)e.attr(t.name,t.value);else{const t=n.clone(!0);e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const o=z(t);let i=e.first();for(;i.length>0;){const e=i.next();o.append(i),o.name!==i.name&&"li"!==i.name||i.remove(!0),i=e}e.replaceWith(t)}return dt(e,t),void ht(e)}const r=lt(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let n=[];if(0===t.length)return n;let o=t.first(),i=!0;for(;o.length>0;){if(o.isMark||o.isText||o.isBookmark||o.isInlineBox)n.push(o);else{if(!i)break;n=[]}e.intersectsNode(o)&&(i=!1),o=o.next()}return n}(e),l=j(a,n);dt(e,r),ht(e),l.isEmpty&&(I(l,V("<br />")),e.shrinkAfter(l))}function mt(e){if(e.commonAncestor.isOutside)return{left:null,right:null};e.isCollapsed?e.adaptBox():ut(e);const t=e.startNode,n=t.closestOperableBlock();if(0===n.length)return{left:null,right:null};let o=n.parent();o.isOutside&&(o=t.closestContainer());const i=Z(t,e.startOffset,o);let s=null,r=null;return i&&(s=i.left,r=i.right),!i&&t.isBlock&&(e.startOffset>0&&(s=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),s&&s.isEmpty&&I(s,V("<br />")),r&&(r.isEmpty?(I(r,V("<br />")),e.shrinkAfter(r)):e.shrinkBefore(r)),ht(e),{left:s,right:r}}function vt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function xt(e,t,n){let o=null,i=null,s=e.closestBlock();0===s.length&&(s=e.closestContainer());const r=Z(e,t,s);return r&&(n?(vt(r.left),vt(r.right),r.left.isEmpty||(o=r.left),r.right.isEmpty||(i=r.right)):(o=r.left,i=r.right)),{left:o,right:i}}function kt(e,t=!0){if(e.commonAncestor.isOutside)return{left:null,center:null,right:null};if(e.adaptBox(),e.isCollapsed){const n=xt(e.startNode,e.startOffset,t);return n.left?(e.setStartAfter(n.left),e.collapseToStart()):n.right&&(e.setStartBefore(n.right),e.collapseToStart()),{left:n.left,center:null,right:n.right}}const n=xt(e.startNode,e.startOffset,t);n.left?e.setStartAfter(n.left):n.right&&e.setStartBefore(n.right);const o=xt(e.endNode,e.endOffset,t);return o.left?e.setEndAfter(o.left):o.right&&e.setEndBefore(o.right),{left:n.left,center:o.left,right:o.right}}function wt(e,t){const n=e.text();let o=e;for(;o.length>0;){const e=o.parent();if(!e.isMark||n!==e.text()||!o.isText&&o.name===t&&""!==o.attr("style"))break;o=e}return o}function bt(e,t){if(e.commonAncestor.isOutside)return;let n=V(t);const o=n.name,i=m(n.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===new nt(t).type){const n=V("<p><br /></p>");e.isBoxLeft?t.before(n):t.after(n),e.shrinkAfter(n)}else e.adaptBox()}O(e.startNode.closestBlock());const t=new L(document.createTextNode("")),s=kt(e);if(s.left){const e=function(e){if(!e.isMark)return null;let t=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark){const e=n.clone();t.append(e),t=e}n=n.last()}return t}(s.left);e&&(e.name===o?(e.css(i),n=e):(I(e,t),n.append(e)))}return""===n.text()&&n.append(t),at(e,n),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const n=e.next();n.length>0&&n.isText&&n.isEmpty&&n.remove()}(n),void e.shrinkAfter(n)}kt(e);const s=e.getMarks(!0),r=lt(e);for(const e of s)if(!e.isEmpty&&e.isText){const t=wt(e,o);if(t.isMark&&t.name===o)t.css(i);else{const e=n.clone();t.before(e),e.append(t)}}dt(e,r)}function yt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function Bt(e,t){if(e.commonAncestor.isOutside)return;let n;if(t){n=V(t).name}if(e.isCollapsed){if(e.isBox)return;if(n&&0===e.commonAncestor.closest(n).length)return;const t=kt(e,!1);if(!t.left)return;t.right&&yt(t.right);const o=new L(document.createTextNode("")),i=function(e,t){if(!e.isMark||!t)return null;let n=e.clone(),o=e.last();for(;o.length>0;){if(o.isMark&&o.name!==t){const e=o.clone();n.append(e),n=e}o=o.last()}if(n.name===t){if(!(n.first().length>0))return null;n=n.first()}return n}(t.left,n);return i?(I(i,o),t.left.after(i),yt(t.left),void e.shrinkAfter(i)):(t.left.after(o),yt(t.left),o.prev().isText?(e.setStartAfter(o.prev()),e.collapseToStart(),void o.remove()):(e.setStartAfter(o),void e.collapseToStart()))}kt(e);const o=e.getMarks(),i=lt(e);for(const e of o)if(!n||e.name===n){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}P(e.commonAncestor),dt(e,i)}function At(e,t){if(e.commonAncestor.isOutside)return null;const n=V(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=n.clone(!0);return O(e.startNode.closestBlock()),at(e,t),t}return""!==n.attr("href")&&t.attr({href:n.attr("href")}),t}kt(e);const o=lt(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const i=n.clone(!1);o.anchor.after(i);let s=i.next();for(;s.length>0;){const e=s.next();if(!s.isMark&&!s.isText)break;i.append(s),s=e}return 0===i.first().length&&i.remove(),dt(e,o),i}var Ct=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},St="object"==typeof We&&We&&We.Object===Object&&We,Mt="object"==typeof self&&self&&self.Object===Object&&self,Tt=St||Mt||Function("return this")(),Ht=Tt,Et=function(){return Ht.Date.now()},Nt=/\s/;var Lt=function(e){for(var t=e.length;t--&&Nt.test(e.charAt(t)););return t},Vt=Lt,$t=/^\s+/;var Zt=function(e){return e?e.slice(0,Vt(e)+1).replace($t,""):e},It=Tt.Symbol,Ot=It,Dt=Object.prototype,Rt=Dt.hasOwnProperty,zt=Dt.toString,jt=Ot?Ot.toStringTag:void 0;var Pt=function(e){var t=Rt.call(e,jt),n=e[jt];try{e[jt]=void 0;var o=!0}catch(e){}var i=zt.call(e);return o&&(t?e[jt]=n:delete e[jt]),i},Ft=Object.prototype.toString;var qt=Pt,Ut=function(e){return Ft.call(e)},_t=It?It.toStringTag:void 0;var Wt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_t&&_t in Object(e)?qt(e):Ut(e)},Kt=function(e){return null!=e&&"object"==typeof e};var Jt=Zt,Xt=Ct,Gt=function(e){return"symbol"==typeof e||Kt(e)&&"[object Symbol]"==Wt(e)},Qt=/^[-+]0x[0-9a-f]+$/i,Yt=/^0b[01]+$/i,en=/^0o[0-7]+$/i,tn=parseInt;var nn=Ct,on=Et,sn=function(e){if("number"==typeof e)return e;if(Gt(e))return NaN;if(Xt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Jt(e);var n=Yt.test(e);return n||en.test(e)?tn(e.slice(2),n?2:8):Qt.test(e)?NaN:+e},rn=Math.max,an=Math.min;var ln=function(e,t,n){var o,i,s,r,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=o,s=i;return o=i=void 0,c=t,r=e.apply(s,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=s}function g(){var e=on();if(p(e))return m(e);a=setTimeout(g,function(e){var n=t-(e-l);return h?an(n,s-(e-c)):n}(e))}function m(e){return a=void 0,u&&o?f(e):(o=i=void 0,r)}function v(){var e=on(),n=p(e);if(o=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(g,t),d?f(e):r}(l);if(h)return clearTimeout(a),a=setTimeout(g,t),f(l)}return void 0===a&&(a=setTimeout(g,t)),r}return t=sn(t)||0,nn(n)&&(d=!!n.leading,s=(h="maxWait"in n)?rn(sn(n.maxWait)||0,t):s,u="trailing"in n?!!n.trailing:u),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=i=a=void 0},v.flush=function(){return void 0===a?r:m(on())},v},cn=Ke(ln),dn="0.0.1";function hn(e){const t=e.get(0),n={};if(t.hasAttributes())for(const e of t.attributes)n[e.name]=e.value;return n}class un{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getRangeFromNativeSelection(),this.appliedItems=[]}getRangeFromNativeSelection(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new $(e)}return new $}addRangeToNativeSelection(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}syncByRange(){const e=this.getRangeFromNativeSelection();this.range.get()!==e.get()&&(this.range=e)}synByBookmark(){const e=this.range,t=this.container,n=t.find("lake-box[focus]");if(n.length>0)return dt(e,{anchor:new L,focus:n}),void this.addRangeToNativeSelection();dt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.addRangeToNativeSelection()}getAppliedItems(){const e=[];return function(e,t){let n=t.startNode;for(n.isText&&(n=n.parent());n.length>0&&n.isInside;)e.push({node:n,name:n.name,attributes:hn(n),styles:m(n.attr("style"))}),n=n.parent()}(e,this.range),function(e,t){const n=t.startNode;let o;if(n.isText&&n.text().length===t.startOffset){const e=n.next();e.length>0&&e.isElement&&(o=e)}if(n.isElement){const e=n.children();if(e.length>0){const n=e[t.startOffset];n&&n.isElement&&(o=n)}}if(o){let t=o;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:hn(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return lt(this.range)}toBookmark(e){return dt(this.range,e)}insertNode(e){return at(this.range,e)}insertFragment(e){return ft(this.range,e)}insertContents(e){return pt(this.range,e)}deleteContents(){return ut(this.range)}setBlocks(e){return gt(this.range,e)}splitBlock(){return mt(this.range)}splitMarks(e){return kt(this.range,e)}addMark(e){return bt(this.range,e)}removeMark(e){return Bt(this.range,e)}fixList(){return ht(this.range)}insertLink(e){return At(this.range,e)}}class fn{constructor(){this.commandMap=new Map,this.event=new Xe}add(e,t){this.commandMap.set(e,t)}getNames(){return Array.from(this.commandMap.keys())}execute(e,...t){const n=this.commandMap.get(e);if(void 0===n)throw new Error(`Command '${e}' does not exist.`);this.event.emit("beforeexecute",e),n.apply(this,t),this.event.emit("execute",e),H(`Command '${e}' executed`)}}var pn,gn={exports:{}};pn=gn,function(e){function t(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function n(e,n,o,i,s,r){return t((a=t(t(n,e),t(i,r)))<<(l=s)|a>>>32-l,o);var a,l}function o(e,t,o,i,s,r,a){return n(t&o|~t&i,e,t,s,r,a)}function i(e,t,o,i,s,r,a){return n(t&i|o&~i,e,t,s,r,a)}function s(e,t,o,i,s,r,a){return n(t^o^i,e,t,s,r,a)}function r(e,t,o,i,s,r,a){return n(o^(t|~i),e,t,s,r,a)}function a(e,n){var a,l,c,d,h;e[n>>5]|=128<<n%32,e[14+(n+64>>>9<<4)]=n;var u=1732584193,f=-271733879,p=-1732584194,g=271733878;for(a=0;a<e.length;a+=16)l=u,c=f,d=p,h=g,u=o(u,f,p,g,e[a],7,-680876936),g=o(g,u,f,p,e[a+1],12,-389564586),p=o(p,g,u,f,e[a+2],17,606105819),f=o(f,p,g,u,e[a+3],22,-1044525330),u=o(u,f,p,g,e[a+4],7,-176418897),g=o(g,u,f,p,e[a+5],12,1200080426),p=o(p,g,u,f,e[a+6],17,-1473231341),f=o(f,p,g,u,e[a+7],22,-45705983),u=o(u,f,p,g,e[a+8],7,1770035416),g=o(g,u,f,p,e[a+9],12,-1958414417),p=o(p,g,u,f,e[a+10],17,-42063),f=o(f,p,g,u,e[a+11],22,-1990404162),u=o(u,f,p,g,e[a+12],7,1804603682),g=o(g,u,f,p,e[a+13],12,-40341101),p=o(p,g,u,f,e[a+14],17,-1502002290),u=i(u,f=o(f,p,g,u,e[a+15],22,1236535329),p,g,e[a+1],5,-165796510),g=i(g,u,f,p,e[a+6],9,-1069501632),p=i(p,g,u,f,e[a+11],14,643717713),f=i(f,p,g,u,e[a],20,-373897302),u=i(u,f,p,g,e[a+5],5,-701558691),g=i(g,u,f,p,e[a+10],9,38016083),p=i(p,g,u,f,e[a+15],14,-660478335),f=i(f,p,g,u,e[a+4],20,-405537848),u=i(u,f,p,g,e[a+9],5,568446438),g=i(g,u,f,p,e[a+14],9,-1019803690),p=i(p,g,u,f,e[a+3],14,-187363961),f=i(f,p,g,u,e[a+8],20,1163531501),u=i(u,f,p,g,e[a+13],5,-1444681467),g=i(g,u,f,p,e[a+2],9,-51403784),p=i(p,g,u,f,e[a+7],14,1735328473),u=s(u,f=i(f,p,g,u,e[a+12],20,-1926607734),p,g,e[a+5],4,-378558),g=s(g,u,f,p,e[a+8],11,-2022574463),p=s(p,g,u,f,e[a+11],16,1839030562),f=s(f,p,g,u,e[a+14],23,-35309556),u=s(u,f,p,g,e[a+1],4,-1530992060),g=s(g,u,f,p,e[a+4],11,1272893353),p=s(p,g,u,f,e[a+7],16,-155497632),f=s(f,p,g,u,e[a+10],23,-1094730640),u=s(u,f,p,g,e[a+13],4,681279174),g=s(g,u,f,p,e[a],11,-358537222),p=s(p,g,u,f,e[a+3],16,-722521979),f=s(f,p,g,u,e[a+6],23,76029189),u=s(u,f,p,g,e[a+9],4,-640364487),g=s(g,u,f,p,e[a+12],11,-421815835),p=s(p,g,u,f,e[a+15],16,530742520),u=r(u,f=s(f,p,g,u,e[a+2],23,-995338651),p,g,e[a],6,-198630844),g=r(g,u,f,p,e[a+7],10,1126891415),p=r(p,g,u,f,e[a+14],15,-1416354905),f=r(f,p,g,u,e[a+5],21,-57434055),u=r(u,f,p,g,e[a+12],6,1700485571),g=r(g,u,f,p,e[a+3],10,-1894986606),p=r(p,g,u,f,e[a+10],15,-1051523),f=r(f,p,g,u,e[a+1],21,-2054922799),u=r(u,f,p,g,e[a+8],6,1873313359),g=r(g,u,f,p,e[a+15],10,-30611744),p=r(p,g,u,f,e[a+6],15,-1560198380),f=r(f,p,g,u,e[a+13],21,1309151649),u=r(u,f,p,g,e[a+4],6,-145523070),g=r(g,u,f,p,e[a+11],10,-1120210379),p=r(p,g,u,f,e[a+2],15,718787259),f=r(f,p,g,u,e[a+9],21,-343485551),u=t(u,l),f=t(f,c),p=t(p,d),g=t(g,h);return[u,f,p,g]}function l(e){var t,n="",o=32*e.length;for(t=0;t<o;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function c(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var o=8*e.length;for(t=0;t<o;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function d(e){var t,n,o="0123456789abcdef",i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+=o.charAt(t>>>4&15)+o.charAt(15&t);return i}function h(e){return unescape(encodeURIComponent(e))}function u(e){return function(e){return l(a(c(e),8*e.length))}(h(e))}function f(e,t){return function(e,t){var n,o,i=c(e),s=[],r=[];for(s[15]=r[15]=void 0,i.length>16&&(i=a(i,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^i[n],r[n]=1549556828^i[n];return o=a(s.concat(c(t)),512+8*t.length),l(a(r.concat(o),640))}(h(e),h(t))}function p(e,t,n){return t?n?f(t,e):d(f(t,e)):n?u(e):d(u(e))}pn.exports?pn.exports=p:e.md5=p}(We);var mn=Ke(gn.exports);const vn=new Map;class xn{constructor(e){this.selection=e,this.container=e.container,this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new Xe}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new st(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new L(e),n=mn(`${t.attr("type")}-${t.attr("name")}-${t.attr("value")}`);t.attr("id",n)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new L(e).removeAttr("id")}))}morphContainer(e){const t=this.container,n={beforeChildrenUpdated:e=>{if("lake-box"===new L(e).name)return!1},afterAttributeUpdated:(e,n)=>{const o=new L(n);if("value"===e&&"lake-box"===o.name){const e=vn.get(t.id);if(!e)return;e.delete(o.id)}}},o=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(o),fe(t,o,{callbacks:n}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(o)}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{new nt(e).getContainer().empty()})),e.commonAncestor.isOutside)return t;if(e.isInsideBox)return t;const n=e.startNode.path(),o=e.endNode.path(),i=t.find(n),s=t.find(o),r=e.clone();return r.setStart(i,e.startOffset),r.setEnd(s,e.endOffset),lt(r),t}get count(){return this.list.length}get canUndo(){return this.index>1&&!!this.list[this.index-1]}get canRedo(){return!!this.list[this.index]}undo(){if(!this.list[this.index-1])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>0;){const t=this.list[this.index-1];if(!t)break;const n=this.getValue(t);if(this.removeBookmark(n)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",n);break}if(1===this.index)break;this.index--}this.selection.synByBookmark(),H(`History undone, the last index is ${this.index}`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const n=this.getValue(t);if(this.removeBookmark(n)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",n);break}}this.selection.synByBookmark(),H(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(){if(!this.canSave)return;const e=this.cloneContainer(),t=this.getValue(e);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(t)||(this.list.splice(this.index,1/0,e),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),this.event.emit("save",t),H(`History saved, the last index is ${this.index}`))}}var kn=["Shift","Meta","Alt","Control"],wn="object"==typeof navigator?navigator.platform:"",bn=/Mac|iPod|iPhone|iPad/.test(wn),yn=bn?"Meta":"Control",Bn="Win32"===wn?["Control","Alt"]:bn?["Alt"]:[];function An(e,t){return"function"==typeof e.getModifierState&&(e.getModifierState(t)||Bn.includes(t)&&e.getModifierState("AltGraph"))}function Cn(e){return e.trim().split(" ").map((function(e){var t=e.split(/\b\+/),n=t.pop();return[t=t.map((function(e){return"$mod"===e?yn:e})),n]}))}function Sn(e,t){var n;void 0===t&&(t={});var o=null!=(n=t.timeout)?n:1e3,i=Object.keys(e).map((function(t){return[Cn(t),e[t]]})),s=new Map,r=null;return function(e){e instanceof KeyboardEvent&&(i.forEach((function(t){var n=t[0],o=t[1],i=s.get(n)||n;!function(e,t){return!(t[1].toUpperCase()!==e.key.toUpperCase()&&t[1]!==e.code||t[0].find((function(t){return!An(e,t)}))||kn.find((function(n){return!t[0].includes(n)&&t[1]!==n&&An(e,n)})))}(e,i[0])?An(e,e.key)||s.delete(n):i.length>1?s.set(n,i.slice(1)):(s.delete(n),o(e))})),r&&clearTimeout(r),r=setTimeout(s.clear.bind(s),o))}}const Mn=new Map([["#","shift+#"]]);class Tn{constructor(e){this.container=e,this.keydownEventList=[],this.keyupEventList=[]}normalizeType(e){var t;return e=(e=null!==(t=Mn.get(e))&&void 0!==t?t:e).replace(/(^|\+|\s)mod(\+|\s|$)/g,"$1$mod$2").replace(/shift|control|alt|meta|enter|tab|backspace|delete|space|escape|arrow-left|arrow-right|arrow-up|arrow-down/,(e=>e.charAt(0).toUpperCase()+u(e.substring(1)))).replace(/(^|\+|\s)([a-z])(\+|\s|$)/g,((e,t,n,o)=>`${t}Key${n.toUpperCase()}${o}`))}setKeydown(e,t){const n=Sn({[e=this.normalizeType(e)]:e=>t(e)});this.keydownEventList.push({type:e,listener:t}),this.container.on("keydown",n)}setKeyup(e,t){const n=Sn({[e=this.normalizeType(e)]:e=>t(e)});this.keyupEventList.push({type:e,listener:t}),this.container.on("keyup",n)}keydown(e){e=this.normalizeType(e);for(const t of this.keydownEventList)t.type===e&&t.listener(new Event(e))}keyup(e){e=this.normalizeType(e);for(const t of this.keyupEventList)t.type===e&&t.listener(new Event(e))}}const Hn={value:"<p><br /><focus /></p>",readonly:!1,spellcheck:!1,minChangeSize:5,imageRequestMethod:"POST",imageRequestAction:"/upload",imageRequestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]};class En{constructor(e){if(!e.root)throw new Error("The root of the config must be specified.");this.root=V(e.root),this.config=Object.assign(Object.assign({},Hn),e),this.containerWrapper=V('<div class="lake-container-wrapper" />'),this.container=V('<div class="lake-container" />'),this.overlayContainer=V('<div class="lake-overlay" />'),this.popupContainer=V('<div class="lake-popup lake-custom-properties" />'),this.isComposing=!1,this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false"}),this.event=new Xe,this.selection=new un(this.container),this.command=new fn,this.history=new xn(this.selection),this.keystroke=new Tn(this.container),this.box=En.box,this.unsavedInputData="",Qe.set(this.container.id,this),this.beforeunloadListener=()=>{this.commitUnsavedInputData()};const t=cn((()=>{if(0===this.root.first().length)return;const e=this.selection.range,t=e.clone();t.adaptBox(),this.box.findAll(this).each((n=>{const o=new nt(n),i=o.getContainer();if(0!==i.length){if(e.compareBeforeNode(i)<0&&e.compareAfterNode(i)>0&&(!e.isCollapsed||e.startNode.get(0)!==i.get(0)||0!==e.startOffset))return i.removeClass("lake-box-selected"),i.removeClass("lake-box-focused"),void i.addClass("lake-box-activated");if(t.intersectsNode(o.node))return i.removeClass("lake-box-activated"),void(e.isCollapsed?(i.removeClass("lake-box-selected"),i.addClass("lake-box-focused")):(i.removeClass("lake-box-focused"),i.addClass("lake-box-selected")));i.removeClass("lake-box-activated"),i.removeClass("lake-box-focused"),i.removeClass("lake-box-selected")}}))}),50,{leading:!1,trailing:!0,maxWait:50});this.selectionchangeListener=()=>{this.selection.syncByRange(),this.selection.appliedItems=this.selection.getAppliedItems(),t(),this.event.emit("selectionchange")},this.clickListener=e=>{const t=new L(e.target);this.event.emit("click",t)},this.mouseoverListener=e=>{const t=new L(e.target);this.event.emit("mouseover",t)},this.resizeListener=()=>{this.event.emit("resize")}}inputInBoxStrip(){const e=this.selection,t=e.range,n=t.startNode.closest(".lake-box-strip"),o=n.closest("lake-box");if("inline"===new nt(o).type)t.isBoxLeft?(t.setStartBefore(o),t.collapseToStart()):(t.setStartAfter(o),t.collapseToStart());else{const e=V("<p />");t.isBoxLeft?o.before(e):o.after(e),t.shrinkAfter(e)}const i=n.text();n.html("<br />"),e.insertNode(document.createTextNode(i))}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0})),this.container.on("compositionend",(()=>{this.isComposing=!1})),this.container.on("beforeinput",(()=>{const e=this.selection.range;(e.isBoxLeft||e.isBoxRight)&&this.commitUnsavedInputData()})),this.container.on("input",(e=>{const t=e;window.setTimeout((()=>{var e;const n=this.selection.range;if(!n.isInsideBox)if(this.isComposing)this.event.emit("input",t);else{if("insertText"===t.inputType||"insertCompositionText"===t.inputType)if(n.isBoxLeft||n.isBoxRight)this.inputInBoxStrip();else if(this.unsavedInputData+=null!==(e=t.data)&&void 0!==e?e:"",this.unsavedInputData.length<this.config.minChangeSize)return void this.event.emit("input",t);this.history.save(),this.unsavedInputData="",this.event.emit("input",t)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(e=>{this.box.renderAll(this),this.event.emit("change",e)})),this.history.event.on("redo",(e=>{this.box.renderAll(this),this.event.emit("change",e)})),this.history.event.on("save",(e=>{this.box.rectifyInstances(this),this.event.emit("change",e)}))}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}focus(){this.container.focus()}blur(){this.container.blur()}setValue(e){e=v(e);const t=new st(e).getFragment();this.container.empty(),this.container.append(t),En.box.renderAll(this),this.selection.synByBookmark()}getValue(){const e=this.selection.insertBookmark();let t=new st(this.container).getHTML();return t=x(t),this.selection.toBookmark(e),t}insertBox(e,t){const n=function(e,t,n){if(e.commonAncestor.isOutside)return null;const o=new nt(t);n&&(o.value=n);const i=document.createDocumentFragment();if(i.appendChild(o.node.get(0)),"inline"===o.type)return ft(e,i),o.render(),e.selectBoxRight(o.node),o;const s=mt(e);return s.left&&(e.setEndAfter(s.left),e.collapseToEnd()),s.right&&s.right.isEmpty&&s.right.remove(),ft(e,i),o.render(),e.selectBoxRight(o.node),s.left&&s.left.isEmpty&&s.left.remove(),o}(this.selection.range,e,t);if(!n)return n;return this.box.getInstances(this).set(n.node.id,n),n}removeBox(){const e=function(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const n=new nt(t);if("block"===n.type){const o=V("<p><br /></p>");return t.before(o),e.shrinkAfter(o),n.unmount(),t.remove(),n}e.setStartBefore(t),e.collapseToStart();const o=t.parent();return n.unmount(),t.remove(),o.isEmpty&&(I(o,V("<br />")),e.shrinkAfter(o)),n}(this.selection.range);if(e){this.box.getInstances(this).delete(e.node.id)}return e}innerWidth(){const e=parseInt(this.container.computedCSS("padding-left"),10)||0,t=parseInt(this.container.computedCSS("padding-right"),10)||0;return this.container.width()-e-t}render(){const e=v(this.config.value),t=new st(e).getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),V(document.body).append(this.popupContainer),this.container.append(t),this.readonly||(this.focus(),this.selection.synByBookmark(),this.history.save()),En.plugin.loadAll(this),En.box.renderAll(this),this.readonly||(window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),this.bindInputEvents(),this.bindHistoryEvents()),document.addEventListener("click",this.clickListener),document.addEventListener("mouseover",this.mouseoverListener),window.addEventListener("resize",this.resizeListener)}unmount(){this.root.empty(),this.popupContainer.remove(),this.readonly||(window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener)),document.removeEventListener("click",this.clickListener),document.removeEventListener("mouseover",this.mouseoverListener),window.removeEventListener("resize",this.resizeListener)}}En.version=dn,En.box=new class{add(e){Ge.set(e.name,e)}remove(e){Ge.delete(e)}getNames(){return Array.from(Ge.keys())}getInstances(e){let t=vn.get(e.container.id);return t||(t=new Map,vn.set(e.container.id,t),t)}rectifyInstances(e){const t=this.getInstances(e);for(const e of t.values())e.node.get(0).isConnected||(e.unmount(),t.delete(e.node.id))}findAll(e){return e.container.find("lake-box")}renderAll(e){this.rectifyInstances(e);const t=this.getInstances(e);this.findAll(e).each((e=>{const n=new L(e);if(t.get(n.id))return;const o=new nt(n);o.render(),t.set(o.node.id,o)}))}},En.plugin=new class{constructor(){this.pluginList=[]}add(e){this.pluginList.push(e)}loadAll(e){this.pluginList.forEach((t=>{t(e)}))}};const Nn=[{icon:a.get("numberedList"),value:"numbered",text:"Numbered list"},{icon:a.get("bulletedList"),value:"bulleted",text:"Bulleted list"},{icon:a.get("checklist"),value:"checklist",text:"Checklist"}],Ln=[{icon:a.get("alignLeft"),value:"left",text:"Align left"},{icon:a.get("alignCenter"),value:"center",text:"Align center"},{icon:a.get("alignRight"),value:"right",text:"Align right"},{icon:a.get("alignJustify"),value:"justify",text:"Align justify"}],Vn=[{icon:a.get("increaseIndent"),value:"increase",text:"Increase indent"},{icon:a.get("decreaseIndent"),value:"decrease",text:"Decrease indent"}],$n=[{icon:a.get("italic"),value:"italic",text:"Italic"},{icon:a.get("underline"),value:"underline",text:"Underline"},{icon:a.get("strikethrough"),value:"strikethrough",text:"Strikethrough"},{icon:a.get("superscript"),value:"superscript",text:"Superscript"},{icon:a.get("subscript"),value:"subscript",text:"Subscript"},{icon:a.get("code"),value:"code",text:"Code"}],Zn=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],In=[{icon:a.get("removeFormat"),value:"",text:"Remove color"}];for(const e of Zn)In.push({value:e.toLowerCase(),text:e.toUpperCase()});const On=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Dn=[{name:"undo",type:"button",icon:a.get("undo"),tooltip:"Undo",onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:a.get("redo"),tooltip:"Redo",onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:a.get("selectAll"),tooltip:"Select all",onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:a.get("paragraph"),tooltip:"Paragraph",isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:a.get("blockQuote"),tooltip:"Block quotation",isSelected:e=>!!e.find((e=>"blockquote"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:a.get("numberedList"),tooltip:"Numbered list",isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:a.get("bulletedList"),tooltip:"Bulleted list",isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:a.get("checklist"),tooltip:"Checklist",isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:a.get("alignLeft"),tooltip:"Align left",isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:a.get("alignCenter"),tooltip:"Align center",isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:a.get("alignRight"),tooltip:"Align right",isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:a.get("alignJustify"),tooltip:"Align justify",isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:a.get("increaseIndent"),tooltip:"Increase indent",onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:a.get("decreaseIndent"),tooltip:"Decrease indent",onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:a.get("bold"),tooltip:"Bold",isDisabled:e=>!!e.find((e=>e.node.isHeading)),isSelected:e=>!!e.find((e=>"strong"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:a.get("italic"),tooltip:"Italic",isSelected:e=>!!e.find((e=>"i"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:a.get("underline"),tooltip:"Underline",isSelected:e=>!!e.find((e=>"u"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:a.get("strikethrough"),tooltip:"Strikethrough",isSelected:e=>!!e.find((e=>"s"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:a.get("superscript"),tooltip:"Superscript",isSelected:e=>!!e.find((e=>"sup"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:a.get("subscript"),tooltip:"Subscript",isSelected:e=>!!e.find((e=>"sub"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:a.get("code"),tooltip:"Inline code",isSelected:e=>!!e.find((e=>"code"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:a.get("removeFormat"),tooltip:"Remove format",onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:a.get("formatPainter"),tooltip:"Format painter",onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:a.get("link"),tooltip:"Link",onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:a.get("hr"),tooltip:"Horizontal line",onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:a.get("codeBlock"),tooltip:"Code block",onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:a.get("down"),defaultValue:"p",tooltip:"Heading",width:"100px",menuType:"list",menuItems:[{value:"h1",text:'<span style="font-weight: bold; font-size: 26px;">Heading 1</span>'},{value:"h2",text:'<span style="font-weight: bold; font-size: 24px;">Heading 2</span>'},{value:"h3",text:'<span style="font-weight: bold; font-size: 22px;">Heading 3</span>'},{value:"h4",text:'<span style="font-weight: bold; font-size: 20px;">Heading 4</span>'},{value:"h5",text:'<span style="font-weight: bold; font-size: 18px;">Heading 5</span>'},{value:"h6",text:'<span style="font-weight: bold; font-size: 16px;">Heading 6</span>'},{value:"p",text:"Paragraph"}],selectedValues:e=>{const t=e.find((e=>e.node.isHeading||"p"===e.name));return t?[t.name]:[]},onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:a.get("down"),icon:a.get("list"),defaultValue:"",tooltip:"List",width:"auto",menuType:"list",menuItems:Nn,selectedValues:e=>{let t="";for(const n of e){if("ol"===n.name){t="numbered";break}if("ul"===n.name&&!n.node.hasAttr("type")){t="bulleted";break}if("ul"===n.name&&"checklist"===n.node.attr("type")){t="checklist";break}}return[t]},onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:a.get("down"),icon:a.get("alignLeft"),defaultValue:"",tooltip:"Alignment",width:"auto",menuType:"list",menuItems:Ln,selectedValues:e=>{let t="";for(const n of e)if(n.node.isBlock){t=n.node.computedCSS("text-align");break}return[t]},onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:a.get("down"),icon:a.get("increaseIndent"),defaultValue:"",tooltip:"Indent",width:"auto",menuType:"list",menuItems:Vn,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:a.get("down"),defaultValue:"Segoe UI",tooltip:"Font family",width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],selectedValues:e=>{for(const t of e)if("span"===t.name){return[t.node.css("font-family").replace(/['"]/g,"")]}return[]},onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:a.get("down"),defaultValue:"16px",tooltip:"Font size",width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],isDisabled:e=>!!e.find((e=>e.node.isHeading)),selectedValues:e=>{for(const t of e)if("span"===t.name){return[t.node.css("font-size").replace(/\.\d+/,"")]}return[]},onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:a.get("more"),defaultValue:"",tooltip:"More style",width:"auto",menuType:"list",menuItems:$n,selectedValues:e=>{var t;const n=[];for(const o of e)if(o.node.isMark){const e=null!==(t=On.get(o.name))&&void 0!==t?t:o.name;n.push(e)}return n},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:a.get("down"),icon:a.get("fontColor"),accentIcon:a.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:"Font color",width:"auto",menuType:"color",menuItems:In,selectedValues:e=>{for(const t of e)if("span"===t.name){return[g(t.node.computedCSS("color"))]}return[]},onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:a.get("down"),icon:a.get("highlight"),accentIcon:a.get("highlightAccent"),defaultValue:"#fadb14",tooltip:"Highlight",width:"auto",menuType:"color",menuItems:In,selectedValues:e=>{for(const t of e)if("span"===t.name){return[g(t.node.computedCSS("background-color"))]}return[]},onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:a.get("image"),tooltip:"Image",accept:"image/*",multiple:!0}];function Rn(e){const{editor:t,file:n,onError:o,onSuccess:i}=e,{imageRequestMethod:s,imageRequestAction:r,imageRequestTypes:a}=t.config;if(a.indexOf(n.type)<0)throw new Error(`Cannot upload file because its type '${n.type}' is not found in ['${a.join("', '")}'].`);const l=t.insertBox("image",{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});if(!l)throw new Error("The image box cannot be inserted outside the editor.");const c=ge({onProgress:e=>{const t=l.node.find(".lake-percent"),n=Math.round(e.percent);t.text(`${n<100?n:99} %`)},onError:(e,t)=>{H(e.toString(),t),l.updateValue("status","error"),l.render(),o&&o()},onSuccess:e=>{if(!e.url)return l.updateValue("status","error"),l.render(),void(o&&o());l.updateValue({status:"done",url:e.url}),l.render(),t.history.save(),i&&i()},file:n,action:r,method:s});return l.setData("xhr",c),l}const zn=["undo","redo","|","heading","fontSize","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],jn=new Map;Dn.forEach((e=>{jn.set(e.name,e)}));function Pn(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}l((o=o.apply(e,t||[])).next())}))}function Fn(e,t){const n=t.getEditor();if(!n)return;const o=t.getContainer(),i=e.closest(".lake-resizer").find(".lake-resizer-info"),s=e.attr("class").indexOf("-right")>=0,r=o.width(),a=o.height()/r;let l=0,c=0;const d=e=>{const t=e.clientX-l,n=Math.round(s?c+t:c-t),r=Math.round(a*n);o.css({width:`${n}px`,height:`${r}px`}),i.text(`${n} x ${r}`)};e.on("pointerdown",(t=>{const n=t;e.get(0).setPointerCapture(n.pointerId),l=n.clientX,c=o.width(),i.show(),e.on("pointermove",d)})),e.on("pointerup",(()=>{e.off("pointermove"),i.hide(),c=t.getContainer().width();const o=Math.round(a*c);t.updateValue({width:c,height:o}),n.history.save()})),e.on("pointercancel",(()=>{e.off("pointermove"),i.hide()}))}function qn(e){return Pn(this,void 0,void 0,(function*(){const t=V("<img />");return t.css({position:"absolute",top:"0",left:"-8888px","z-index":"-1",visibility:"hidden"}),new Promise((n=>{t.on("load",(()=>{const e=t.get(0),o=e.width,i=e.height;t.remove(),t.removeAttr("style"),n({node:t,width:o,height:i})})),t.on("error",(()=>{t.remove(),n({node:t})})),t.attr("src",e),V(document.body).append(t)}))}))}function Un(e,t){return Pn(this,void 0,void 0,(function*(){const n=t.value;t.getContainer().css({width:"",height:""});const o=V(h`
|
|
5
|
+
`;class Qt{constructor(t){if(this.event=new qt,"string"==typeof t){const e=Kt.get(t);if(void 0===e)throw new Error(`Box '${t}' has not been defined yet.`);const i=r(e.type),n=r(e.name);this.node=I(a`<lake-box type="${i}" name="${n}"></lake-box>`),e.value&&(this.value=e.value)}else{this.node=I(t);const e=Kt.get(this.name);if(void 0===e)throw new Error(`Box '${this.name}' has not been defined yet.`);e.value&&!this.node.hasAttr("value")&&(this.value=e.value)}Xt[this.node.id]||(Xt[this.node.id]={}),Jt[this.node.id]||(Jt[this.node.id]={setup:[],cleanup:[]})}addFramework(){let t=this.getContainer();0===t.length?(this.node.html(Yt),t=this.getContainer()):(t.off("mouseenter"),t.off("mouseleave"),t.off("click")),t.on("mouseenter",(()=>{t.hasClass("lake-box-selected")||t.hasClass("lake-box-focused")||t.hasClass("lake-box-activated")||t.addClass("lake-box-hovered")})),t.on("mouseleave",(()=>{t.removeClass("lake-box-hovered")})),t.on("click",(()=>{A(`Box '${this.name}' (id = ${this.node.id}) value:`),A(this.value)}))}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const t=this.node.attr("value");return""===t?{}:JSON.parse(Rt(t))}set value(t){this.node.attr("value",Ft(JSON.stringify(t)))}updateValue(t,e){const i=this.value;"string"==typeof t?i[t]=e:g(t,((t,e)=>{i[t]=e})),this.value=i}getData(t){return Xt[this.node.id][t]}setData(t,e){Xt[this.node.id][t]=e}getEditor(){const t=this.node.closest("div[contenteditable]");return t.length>0?Gt.get(t.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(t){Jt[this.node.id].setup.push(t)}render(){Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[];const t=Kt.get(this.name);if(void 0===t)return;this.addFramework();const e=t.render(this);if(void 0!==e){const t=this.getContainer(),i=t.clone(!1);i.append(e),ct(t,i)}for(const t of Jt[this.node.id].setup){const e=t();void 0!==e&&Jt[this.node.id].cleanup.push(e)}A(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){for(const t of Jt[this.node.id].cleanup)t();Xt[this.node.id]={},Jt[this.node.id].setup=[],Jt[this.node.id].cleanup=[],this.node.empty(),A(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const t=Kt.get(this.name);return void 0===t?"":void 0===t.html?this.node.outerHTML():t.html(this)}}const te={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function ee(){return{h1:Object.assign({},te),h2:Object.assign({},te),h3:Object.assign({},te),h4:Object.assign({},te),h5:Object.assign({},te),h6:Object.assign({},te),p:Object.assign({},te),blockquote:Object.assign(Object.assign({},te),{type:["success","info","warning","error"]}),ul:Object.assign(Object.assign({},te),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},te),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["left","center","right"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w-]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w-]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class ie{constructor(t,e=ee()){this.rules=e,this.source="string"==typeof t?this.parseHTML(t):t}parseHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");return new T(e.querySelector("body"))}static matchRule(t,e){return"string"==typeof t?t===e:Array.isArray(t)?t.indexOf(e)>=0:t instanceof RegExp&&t.test(e)}static getOpenTagString(t,e){let i=t.name,n=e[i];if(!n)return"";"string"==typeof n&&(i=n,n=e[i]);const s=t.get(0);if(!s.hasAttributes())return i;const o=new Map;for(const t of s.attributes)if(n[t.name]&&("style"!==t.name&&ie.matchRule(n[t.name],t.value)&&o.set(t.name,t.value),"style"===t.name)){const e=n.style,i=new Map;g(p(t.value),((t,n)=>{e[t]&&ie.matchRule(e[t],n)&&i.set(t,n)})),o.set("style",i)}let r=i;for(const[t,e]of o)if("style"===t){let t="";for(const[i,n]of e)t+=`${i}: ${n.replace(/"/g,""")}; `;""!==t&&(r+=` style="${t.trim()}"`)}else r+=` ${t}="${e}"`;return r}static getClosedTagString(t,e){let i=t.name;const n=e[i];return n?("string"==typeof n&&(i=n),i):""}static getTrimmedText(t){const e=t.parent(),i=t.prev(),n=t.next();let s=t.text();return(i.isBlock||i.isBlockBox)&&(n.isBlock||n.isBlockBox)||0===i.length&&0===n.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):i.isBlock||i.isBlockBox||0===i.length&&e.isBlock?s=s.replace(/^[\u0020\t\r\n]+/,""):(n.isBlock||n.isBlockBox||0===n.length&&e.isBlock)&&(s=s.replace(/[\u0020\t\r\n]+$/,"")),s}getHTML(){const t=this.rules;let e="";for(const i of function*e(i){let n=i.first();for(;n.length>0;){const i=n.next();if(n.isText)yield r(ie.getTrimmedText(n));else if(n.isVoid){const e=ie.getOpenTagString(n,t);""!==e&&(yield`<${e} />`)}else if(n.isElement){const i=ie.getOpenTagString(n,t),s=ie.getClosedTagString(n,t);""!==i&&(yield`<${i}>`),n.isBox||(yield*e(n)),""!==s&&(yield`</${s}>`)}n=i}}(this.source))e+=i;return e.trim()}getNodeList(){const t=this.getHTML();return this.parseHTML(t).children()}getFragment(){const t=this.getHTML(),e=this.parseHTML(t),i=document.createDocumentFragment();let n=e.first();for(;n.length>0;){const t=n.next();i.appendChild(n.get(0)),n=t}return i}}class ne{constructor(t){this.content=t}getHTML(){let t=this.content;return t=t.replace(/ {2}/g," "),t=r(t.trim()),t=`<p>${t}</p>`,t=t.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),t=t.replace(/\r\n/g,"</p><p>"),t=t.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),t=t.replace(/[\r\n]/g,"</p><p>"),t}getFragment(){return new ie(this.getHTML()).getFragment()}}function se(t,e){if(t.commonAncestor.isOutside)return;const i=(e=I(e)).get(0),n=t.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function oe(t){if(t.commonAncestor.isOutside)return{anchor:new T,focus:new T};const e=t.startNode.closest("lake-box");if(e.length>0)return t.isBoxLeft?e.attr("focus","left"):t.isBoxRight?e.attr("focus","right"):e.attr("focus","center"),{anchor:new T,focus:e};if(t.isCollapsed){const e=t.clone();e.collapseToEnd();const i=I('<lake-bookmark type="focus" />');return se(e,i),{anchor:new T,focus:i}}const i=t.clone();i.collapseToStart();const n=I('<lake-bookmark type="anchor" />');se(i,n);const s=t.clone();s.collapseToEnd();const o=I('<lake-bookmark type="focus" />');return se(s,o),{anchor:n,focus:o}}function re(t,e){const i=t.prev(),n=t.next();if(i.isText&&n.isText){const e=t.parent();D(e),t.remove(),e.get(0).normalize()}else if(0===i.length&&0===n.length){if(t.parent().isMark&&e){const i=new T(document.createTextNode(""));t.before(i),e.setStartAfter(i),e.collapseToStart()}t.remove()}else t.remove()}function ae(t,e){const i=e.anchor,n=e.focus;if(i.length>0&&0===n.length)re(i);else{if(n.length>0&&0===i.length){if(n.isBox){const e=new Qt(n);0===e.getContainer().length&&e.render();const i=n.attr("focus");return"left"===i?t.selectBoxLeft(n):"center"===i?t.selectBox(n):t.selectBoxRight(n),void n.removeAttr("focus")}return t.setStartBefore(n),t.collapseToStart(),void re(n,t)}if(i.length>0&&n.length>0){const e=new E;e.selectNode(i),e.collapseToEnd(),-1===e.compareAfterNode(n)?(t.setStartBefore(n),re(n),t.setEndBefore(i),re(i)):(t.setStartBefore(i),re(i),t.setEndBefore(n),re(n))}}}function le(t){if(t.commonAncestor.isOutside)return;V(t.getBlocks())}function he(t){if(t.isCollapsed)return;if(t.adapt(),t.isInoperative)return;const e=t.startNode.closestBlock(),i=t.endNode.closestBlock(),n=e.get(0)===i.get(0);if(t.get().deleteContents(),t.adaptBlock(),n){const e=t.getBlocks()[0];return void(e&&e.isEmpty&&(P(e,I("<br />")),t.shrinkAfter(e)))}const s=t.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=oe(t);N(o,s),ae(t,r),le(t)}function ce(t,e){if(t.commonAncestor.isOutside)return;t.isCollapsed?t.adaptBox():he(t);Z(t.startNode.closestBlock());const i=oe(t);i.focus.before(e),ae(t,i),t.adaptBlock()}function de(t,e){const i=I(e),n=document.createDocumentFragment();i.each((t=>{n.appendChild(t)})),ce(t,n)}function pe(t,e){if(t.commonAncestor.isOutside)return;if(t.isCollapsed&&t.isBox)return;if("string"!=typeof e){const i=t.getBlocks();for(const t of i)t.css(e);return}const i=I(e),n=i.name,s=i.get(0).attributes,o=t.getBlocks();if(o.length>0){const e=oe(t);for(const t of o)if(t.name===n&&0===i.first().length)for(const e of s)t.attr(e.name,e.value);else{const e=i.clone(!0);t.isList&&""!==t.attr("indent")&&e.attr("indent",t.attr("indent"));const n=O(e);let s=t.first();for(;s.length>0;){const t=s.next();n.append(s),n.name!==s.name&&"li"!==s.name||s.remove(!0),s=t}t.replaceWith(e)}return ae(t,e),void le(t)}const r=oe(t),a=function(t){const e=t.commonAncestor.closest('div[contenteditable="true"],td');let i=[];if(0===e.length)return i;let n=e.first(),s=!0;for(;n.length>0;){if(n.isMark||n.isText||n.isBookmark||n.isInlineBox)i.push(n);else{if(!s)break;i=[]}t.intersectsNode(n)&&(s=!1),n=n.next()}return i}(t),l=H(a,i);ae(t,r),le(t),l.isEmpty&&(P(l,I("<br />")),t.shrinkAfter(l))}function ue(t){if(t.commonAncestor.isOutside)return{left:null,right:null};t.isCollapsed?t.adaptBox():he(t);const e=t.startNode,i=e.closestOperableBlock();if(0===i.length)return{left:null,right:null};let n=i.parent();n.isOutside&&(n=e.closestContainer());const s=M(e,t.startOffset,n);let o=null,r=null;return s&&(o=s.left,r=s.right),!s&&e.isBlock&&(t.startOffset>0&&(o=e.children()[t.startOffset-1]),r=e.children()[t.startOffset],r&&!r.isBlock&&(r=null)),o&&o.isEmpty&&P(o,I("<br />")),r&&(r.isEmpty?(P(r,I("<br />")),t.shrinkAfter(r)):t.shrinkBefore(r)),le(t),{left:o,right:r}}function me(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function fe(t,e,i){let n=null,s=null,o=t.closestBlock();0===o.length&&(o=t.closestContainer());const r=M(t,e,o);return r&&(i?(me(r.left),me(r.right),r.left.isEmpty||(n=r.left),r.right.isEmpty||(s=r.right)):(n=r.left,s=r.right)),{left:n,right:s}}function ge(t,e=!0){if(t.commonAncestor.isOutside)return{left:null,center:null,right:null};if(t.adaptBox(),t.isCollapsed){const i=fe(t.startNode,t.startOffset,e);return i.left?(t.setStartAfter(i.left),t.collapseToStart()):i.right&&(t.setStartBefore(i.right),t.collapseToStart()),{left:i.left,center:null,right:i.right}}const i=fe(t.startNode,t.startOffset,e);i.left?t.setStartAfter(i.left):i.right&&t.setStartBefore(i.right);const n=fe(t.endNode,t.endOffset,e);return n.left?t.setEndAfter(n.left):n.right&&t.setEndBefore(n.right),{left:i.left,center:n.left,right:n.right}}function ve(t,e){const i=t.text();let n=t;for(;n.length>0;){const t=n.parent();if(!t.isMark||i!==t.text()||!n.isText&&n.name===e&&""!==n.attr("style"))break;n=t}return n}function we(t,e){if(t.commonAncestor.isOutside)return;let i=I(e);const n=i.name,s=p(i.attr("style"));if(t.isCollapsed){if(t.isBox){const e=t.startNode.closest("lake-box");if("block"===new Qt(e).type){const i=I("<p><br /></p>");t.isBoxLeft?e.before(i):e.after(i),t.shrinkAfter(i)}else t.adaptBox()}Z(t.startNode.closestBlock());const e=new T(document.createTextNode("")),o=ge(t);if(o.left){const t=function(t){if(!t.isMark)return null;let e=t.clone(),i=t.last();for(;i.length>0;){if(i.isMark){const t=i.clone();e.append(t),e=t}i=i.last()}return e}(o.left);t&&(t.name===n?(t.css(s),i=t):(P(t,e),i.append(t)))}return""===i.text()&&i.append(e),se(t,i),function(t){const e=t.prev();e.length>0&&e.isText&&e.isEmpty&&e.remove();const i=t.next();i.length>0&&i.isText&&i.isEmpty&&i.remove()}(i),void t.shrinkAfter(i)}ge(t);const o=t.getMarks(!0),r=oe(t);for(const t of o)if(!t.isEmpty&&t.isText){const e=ve(t,n);if(e.isMark&&e.name===n)e.css(s);else{const t=i.clone();e.before(t),t.append(e)}}ae(t,r)}function ye(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function xe(t,e){if(t.commonAncestor.isOutside)return;let i;if(e){i=I(e).name}if(t.isCollapsed){if(t.isBox)return;if(i&&0===t.commonAncestor.closest(i).length)return;const e=ge(t,!1);if(!e.left)return;e.right&&ye(e.right);const n=new T(document.createTextNode("")),s=function(t,e){if(!t.isMark||!e)return null;let i=t.clone(),n=t.last();for(;n.length>0;){if(n.isMark&&n.name!==e){const t=n.clone();i.append(t),i=t}n=n.last()}if(i.name===e){if(!(i.first().length>0))return null;i=i.first()}return i}(e.left,i);return s?(P(s,n),e.left.after(s),ye(e.left),void t.shrinkAfter(s)):(e.left.after(n),ye(e.left),n.prev().isText?(t.setStartAfter(n.prev()),t.collapseToStart(),void n.remove()):(t.setStartAfter(n),void t.collapseToStart()))}ge(t);const n=t.getMarks(),s=oe(t);for(const t of n)if(!i||t.name===i){const e=t.parent();t.remove(!t.isEmpty),e.length>0&&e.get(0).normalize()}D(t.commonAncestor),ae(t,s)}function be(t,e){if(t.commonAncestor.isOutside)return null;const i=I(e);if(t.isCollapsed){let e=t.commonAncestor.closest("a");if(0===e.length){e=i.clone(!0);return Z(t.startNode.closestBlock()),se(t,e),e}return""!==i.attr("href")&&e.attr({href:i.attr("href")}),e}ge(t);const n=oe(t);for(const e of t.commonAncestor.getWalker())"a"===e.name&&t.intersectsNode(e)&&e.remove(!0);const s=i.clone(!1);n.anchor.after(s);let o=s.next();for(;o.length>0;){const t=o.next();if(!o.isMark&&!o.isText)break;s.append(o),o=t}return 0===s.first().length&&s.remove(),ae(t,n),s}class ke{constructor(t){this.config=t,this.root=t.root,this.node=I(a`
|
|
6
|
+
<button type="button" name="${t.name}" class="lake-button" />
|
|
7
|
+
`),void 0!==t.tabIndex&&this.node.attr("tabindex",t.tabIndex.toString())}render(){const t=this.config,e=this.node;e.addClass(`lake-${t.text?"text":"icon"}-button`),t.tooltip&&e.attr("title",t.tooltip),t.icon&&e.append(t.icon),t.text&&e.append(`<span>${t.text}</span>`),this.root.append(e),e.on("mouseenter",(()=>{e.attr("disabled")||e.hasClass("lake-button-selected")||e.addClass("lake-button-hovered")})),e.on("mouseleave",(()=>{e.attr("disabled")||e.removeClass("lake-button-hovered")})),e.on("click",(e=>{e.preventDefault(),t.onClick()}))}}class _e{constructor(t){if(this.documentClickListener=t=>{const e=new T(t.target),i=this.node.find(".lake-dropdown-title"),n=this.node.find(".lake-dropdown-menu");e.closest(".lake-dropdown-title").get(0)!==i.get(0)&&(n.hide(),document.removeEventListener("click",this.documentClickListener))},this.config=t,this.root=t.root,this.node=I(a`
|
|
8
|
+
<div class="lake-dropdown lake-${t.menuType}-dropdown" name="${t.name}">
|
|
9
|
+
<button type="button" name="${t.name}" class="lake-dropdown-title">
|
|
10
|
+
<div class="lake-dropdown-${t.icon?"icon":"text"}"></div>
|
|
11
|
+
<div class="lake-dropdown-down-icon"></div>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
`),void 0!==t.tabIndex){this.node.find(".lake-dropdown-title").attr("tabindex",t.tabIndex.toString())}}static getValue(t){const e=t.attr("value");return""===e?[]:JSON.parse(Rt(e))}static setValue(t,e){t.attr("value",Ft(JSON.stringify(e)))}static getMenuMap(t){const e=new Map;for(const i of t){const t=i.text.replace(/<[^>]*>/g,"");e.set(i.value,t)}return e}updateColorAccent(t,e){const i=t.find(".lake-dropdown-icon svg").eq(1),n=i.find("line");n.length>0?n.attr("stroke",e):i.find("path").attr("fill",e)}apppendMenuItems(t){const e=this.config;for(const i of e.menuItems){const o=I(s`
|
|
15
|
+
<li value="${r(i.value)}">
|
|
16
|
+
<div class="lake-dropdown-menu-text">${i.text}</div>
|
|
17
|
+
</li>
|
|
18
|
+
`);if(t.append(o),"color"===e.menuType&&(o.attr("title",i.text),o.find(".lake-dropdown-menu-text").css("background-color",i.value)),i.icon){const t=I('<div class="lake-dropdown-menu-icon"></div>');t.append(i.icon),o.prepend(t)}const a=n.get("check");if(a){const t=I('<div class="lake-dropdown-menu-check"></div>');t.append(a),o.prepend(t)}}}showMenu(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-menu");if(e.attr("disabled"))return;const n=_e.getValue(e);i.find(".lake-dropdown-menu-check").css("visibility","hidden"),i.find("li").each((t=>{const e=I(t);e.on("mouseenter",(()=>{e.hasClass("lake-dropdown-item-selected")||e.addClass("lake-dropdown-item-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-dropdown-item-hovered")})),n.indexOf(e.attr("value"))>=0&&e.find(".lake-dropdown-menu-check").css("visibility","visible")})),i.css("visibility","hidden"),i.show("color"===t.menuType?"flex":"block");e.get(0).getBoundingClientRect().x+i.width()+50>window.innerWidth?(i.css("left","auto"),i.css("right","0")):(i.css("left",""),i.css("right","")),i.css("visibility",""),document.addEventListener("click",this.documentClickListener)}bindEvents(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-title"),n=i.find(".lake-dropdown-text"),s=i.find(".lake-dropdown-icon"),o=i.find(".lake-dropdown-down-icon"),r=e.find(".lake-dropdown-menu");"color"===t.menuType?(s.on("mouseenter",(()=>{e.attr("disabled")||s.addClass("lake-dropdown-icon-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-dropdown-icon-hovered")})),o.on("mouseenter",(()=>{e.attr("disabled")||o.addClass("lake-dropdown-down-icon-hovered")})),o.on("mouseleave",(()=>{o.removeClass("lake-dropdown-down-icon-hovered")}))):(i.on("mouseenter",(()=>{e.attr("disabled")||i.addClass("lake-dropdown-title-hovered")})),i.on("mouseleave",(()=>{i.removeClass("lake-dropdown-title-hovered")}))),"color"===t.menuType&&s.on("click",(i=>{if(i.preventDefault(),e.attr("disabled"))return;const n=e.attr("color")||t.defaultValue;t.onSelect(n)}));("color"===t.menuType&&o?o:i).on("click",(t=>{t.preventDefault(),this.showMenu()})),r.on("click",(s=>{s.preventDefault();const o=I(s.target).closest("li"),a=o.attr("value");_e.setValue(e,[a]),n.length>0&&n.text(o.text()),"color"===t.menuType&&""!==a&&(e.attr("color",a),this.updateColorAccent(i,a)),t.onSelect(a),r.hide(),document.removeEventListener("click",this.documentClickListener)}))}render(){var t;const e=this.config,i=this.node,n=i.find(".lake-dropdown-title");e.downIcon||n.addClass("lake-dropdown-title-no-down"),n.css("width",e.width),n.attr("title",e.tooltip);const s=n.find(".lake-dropdown-text"),o=n.find(".lake-dropdown-icon");e.icon&&o.append(e.icon),e.accentIcon&&o.append(e.accentIcon);const r=n.find(".lake-dropdown-down-icon");e.downIcon&&r.append(e.downIcon);const a=I('<ul class="lake-dropdown-menu" />');if(a.addClass(`lake-${e.menuType}-dropdown-menu`),_e.setValue(i,[e.defaultValue]),s.length>0){const i=_e.getMenuMap(e.menuItems);s.text(null!==(t=i.get(e.defaultValue))&&void 0!==t?t:e.defaultValue)}"color"===e.menuType&&this.updateColorAccent(n,e.defaultValue),this.apppendMenuItems(a),i.append(n),i.append(a),this.root.append(i),this.bindEvents()}unmount(){this.node.remove(),document.removeEventListener("click",this.documentClickListener)}}var Se=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Ce="object"==typeof Wt&&Wt&&Wt.Object===Object&&Wt,Ae="object"==typeof self&&self&&self.Object===Object&&self,Be=Ce||Ae||Function("return this")(),Le=Be,Te=function(){return Le.Date.now()},Ie=/\s/;var Ee=function(t){for(var e=t.length;e--&&Ie.test(t.charAt(e)););return e},Me=Ee,Pe=/^\s+/;var Ze=function(t){return t?t.slice(0,Me(t)+1).replace(Pe,""):t},ze=Be.Symbol,Ne=ze,Oe=Object.prototype,He=Oe.hasOwnProperty,De=Oe.toString,$e=Ne?Ne.toStringTag:void 0;var Ve=function(t){var e=He.call(t,$e),i=t[$e];try{t[$e]=void 0;var n=!0}catch(t){}var s=De.call(t);return n&&(e?t[$e]=i:delete t[$e]),s},Fe=Object.prototype.toString;var Re=Ve,We=function(t){return Fe.call(t)},je=ze?ze.toStringTag:void 0;var Ue=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":je&&je in Object(t)?Re(t):We(t)},qe=function(t){return null!=t&&"object"==typeof t};var Ke=Ze,Ge=Se,Xe=function(t){return"symbol"==typeof t||qe(t)&&"[object Symbol]"==Ue(t)},Je=/^[-+]0x[0-9a-f]+$/i,Ye=/^0b[01]+$/i,Qe=/^0o[0-7]+$/i,ti=parseInt;var ei=Se,ii=Te,ni=function(t){if("number"==typeof t)return t;if(Xe(t))return NaN;if(Ge(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ge(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ke(t);var i=Ye.test(t);return i||Qe.test(t)?ti(t.slice(2),i?2:8):Je.test(t)?NaN:+t},si=Math.max,oi=Math.min;var ri=function(t,e,i){var n,s,o,r,a,l,h=0,c=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function u(e){var i=n,o=s;return n=s=void 0,h=e,r=t.apply(o,i)}function m(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=o}function f(){var t=ii();if(m(t))return g(t);a=setTimeout(f,function(t){var i=e-(t-l);return d?oi(i,o-(t-h)):i}(t))}function g(t){return a=void 0,p&&n?u(t):(n=s=void 0,r)}function v(){var t=ii(),i=m(t);if(n=arguments,s=this,l=t,i){if(void 0===a)return function(t){return h=t,a=setTimeout(f,e),c?u(t):r}(l);if(d)return clearTimeout(a),a=setTimeout(f,e),u(l)}return void 0===a&&(a=setTimeout(f,e)),r}return e=ni(e)||0,ei(i)&&(c=!!i.leading,o=(d="maxWait"in i)?si(ni(i.maxWait)||0,e):o,p="trailing"in i?!!i.trailing:p),v.cancel=function(){void 0!==a&&clearTimeout(a),h=0,n=l=s=a=void 0},v.flush=function(){return void 0===a?r:g(ii())},v},ai=jt(ri);function li(t){const e=t.get(0),i={};if(e.hasAttributes())for(const t of e.attributes)i[t.name]=t.value;return i}class hi{constructor(t){const e=window.getSelection();if(!e)throw new Error("Selection object is null.");this.selection=e,this.container=t,this.range=this.getRangeFromNativeSelection()}getRangeFromNativeSelection(){if(this.selection.rangeCount>0){const t=this.selection.getRangeAt(0);return new E(t)}return new E}addRangeToNativeSelection(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}syncByRange(){const t=this.getRangeFromNativeSelection();this.range.get()!==t.get()&&(this.range=t)}synByBookmark(){const t=this.range,e=this.container,i=e.find("lake-box[focus]");if(i.length>0)return ae(t,{anchor:new T,focus:i}),void this.addRangeToNativeSelection();ae(t,{anchor:e.find('lake-bookmark[type="anchor"]'),focus:e.find('lake-bookmark[type="focus"]')}),this.addRangeToNativeSelection()}getAppliedItems(){const t=[];return function(t,e){let i=e.startNode;for(i.isText&&(i=i.parent());i.length>0&&i.isInside;)t.push({node:i,name:i.name,attributes:li(i),styles:p(i.attr("style"))}),i=i.parent()}(t,this.range),function(t,e){const i=e.startNode;let n;if(i.isText&&i.text().length===e.startOffset){const t=i.next();t.length>0&&t.isElement&&(n=t)}if(i.isElement){const t=i.children();if(t.length>0){const i=t[e.startOffset];i&&i.isElement&&(n=i)}}if(n){let e=n;for(;e.length>0;)e.isElement&&t.push({node:e,name:e.name,attributes:li(e),styles:p(e.attr("style"))}),e=e.first()}}(t,this.range),t}insertBookmark(){return oe(this.range)}toBookmark(t){return ae(this.range,t)}insertNode(t){return se(this.range,t)}insertFragment(t){return ce(this.range,t)}insertContents(t){return de(this.range,t)}deleteContents(){return he(this.range)}setBlocks(t){return pe(this.range,t)}splitBlock(){return ue(this.range)}splitMarks(t){return ge(this.range,t)}addMark(t){return we(this.range,t)}removeMark(t){return xe(this.range,t)}fixList(){return le(this.range)}insertLink(t){return be(this.range,t)}}class ci{constructor(t){this.commandMap=new Map,this.event=new qt,this.selection=t}add(t,e){this.commandMap.set(t,e)}getNames(){return Array.from(this.commandMap.keys())}getItem(t){const e=this.commandMap.get(t);if(void 0===e)throw new Error(`Command '${t}' does not exist.`);return e}isDisabled(t){const e=this.getItem(t);if(!e.isDisabled)return!1;const i=this.selection.getAppliedItems();return e.isDisabled(i)}isSelected(t){const e=this.getItem(t);if(!e.isSelected)return!1;const i=this.selection.getAppliedItems();return e.isSelected(i)}selectedValues(t){const e=this.getItem(t);if(!e.selectedValues)return[];const i=this.selection.getAppliedItems();return e.selectedValues(i)}execute(t,...e){const i=this.getItem(t);this.event.emit("beforeexecute",t),i.execute.apply(this,e),this.event.emit("execute",t),A(`Command '${t}' executed`)}}var di,pi={exports:{}};di=pi,function(t){function e(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function i(t,i,n,s,o,r){return e((a=e(e(i,t),e(s,r)))<<(l=o)|a>>>32-l,n);var a,l}function n(t,e,n,s,o,r,a){return i(e&n|~e&s,t,e,o,r,a)}function s(t,e,n,s,o,r,a){return i(e&s|n&~s,t,e,o,r,a)}function o(t,e,n,s,o,r,a){return i(e^n^s,t,e,o,r,a)}function r(t,e,n,s,o,r,a){return i(n^(e|~s),t,e,o,r,a)}function a(t,i){var a,l,h,c,d;t[i>>5]|=128<<i%32,t[14+(i+64>>>9<<4)]=i;var p=1732584193,u=-271733879,m=-1732584194,f=271733878;for(a=0;a<t.length;a+=16)l=p,h=u,c=m,d=f,p=n(p,u,m,f,t[a],7,-680876936),f=n(f,p,u,m,t[a+1],12,-389564586),m=n(m,f,p,u,t[a+2],17,606105819),u=n(u,m,f,p,t[a+3],22,-1044525330),p=n(p,u,m,f,t[a+4],7,-176418897),f=n(f,p,u,m,t[a+5],12,1200080426),m=n(m,f,p,u,t[a+6],17,-1473231341),u=n(u,m,f,p,t[a+7],22,-45705983),p=n(p,u,m,f,t[a+8],7,1770035416),f=n(f,p,u,m,t[a+9],12,-1958414417),m=n(m,f,p,u,t[a+10],17,-42063),u=n(u,m,f,p,t[a+11],22,-1990404162),p=n(p,u,m,f,t[a+12],7,1804603682),f=n(f,p,u,m,t[a+13],12,-40341101),m=n(m,f,p,u,t[a+14],17,-1502002290),p=s(p,u=n(u,m,f,p,t[a+15],22,1236535329),m,f,t[a+1],5,-165796510),f=s(f,p,u,m,t[a+6],9,-1069501632),m=s(m,f,p,u,t[a+11],14,643717713),u=s(u,m,f,p,t[a],20,-373897302),p=s(p,u,m,f,t[a+5],5,-701558691),f=s(f,p,u,m,t[a+10],9,38016083),m=s(m,f,p,u,t[a+15],14,-660478335),u=s(u,m,f,p,t[a+4],20,-405537848),p=s(p,u,m,f,t[a+9],5,568446438),f=s(f,p,u,m,t[a+14],9,-1019803690),m=s(m,f,p,u,t[a+3],14,-187363961),u=s(u,m,f,p,t[a+8],20,1163531501),p=s(p,u,m,f,t[a+13],5,-1444681467),f=s(f,p,u,m,t[a+2],9,-51403784),m=s(m,f,p,u,t[a+7],14,1735328473),p=o(p,u=s(u,m,f,p,t[a+12],20,-1926607734),m,f,t[a+5],4,-378558),f=o(f,p,u,m,t[a+8],11,-2022574463),m=o(m,f,p,u,t[a+11],16,1839030562),u=o(u,m,f,p,t[a+14],23,-35309556),p=o(p,u,m,f,t[a+1],4,-1530992060),f=o(f,p,u,m,t[a+4],11,1272893353),m=o(m,f,p,u,t[a+7],16,-155497632),u=o(u,m,f,p,t[a+10],23,-1094730640),p=o(p,u,m,f,t[a+13],4,681279174),f=o(f,p,u,m,t[a],11,-358537222),m=o(m,f,p,u,t[a+3],16,-722521979),u=o(u,m,f,p,t[a+6],23,76029189),p=o(p,u,m,f,t[a+9],4,-640364487),f=o(f,p,u,m,t[a+12],11,-421815835),m=o(m,f,p,u,t[a+15],16,530742520),p=r(p,u=o(u,m,f,p,t[a+2],23,-995338651),m,f,t[a],6,-198630844),f=r(f,p,u,m,t[a+7],10,1126891415),m=r(m,f,p,u,t[a+14],15,-1416354905),u=r(u,m,f,p,t[a+5],21,-57434055),p=r(p,u,m,f,t[a+12],6,1700485571),f=r(f,p,u,m,t[a+3],10,-1894986606),m=r(m,f,p,u,t[a+10],15,-1051523),u=r(u,m,f,p,t[a+1],21,-2054922799),p=r(p,u,m,f,t[a+8],6,1873313359),f=r(f,p,u,m,t[a+15],10,-30611744),m=r(m,f,p,u,t[a+6],15,-1560198380),u=r(u,m,f,p,t[a+13],21,1309151649),p=r(p,u,m,f,t[a+4],6,-145523070),f=r(f,p,u,m,t[a+11],10,-1120210379),m=r(m,f,p,u,t[a+2],15,718787259),u=r(u,m,f,p,t[a+9],21,-343485551),p=e(p,l),u=e(u,h),m=e(m,c),f=e(f,d);return[p,u,m,f]}function l(t){var e,i="",n=32*t.length;for(e=0;e<n;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function h(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var n=8*t.length;for(e=0;e<n;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function c(t){var e,i,n="0123456789abcdef",s="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),s+=n.charAt(e>>>4&15)+n.charAt(15&e);return s}function d(t){return unescape(encodeURIComponent(t))}function p(t){return function(t){return l(a(h(t),8*t.length))}(d(t))}function u(t,e){return function(t,e){var i,n,s=h(t),o=[],r=[];for(o[15]=r[15]=void 0,s.length>16&&(s=a(s,8*t.length)),i=0;i<16;i+=1)o[i]=909522486^s[i],r[i]=1549556828^s[i];return n=a(o.concat(h(e)),512+8*e.length),l(a(r.concat(n),640))}(d(t),d(e))}function m(t,e,i){return e?i?u(e,t):c(u(e,t)):i?p(t):c(p(t))}di.exports?di.exports=m:t.md5=m}(Wt);var ui=jt(pi.exports);const mi=new Map;class fi{constructor(t){this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new qt,this.selection=t,this.container=t.container}removeBookmark(t){return t.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(t){return new ie(t).getHTML()}addIdToBoxes(t){t.find("lake-box").each((t=>{const e=new T(t),i=ui(`${e.attr("type")}-${e.attr("name")}-${e.attr("value")}`);e.attr("id",i)}))}removeIdfromBoxes(t){t.find("lake-box").each((t=>{new T(t).removeAttr("id")}))}morphContainer(t){const e=this.container,i={beforeChildrenUpdated:t=>{if("lake-box"===new T(t).name)return!1},afterAttributeUpdated:(t,i)=>{const n=new T(i);if("value"===t&&"lake-box"===n.name){const t=mi.get(e.id);if(!t)return;t.delete(n.id)}}},n=t.clone(!0);this.addIdToBoxes(e),this.addIdToBoxes(n),ct(e,n,{callbacks:i}),this.removeIdfromBoxes(e),this.removeIdfromBoxes(n)}cloneContainer(){const t=this.selection.range,e=this.container.clone(!0);if(e.find("lake-box").each((t=>{new Qt(t).getContainer().empty()})),t.commonAncestor.isOutside)return e;if(t.isInsideBox)return e;const i=t.startNode.path(),n=t.endNode.path(),s=e.find(i),o=e.find(n),r=t.clone();return r.setStart(s,t.startOffset),r.setEnd(o,t.endOffset),oe(r),e}get count(){return this.list.length}get canUndo(){return this.index>1&&!!this.list[this.index-1]}get canRedo(){return!!this.list[this.index]}undo(){if(!this.list[this.index-1])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index>0;){const e=this.list[this.index-1];if(!e)break;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("undo",i);break}if(1===this.index)break;this.index--}this.selection.synByBookmark(),A(`History undone, the last index is ${this.index}`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const t=this.getValue(this.container);for(;this.index<this.list.length;){const e=this.list[this.index];if(!e)break;this.index++;const i=this.getValue(e);if(this.removeBookmark(i)!==this.removeBookmark(t)){this.morphContainer(e),this.event.emit("redo",i);break}}this.selection.synByBookmark(),A(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(){if(!this.canSave)return;const t=this.cloneContainer(),e=this.getValue(t);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(e)||(this.list.splice(this.index,1/0,t),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),this.event.emit("save",e),A(`History saved, the last index is ${this.index}`))}}var gi=["Shift","Meta","Alt","Control"],vi="object"==typeof navigator?navigator.platform:"",wi=/Mac|iPod|iPhone|iPad/.test(vi),yi=wi?"Meta":"Control",xi="Win32"===vi?["Control","Alt"]:wi?["Alt"]:[];function bi(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||xi.includes(e)&&t.getModifierState("AltGraph"))}function ki(t){return t.trim().split(" ").map((function(t){var e=t.split(/\b\+/),i=e.pop();return[e=e.map((function(t){return"$mod"===t?yi:t})),i]}))}function _i(t,e){var i;void 0===e&&(e={});var n=null!=(i=e.timeout)?i:1e3,s=Object.keys(t).map((function(e){return[ki(e),t[e]]})),o=new Map,r=null;return function(t){t instanceof KeyboardEvent&&(s.forEach((function(e){var i=e[0],n=e[1],s=o.get(i)||i;!function(t,e){return!(e[1].toUpperCase()!==t.key.toUpperCase()&&e[1]!==t.code||e[0].find((function(e){return!bi(t,e)}))||gi.find((function(i){return!e[0].includes(i)&&e[1]!==i&&bi(t,i)})))}(t,s[0])?bi(t,t.key)||o.delete(i):s.length>1?o.set(i,s.slice(1)):(o.delete(i),n(t))})),r&&clearTimeout(r),r=setTimeout(o.clear.bind(o),n))}}const Si=new Map([["#","shift+#"]]);class Ci{constructor(t){this.keydownEventList=[],this.keyupEventList=[],this.container=t}normalizeType(t){var e;return t=(t=null!==(e=Si.get(t))&&void 0!==e?e:t).replace(/(^|\+|\s)mod(\+|\s|$)/g,"$1$mod$2").replace(/shift|control|alt|meta|enter|tab|backspace|delete|space|escape|arrow-left|arrow-right|arrow-up|arrow-down/,(t=>t.charAt(0).toUpperCase()+l(t.substring(1)))).replace(/(^|\+|\s)([a-z])(\+|\s|$)/g,((t,e,i,n)=>`${e}Key${i.toUpperCase()}${n}`))}setKeydown(t,e){t=this.normalizeType(t);const i=_i({[t]:t=>e(t)});this.keydownEventList.push({type:t,listener:e}),this.container.on("keydown",i)}setKeyup(t,e){t=this.normalizeType(t);const i=_i({[t]:t=>e(t)});this.keyupEventList.push({type:t,listener:e}),this.container.on("keyup",i)}keydown(t){t=this.normalizeType(t);for(const e of this.keydownEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}keyup(t){t=this.normalizeType(t);for(const e of this.keyupEventList)if(e.type===t&&!1===e.listener(new Event(t)))break}}const Ai={value:"<p><br /><focus /></p>",readonly:!1,spellcheck:!1,tabIndex:0,indentWithTab:!0,minChangeSize:5,imageRequestMethod:"POST",imageRequestAction:"/upload",imageRequestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]};class Bi{constructor(t){if(this.unsavedInputData="",this.isComposing=!1,this.event=new qt,this.box=Bi.box,this.beforeunloadListener=()=>{this.commitUnsavedInputData()},this.selectionchangeListener=()=>{this.selection.syncByRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=t=>{const e=new T(t.target);e.closest(".lake-popup").length>0||this.event.emit("click",e)},this.resizeListener=()=>{this.event.emit("resize")},this.updateBoxSelectionStyle=ai((()=>{if(0===this.root.first().length)return;const t=this.selection.range,e=t.clone();e.adaptBox(),this.box.findAll(this).each((i=>{const n=new Qt(i),s=n.getContainer();if(0!==s.length){if(t.compareBeforeNode(s)<0&&t.compareAfterNode(s)>0&&(!t.isCollapsed||t.startNode.get(0)!==s.get(0)||0!==t.startOffset))return s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),void s.addClass("lake-box-activated");if(e.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(t.isCollapsed?(s.removeClass("lake-box-selected"),s.addClass("lake-box-focused")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected")}})),this.event.emit("boxselectionstylechange")}),50,{leading:!1,trailing:!0,maxWait:50}),this.emitStateChangeEvent=ai((()=>{const t=this.command.getNames();let e=this.selection.getAppliedItems();e.length>0&&e[0].node.closestContainer().get(0)!==this.container.get(0)&&(e=[]);const i=new Map,n=new Map,s=new Map;if(e.length>0)for(const o of t){const t=this.command.getItem(o);if(t.isDisabled&&t.isDisabled(e)&&i.set(o,!0),t.isSelected&&t.isSelected(e)&&n.set(o,!0),t.selectedValues){const i=t.selectedValues(e);i.length>0&&s.set(o,i)}}this.event.emit("statechange",{appliedItems:e,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s})}),100,{leading:!1,trailing:!0,maxWait:100}),this.emitChangeEvent=t=>{this.rectifyContent(),this.emitStateChangeEvent(),this.event.emit("change",t)},!t.root)throw new Error("The root of the config must be specified.");this.root=I(t.root),this.config=Object.assign(Object.assign({},Ai),t),this.containerWrapper=I('<div class="lake-container-wrapper" />'),this.container=I('<div class="lake-container" />'),this.overlayContainer=I('<div class="lake-overlay" />'),this.popupContainer=I('<div class="lake-popup lake-custom-properties" />'),this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false",tabindex:this.config.tabIndex.toString()}),this.selection=new hi(this.container),this.command=new ci(this.selection),this.history=new fi(this.selection),this.keystroke=new Ci(this.container),Gt.set(this.container.id,this)}inputInBoxStrip(){const t=this.selection,e=t.range,i=e.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===new Qt(n).type)e.isBoxLeft?(e.setStartBefore(n),e.collapseToStart()):(e.setStartAfter(n),e.collapseToStart());else{const t=I("<p />");e.isBoxLeft?n.before(t):n.after(t),e.shrinkAfter(t)}const s=i.text();i.html("<br />"),t.insertNode(document.createTextNode(s))}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0})),this.container.on("compositionend",(()=>{this.isComposing=!1})),this.container.on("beforeinput",(()=>{const t=this.selection.range;(t.isBoxLeft||t.isBoxRight)&&this.commitUnsavedInputData()})),this.container.on("input",(t=>{const e=t;window.setTimeout((()=>{var t;const i=this.selection.range;if(!i.isInsideBox)if(this.isComposing)this.event.emit("input",e);else{if("insertText"===e.inputType||"insertCompositionText"===e.inputType)if(i.isBoxLeft||i.isBoxRight)this.inputInBoxStrip();else if(this.unsavedInputData+=null!==(t=e.data)&&void 0!==t?t:"",this.unsavedInputData.length<this.config.minChangeSize)return void this.event.emit("input",e);this.history.save(),this.unsavedInputData="",this.event.emit("input",e)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("redo",(t=>{this.box.renderAll(this),this.emitChangeEvent(t)})),this.history.event.on("save",(t=>{this.box.rectifyInstances(this),this.emitChangeEvent(t)}))}bindFocusEvents(){this.container.on("focus",(()=>{this.root.addClass("lake-root-focused")})),this.container.on("blur",(()=>{this.root.removeClass("lake-root-focused")}))}rectifyContent(){let t=this.container.children();for(const e of t)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),A("Rectifying content: empty tag was removed"));if(t=this.container.children(),0===t.length)return this.container.html("<p><br /></p>"),this.selection.range.shrinkAfter(this.container),void A("Rectifying content: default paragraph was added");if(1===t.length){const e=t[0];if(e.isVoid){const t=I("<p />");e.before(t),t.append(e),this.selection.range.shrinkAfter(t),A("Rectifying content: void element was wrapped in paragraph")}}}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}focus(){this.container.focus()}blur(){this.container.blur()}setValue(t){t=u(t);const e=new ie(t).getFragment();this.container.empty(),this.container.append(e),Bi.box.renderAll(this),this.selection.synByBookmark()}getValue(){const t=this.selection.insertBookmark();let e=new ie(this.container).getHTML();return e=m(e),this.selection.toBookmark(t),e}insertBox(t,e){const i=function(t,e,i){if(t.commonAncestor.isOutside)return null;const n=new Qt(e);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return ce(t,s),n.render(),t.selectBoxRight(n.node),n;const o=ue(t);return o.left&&(t.setEndAfter(o.left),t.collapseToEnd()),o.right&&o.right.isEmpty&&o.right.remove(),ce(t,s),n.render(),t.selectBoxRight(n.node),o.left&&o.left.isEmpty&&o.left.remove(),n}(this.selection.range,t,e);if(!i)throw new Error(`Box '${t}' cannot be inserted outside the editor.`);return this.box.getInstances(this).set(i.node.id,i),i}removeBox(){const t=function(t){if(t.commonAncestor.isOutside)return null;const e=t.commonAncestor.closest("lake-box");if(0===e.length)return null;const i=new Qt(e);if("block"===i.type){const n=I("<p><br /></p>");return e.before(n),t.shrinkAfter(n),i.unmount(),e.remove(),i}t.setStartBefore(e),t.collapseToStart();const n=e.parent();return i.unmount(),e.remove(),n.isEmpty&&(P(n,I("<br />")),t.shrinkAfter(n)),i}(this.selection.range);if(t){this.box.getInstances(this).delete(t.node.id)}return t}render(){const t=u(this.config.value),e=new ie(t).getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),I(document.body).append(this.popupContainer),this.container.append(e),this.readonly||(this.bindFocusEvents(),this.focus(),this.selection.synByBookmark(),this.history.save(),Bi.plugin.loadAll(this)),Bi.box.renderAll(this),this.readonly||(window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),this.bindInputEvents(),this.bindHistoryEvents()),document.addEventListener("click",this.clickListener),window.addEventListener("resize",this.resizeListener)}unmount(){this.root.empty(),this.popupContainer.remove(),this.readonly||(window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener)),document.removeEventListener("click",this.clickListener),window.removeEventListener("resize",this.resizeListener)}}Bi.version="0.0.2",Bi.box=new class{add(t){Kt.set(t.name,t)}remove(t){Kt.delete(t)}getNames(){return Array.from(Kt.keys())}getInstances(t){let e=mi.get(t.container.id);return e||(e=new Map,mi.set(t.container.id,e),e)}rectifyInstances(t){const e=this.getInstances(t);for(const t of e.values())t.node.get(0).isConnected||(t.unmount(),e.delete(t.node.id))}findAll(t){return t.container.find("lake-box")}renderAll(t){this.rectifyInstances(t);const e=this.getInstances(t);this.findAll(t).each((t=>{const i=new T(t);if(e.get(i.id))return;const n=new Qt(i);n.render(),e.set(n.node.id,n)}))}},Bi.plugin=new class{constructor(){this.pluginList=[]}add(t){this.pluginList.push(t)}loadAll(t){this.pluginList.forEach((e=>{e(t)}))}};const Li=/^\{.*\}$/,Ti=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Ii=t=>t.substring(1,t.length-1),Ei=(t,e=!0,i="",n="")=>t.split(Ti).map((t=>{if(!t.match(Ti))return t;const e=Ii(t);if(e.startsWith("{"))return((t,e)=>{let[i,n]=t.split(":");n||(n=i,i=e);const s=n.split("|"),[o,r,a,l,h,c]=s,d=s.filter((t=>void 0!==t)).length;return 1===d?{k:i,r:o}:2===d?{k:i,o:o,r:r}:3===d?{k:i,z:o,o:r,r:a}:{k:i,z:o,o:r,t:a,f:l,m:h,r:c}})(Ii(e),n);const s=(t=>{const[e="",...i]=t.split("|"),[n="",s]=e.split(":"),[o,r]=n.split("?");return{k:o,i:s,n:""===r,f:i}})(e);return n=s.k||n,!i&&(i=n),s})).map((t=>{if("string"==typeof t)return t;t.k||(t.k=i||"0");const n=(t=>Object.fromEntries(Object.keys(t).map((e=>{const i=t[e];return[e,Array.isArray(i)?i.map((t=>null==t?void 0:t.trim())):i===!!i?i:null==i?void 0:i.trim()]}))))(t);return e?(s=n,Object.fromEntries(Object.entries(s).map((([t,e])=>"i"!==t&&e&&"0"!=e&&[t,e])).filter(Boolean))):n;var s})),Mi=(t,e,i)=>e.reduce(((e,i)=>{var n,s,o;return null!==(s=i.match(Li)?(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:t["*"]})((o=i,Object.fromEntries(Ii(o).split(",").map((t=>t.split(":"))).reduce(((t,e)=>2===e.length?[...t,e.map((t=>t.trim()))]:(t[t.length-1][1]+=","+e[0],t)),[])))):null===(n=t[i])||void 0===n?void 0:n.call(t,e))&&void 0!==s?s:e}),i),Pi=/\?\?/g,Zi=(t,e,i,n)=>{const s=n[0],o=s&&"object"==typeof s&&s.constructor===Object;return((t,e,i,n)=>t.map((t=>{if("string"==typeof t)return t;const{k:s="0",f:o=[]}=t,r=n[s];if((t=>!(!t.o&&!t.r))(t))return(("boolean"==typeof r?r?t.o:t.r:((t,{z:e,o:i,t:n,f:s,m:o,r:r},a)=>{switch(e&&0==a?"zero":t.select(a)){case"zero":return e;case"one":return i;case"two":return n;case"few":return null!=s?s:r;case"many":return null!=o?o:r;default:return r}})(e,t,r))||"").replace(Pi,r);const a=o.length?Mi(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(t,e,i,1===n.length&&o?s:n)},zi=(t,e)=>{const i={},n=new Intl.PluralRules(t);return(t,...s)=>Zi(((t,e)=>t[e]||(t[e]=Ei(e)))(i,t),n,e,s)};const Ni=(t={},e)=>"string"==typeof t?e.bind(null,t):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),t),Oi=(t,e)=>new Proxy(Ni(t,e),{get:(t,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(t).map((t=>Ni(t,e)))):Oi(t[i],e)});const Hi={"en-US":{toolbar:{undo:`Undo (${f("mod+Z")})`,redo:`Redo (${f("mod+Y")})`,selectAll:`Select all (${f("mod+A")})`,paragraph:"Paragraph",blockQuote:"Block quotation",numberedList:"Numbered list",bulletedList:"Bulleted list",checklist:"Checklist",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Align justify",increaseIndent:"Increase indent",decreaseIndent:"Decrease indent",bold:`Bold (${f("mod+B")})`,italic:`Italic (${f("mod+I")})`,underline:`Underline (${f("mod+U")})`,strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",code:"Inline code",removeFormat:"Remove format",formatPainter:"Format painter",link:"Link",hr:"Horizontal line",codeBlock:"Code block",heading:"Heading",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",list:"List",align:"Alignment",indent:"Indent",fontFamily:"Font family",fontSize:"Font size",moreStyle:"More style",fontColor:"Font color",highlight:"Highlight",image:"Image",removeColor:"Remove color"},link:{newLink:"New link",url:"Link URL",title:"Link title",copy:"Copy link to clipboard",open:"Open link in new tab",save:"Save",unlink:"Remove link"},image:{view:"Full screen",remove:"Delete",previous:"Previous",next:"Next",close:"Close (Esc)",loadingError:"The image cannot be loaded",zoomOut:"Zoom out",zoomIn:"Zoom in"},codeBlock:{langType:"Select language"}},"zh-CN":{toolbar:{undo:`撤消 (${f("mod+Z")})`,redo:`重做 (${f("mod+Y")})`,selectAll:`全选 (${f("mod+A")})`,paragraph:"正文",blockQuote:"引用",numberedList:"编号",bulletedList:"项目符号",checklist:"任务列表",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignJustify:"两端对齐",increaseIndent:"增加缩进",decreaseIndent:"减少缩进",bold:`粗体 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下划线 (${f("mod+U")})`,strikethrough:"删除线",superscript:"上标",subscript:"下标",code:"行内代码",removeFormat:"清除格式",formatPainter:"格式刷",link:"链接",hr:"分割线",codeBlock:"代码块",heading:"标题",heading1:"标题 1",heading2:"标题 2",heading3:"标题 3",heading4:"标题 4",heading5:"标题 5",heading6:"标题 6",list:"列表",align:"对齐方式",indent:"缩进",fontFamily:"字体",fontSize:"文字大小",moreStyle:"更多样式",fontColor:"文字颜色",highlight:"文字背景",image:"图片",removeColor:"默认"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},codeBlock:{langType:"选择代码语言"}},ja:{toolbar:{undo:`元に戻す (${f("mod+Z")})`,redo:`やり直し (${f("mod+Y")})`,selectAll:`すべて選択 (${f("mod+A")})`,paragraph:"テキスト",blockQuote:"ブロック引用",numberedList:"番号付きリスト",bulletedList:"箇条書きリスト",checklist:"タスクリスト",alignLeft:"左揃え",alignCenter:"中心揃え",alignRight:"右揃え",alignJustify:"左右に並べ替え",increaseIndent:"インデントを増やす",decreaseIndent:"インデントを減らす",bold:`太字 (${f("mod+B")})`,italic:`斜体 (${f("mod+I")})`,underline:`下線 (${f("mod+U")})`,strikethrough:"取り消し線",superscript:"上付き文字",subscript:"下付き文字",code:"インラインコード",removeFormat:"形式を削除",formatPainter:"形式ペインタ",link:"リンク",hr:"区切り線",codeBlock:"コードブロック",heading:"タイトル",heading1:"タイトル 1",heading2:"タイトル 2",heading3:"タイトル 3",heading4:"タイトル 4",heading5:"タイトル 5",heading6:"タイトル 6",list:"リスト",align:"文字揃え",indent:"インデント",fontFamily:"フォント",fontSize:"文字サイズ",moreStyle:"その他のスタイル",fontColor:"文字色",highlight:"文字の背景",image:"画像",removeColor:"デフォルト"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},codeBlock:{langType:"コード言語を選択"}},ko:{toolbar:{undo:`작업취소 (${f("mod+Z")})`,redo:`작업재개 (${f("mod+Y")})`,selectAll:`전체 선택 (${f("mod+A")})`,paragraph:"텍스트",blockQuote:"인용문",numberedList:"순서 목록",bulletedList:"비순서 목록",checklist:"체크리스트",alignLeft:"왼쪽 정렬",alignCenter:"가운데 정렬",alignRight:"오른쪽 정렬",alignJustify:"좌우로 정렬",increaseIndent:"들여쓰기 증가",decreaseIndent:"들여쓰기 줄이기",bold:`굵게 (${f("mod+B")})`,italic:`기울임꼴 (${f("mod+I")})`,underline:`밑줄 (${f("mod+U")})`,strikethrough:"취소선",superscript:"위첨자",subscript:"아래 첨자",code:"인라인 코드",removeFormat:"형식 지우기",formatPainter:"형식 페인터",link:"링크",hr:"구분선",codeBlock:"코드 블록",heading:"제목",heading1:"제목 1",heading2:"제목 2",heading3:"제목 3",heading4:"제목 4",heading5:"제목 5",heading6:"제목 6",list:"목록",align:"정렬",indent:"들여쓰기",fontFamily:"글꼴",fontSize:"글자 크기",moreStyle:"더 많은 스타일",fontColor:"글자 색상",highlight:"글자 배경",image:"이미지",removeColor:"기본색"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},codeBlock:{langType:"코드언어 선택"}}},Di=Object.keys(Hi),$i={},Vi={},Fi=t=>{$i[t]||($i[t]=Hi[t],(t=>{Vi[t]={}})(t))};Di.forEach(Fi);const Ri=(t=>function(t,e,i={}){return Oi(e,zi(t,i))}(t,$i[t],Vi[t]))(Di.indexOf(window.LAKE_LANGUAGE)>=0?window.LAKE_LANGUAGE:"en-US"),Wi=[{value:"h1",text:`<span style="font-weight: bold; font-size: 26px;">${Ri.toolbar.heading1()}</span>`},{value:"h2",text:`<span style="font-weight: bold; font-size: 24px;">${Ri.toolbar.heading2()}</span>`},{value:"h3",text:`<span style="font-weight: bold; font-size: 22px;">${Ri.toolbar.heading3()}</span>`},{value:"h4",text:`<span style="font-weight: bold; font-size: 20px;">${Ri.toolbar.heading4()}</span>`},{value:"h5",text:`<span style="font-weight: bold; font-size: 18px;">${Ri.toolbar.heading5()}</span>`},{value:"h6",text:`<span style="font-weight: bold; font-size: 16px;">${Ri.toolbar.heading6()}</span>`},{value:"p",text:Ri.toolbar.paragraph()}],ji=[{icon:n.get("numberedList"),value:"numbered",text:Ri.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:Ri.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:Ri.toolbar.checklist()}],Ui=[{icon:n.get("alignLeft"),value:"left",text:Ri.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:Ri.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:Ri.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:Ri.toolbar.alignJustify()}],qi=[{icon:n.get("increaseIndent"),value:"increase",text:Ri.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:Ri.toolbar.decreaseIndent()}],Ki=[{icon:n.get("italic"),value:"italic",text:Ri.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:Ri.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:Ri.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:Ri.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:Ri.toolbar.subscript()},{icon:n.get("code"),value:"code",text:Ri.toolbar.code()}],Gi=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],Xi=[{icon:n.get("removeFormat"),value:"",text:Ri.toolbar.removeColor()}];for(const t of Gi)Xi.push({value:t.toLowerCase(),text:t.toUpperCase()});const Ji=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Yi=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:Ri.toolbar.undo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:Ri.toolbar.redo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:Ri.toolbar.selectAll(),onClick:(t,e)=>{t.command.execute(e)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:Ri.toolbar.paragraph(),isSelected:t=>!!t.find((t=>"p"===t.name)),onClick:t=>{t.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:n.get("blockQuote"),tooltip:Ri.toolbar.blockQuote(),onClick:(t,e)=>{t.command.execute(e)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:Ri.toolbar.numberedList(),isSelected:t=>!!t.find((t=>"ol"===t.name)),onClick:t=>{t.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:n.get("bulletedList"),tooltip:Ri.toolbar.bulletedList(),isSelected:t=>!!t.find((t=>"ul"===t.name&&!t.node.hasAttr("type"))),onClick:t=>{t.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:n.get("checklist"),tooltip:Ri.toolbar.checklist(),isSelected:t=>!!t.find((t=>"ul"===t.name&&"checklist"===t.node.attr("type"))),onClick:t=>{t.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:n.get("alignLeft"),tooltip:Ri.toolbar.alignLeft(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"left"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:n.get("alignCenter"),tooltip:Ri.toolbar.alignCenter(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"center"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","center")}},{name:"alignRight",type:"button",icon:n.get("alignRight"),tooltip:Ri.toolbar.alignRight(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"right"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:n.get("alignJustify"),tooltip:Ri.toolbar.alignJustify(),isSelected:t=>!!t.find((t=>t.node.isBlock&&"justify"===t.node.css("text-align"))),onClick:t=>{t.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:n.get("increaseIndent"),tooltip:Ri.toolbar.increaseIndent(),onClick:t=>{t.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:Ri.toolbar.decreaseIndent(),onClick:t=>{t.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:Ri.toolbar.bold(),onClick:(t,e)=>{t.command.execute(e)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:Ri.toolbar.italic(),onClick:(t,e)=>{t.command.execute(e)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:Ri.toolbar.underline(),onClick:(t,e)=>{t.command.execute(e)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:Ri.toolbar.strikethrough(),onClick:(t,e)=>{t.command.execute(e)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:Ri.toolbar.superscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:Ri.toolbar.subscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"code",type:"button",icon:n.get("code"),tooltip:Ri.toolbar.code(),onClick:(t,e)=>{t.command.execute(e)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:Ri.toolbar.removeFormat(),onClick:(t,e)=>{t.command.execute(e)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:Ri.toolbar.formatPainter(),onClick:(t,e)=>{t.command.execute(e)}},{name:"link",type:"button",icon:n.get("link"),tooltip:Ri.toolbar.link(),onClick:(t,e)=>{t.command.execute(e)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:Ri.toolbar.hr(),onClick:(t,e)=>{t.command.execute(e)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:Ri.toolbar.codeBlock(),onClick:(t,e)=>{t.command.execute(e)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:Ri.toolbar.heading(),width:"100px",menuType:"list",menuItems:Wi,onSelect:(t,e)=>{t.command.execute("heading",e)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),defaultValue:"",tooltip:Ri.toolbar.list(),width:"auto",menuType:"list",menuItems:ji,onSelect:(t,e)=>{t.command.execute("list",e)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),defaultValue:"",tooltip:Ri.toolbar.align(),width:"auto",menuType:"list",menuItems:Ui,onSelect:(t,e)=>{t.command.execute("align",e)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),defaultValue:"",tooltip:Ri.toolbar.indent(),width:"auto",menuType:"list",menuItems:qi,onSelect:(t,e)=>{t.command.execute("indent",e)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:Ri.toolbar.fontFamily(),width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],onSelect:(t,e)=>{t.command.execute("fontFamily",e)}},{name:"fontSize",type:"dropdown",downIcon:n.get("down"),defaultValue:"16px",tooltip:Ri.toolbar.fontSize(),width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],onSelect:(t,e)=>{t.command.execute("fontSize",e)}},{name:"moreStyle",type:"dropdown",icon:n.get("more"),defaultValue:"",tooltip:Ri.toolbar.moreStyle(),width:"auto",menuType:"list",menuItems:Ki,selectedValues:t=>{var e;const i=[];for(const n of t)if(n.node.isMark){const t=null!==(e=Ji.get(n.name))&&void 0!==e?e:n.name;i.push(t)}return i},onSelect:(t,e)=>{t.command.execute(e)}},{name:"fontColor",type:"dropdown",downIcon:n.get("down"),icon:n.get("fontColor"),accentIcon:n.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:Ri.toolbar.fontColor(),width:"auto",menuType:"color",menuItems:Xi,onSelect:(t,e)=>{t.command.execute("fontColor",e)}},{name:"highlight",type:"dropdown",downIcon:n.get("down"),icon:n.get("highlight"),accentIcon:n.get("highlightAccent"),defaultValue:"#fadb14",tooltip:Ri.toolbar.highlight(),width:"auto",menuType:"color",menuItems:Xi,onSelect:(t,e)=>{t.command.execute("highlight",e)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:Ri.toolbar.image(),accept:"image/*",multiple:!0}];function Qi(t){const{editor:e,file:i,onError:n,onSuccess:s}=t,{imageRequestMethod:o,imageRequestAction:r,imageRequestTypes:a}=e.config;if(a.indexOf(i.type)<0)throw new Error(`Cannot upload file because its type '${i.type}' is not found in ['${a.join("', '")}'].`);const l=e.insertBox("image",{url:URL.createObjectURL(i),status:"uploading",name:i.name,size:i.size,type:i.type,lastModified:i.lastModified}),h=pt({onProgress:t=>{const e=l.node.find(".lake-percent"),i=Math.round(t.percent);e.text(`${i<100?i:99} %`)},onError:(t,e)=>{A(t.toString(),e),l.updateValue("status","error"),l.render(),n&&n()},onSuccess:t=>{if(!t.url)return l.updateValue("status","error"),l.render(),void(n&&n());l.updateValue({status:"done",url:t.url}),l.render(),e.history.save(),s&&s()},file:i,action:r,method:o});return l.setData("xhr",h),l}const tn=["undo","redo","|","heading","fontSize","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],en=new Map;Yi.forEach((t=>{en.set(t.name,t)}));function nn(t,e,i,n){return new(i||(i=Promise))((function(s,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))}
|
|
19
|
+
/*!
|
|
20
|
+
* PhotoSwipe Lightbox 5.4.3 - https://photoswipe.com
|
|
21
|
+
* (c) 2023 Dmytro Semenov
|
|
22
|
+
*/
|
|
23
|
+
function sn(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function on(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}"function"==typeof SuppressedError&&SuppressedError;const rn="idle",an="loading",ln="loaded",hn="error";function cn(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}function dn(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let pn=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},un=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new pn(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}},mn=class{constructor(t,e){if(this.element=sn("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(on(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=function(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}(0,0,t/250)):on(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}},fn=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=rn,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new mn(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=sn("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=sn("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=an,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=ln,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==ln&&this.state!==hn||this.removePlaceholder())}onError(){this.state=hn,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===an,this)}isError(){return this.state===hn}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(on(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==hn,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=sn("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=sn("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===hn)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||dn())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!dn()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==ln&&this.state!==hn||this.removePlaceholder()))}};function gn(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}let vn=class{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}};function wn(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new vn(o,t,-1),r=e.pswp?e.pswp.viewportSize:function(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}(o,e);const a=function(t,e,i,n){return{x:e.x-gn("left",t,e,i,n)-gn("right",t,e,i,n),y:e.y-gn("top",t,e,i,n)-gn("bottom",t,e,i,n)}}(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}let yn=class extends un{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new fn(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?cn(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return wn(t,this,e)}};class xn extends yn{constructor(t){super(),this.options=t||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){cn(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.addEventListener("click",this.onThumbnailsClick,!1)}))}onThumbnailsClick(t){if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t)||window.pswp)return;let e={x:t.clientX,y:t.clientY};e.x||e.y||(e=null);let i=this.getClickedIndex(t);i=this.applyFilters("clickedIndex",i,t,this);const n={gallery:t.currentTarget};i>=0&&(t.preventDefault(),this.loadAndOpen(i,n,e))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);const e=t.target,i=cn(this.options.children,this.options.childSelector,t.currentTarget).findIndex((t=>t===e||t.contains(e)));return-1!==i?i:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,e,i){if(window.pswp||!this.options)return!1;if(!e&&this.options.gallery&&this.options.children){const t=cn(this.options.gallery);t[0]&&(e={gallery:t[0]})}return this.options.index=t,this.options.initialPointerPos=i,this.shouldOpen=!0,this.preload(t,e),!0}preload(t,e){const{options:i}=this;e&&(i.dataSource=e);const n=[],s=typeof i.pswpModule;if("function"==typeof(o=i.pswpModule)&&o.prototype&&o.prototype.goTo)n.push(Promise.resolve(i.pswpModule));else{if("string"===s)throw new Error("pswpModule as string is no longer supported");if("function"!==s)throw new Error("pswpModule is not valid");n.push(i.pswpModule())}var o;"function"==typeof i.openPromise&&n.push(i.openPromise()),!1!==i.preloadFirstSlide&&t>=0&&(this._preloadedContent=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return wn(i,e,t)}(t,this));const r=++this._uid;Promise.all(n).then((t=>{if(this.shouldOpen){const e=t[0];this._openPhotoswipe(e,r)}}))}_openPhotoswipe(t,e){if(e!==this._uid&&this.shouldOpen)return;if(this.shouldOpen=!1,window.pswp)return;const i="object"==typeof t?new t.default(this.options):new t(this.options);this.pswp=i,window.pswp=i,Object.keys(this._listeners).forEach((t=>{var e;null===(e=this._listeners[t])||void 0===e||e.forEach((e=>{i.on(t,e)}))})),Object.keys(this._filters).forEach((t=>{var e;null===(e=this._filters[t])||void 0===e||e.forEach((e=>{i.addFilter(t,e.fn,e.priority)}))})),this._preloadedContent&&(i.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),i.on("destroy",(()=>{this.pswp=void 0,delete window.pswp})),i.init()}destroy(){var t;null===(t=this.pswp)||void 0===t||t.destroy(),this.shouldOpen=!1,this._listeners={},cn(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.removeEventListener("click",this.onThumbnailsClick,!1)}))}}
|
|
24
|
+
/*!
|
|
25
|
+
* PhotoSwipe 5.4.3 - https://photoswipe.com
|
|
26
|
+
* (c) 2023 Dmytro Semenov
|
|
27
|
+
*/function bn(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function kn(t,e){return t.x=e.x,t.y=e.y,void 0!==e.id&&(t.id=e.id),t}function _n(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function Sn(t,e){const i=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y);return Math.sqrt(i*i+n*n)}function Cn(t,e){return t.x===e.x&&t.y===e.y}function An(t,e,i){return Math.min(Math.max(t,e),i)}function Bn(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ln(t,e,i,n){t.style.transform=Bn(e,i,n)}const Tn="cubic-bezier(.4,0,.22,1)";function In(t,e,i,n){t.style.transition=e?`${e} ${i}ms ${n||Tn}`:"none"}function En(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}const Mn="idle",Pn="loading",Zn="loaded",zn="error";function Nn(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let On=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{On=!0}}))}catch(vi){}class Hn{constructor(){this._pool=[]}add(t,e,i,n){this._toggleListener(t,e,i,n)}remove(t,e,i,n){this._toggleListener(t,e,i,n,!0)}removeAll(){this._pool.forEach((t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)})),this._pool=[]}_toggleListener(t,e,i,n,s,o){if(!t)return;const r=s?"removeEventListener":"addEventListener";e.split(" ").forEach((e=>{if(e){o||(s?this._pool=this._pool.filter((n=>n.type!==e||n.listener!==i||n.target!==t)):this._pool.push({target:t,type:e,listener:i,passive:n}));const a=!!On&&{passive:n||!1};t[r](e,i,a)}}))}}function Dn(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function $n(t,e,i,n,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,n,s)[t];else if(e.padding)o=e.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);e[i]&&(o=e[i])}return Number(o)||0}function Vn(t,e,i,n){return{x:e.x-$n("left",t,e,i,n)-$n("right",t,e,i,n),y:e.y-$n("top",t,e,i,n)-$n("bottom",t,e,i,n)}}class Fn{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const{pswp:e}=this.slide,i=this.slide["x"===t?"width":"height"]*this.currZoomLevel,n=$n("x"===t?"left":"top",e.options,e.viewportSize,this.slide.data,this.slide.index),s=this.slide.panAreaSize[t];this.center[t]=Math.round((s-i)/2)+n,this.max[t]=i>s?Math.round(s-i)+n:this.center[t],this.min[t]=i>s?n:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,e){return An(e,this.max[t],this.min[t])}}class Rn{constructor(t,e,i,n){this.pswp=n,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){const n={x:t,y:e};this.elementSize=n,this.panAreaSize=i;const s=i.x/n.x,o=i.y/n.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const e=t+"ZoomLevel",i=this.options[e];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}class Wn{constructor(t,e,i){this.data=t,this.index=e,this.pswp=i,this.isActive=e===i.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!i.opener.isOpen,this.zoomLevels=new Rn(i.options,t,e,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=bn("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new Fn(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive,1)&&(this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this})))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel!==this.zoomLevels.initial&&this.isActive?(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y)):(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize())}updateContentSize(t){const e=this.currentResolution||this.zoomLevels.initial;if(!e)return;const i=Math.round(this.width*e)||this.pswp.viewportSize.x,n=Math.round(this.height*e)||this.pswp.viewportSize.y;(this.sizeChanged(i,n)||t)&&this.content.setDisplayedSize(i,n)}sizeChanged(t,e){return(t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=t,this.prevDisplayedHeight=e,!0)}getPlaceholderElement(){var t;return null===(t=this.content.placeholder)||void 0===t?void 0:t.element}zoomTo(t,e,i,n){const{pswp:s}=this;if(!this.isZoomable()||s.mainScroll.isShifted())return;s.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i}),s.animations.stopAllPan();const o=this.currZoomLevel;n||(t=An(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",e,o),this.pan.y=this.calculateZoomToPanOffset("y",e,o),_n(this.pan);const r=()=>{this._setResolution(t),this.applyCurrentZoomPan()};i?s.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:r,duration:i,easing:s.options.easing}):r()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,e,i){if(0===this.bounds.max[t]-this.bounds.min[t])return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);const n=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*n+e[t])}panTo(t,e){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",e),this.applyCurrentZoomPan()}isPannable(){return Boolean(this.width)&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return Boolean(this.width)&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),kn(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Ln(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;kn(this.panAreaSize,Vn(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return Bn(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class jn{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&kn(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:e,dragAxis:i}=this.gestures,{currSlide:n}=this.pswp;if("y"===i&&this.pswp.options.closeOnVerticalDrag&&n&&n.currZoomLevel<=n.zoomLevels.fit&&!this.gestures.isMultitouch){const i=n.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,.6);const t=1-Math.abs(this._getVerticalDragRatio(n.pan.y));this.pswp.applyBgOpacity(t),n.applyCurrentZoomPan()}}else{this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),n&&(_n(n.pan),n.applyCurrentZoomPan()))}}end(){const{velocity:t}=this.gestures,{mainScroll:e,currSlide:i}=this.pswp;let n=0;if(this.pswp.animations.stopAll(),e.isShifted()){const i=(e.x-e.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-.5&&i<0||t.x<.1&&i<-.5?(n=1,t.x=Math.min(t.x,0)):(t.x>.5&&i>0||t.x>-.1&&i>.5)&&(n=-1,t.x=Math.max(t.x,0)),e.moveIndexBy(n,!0,t.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){const{velocity:e}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;const{pan:n,bounds:s}=i,o=n[t],r=this.pswp.bgOpacity<1&&"y"===t,a=o+function(t,e){return t*e/(1-e)}(e[t],.995);if(r){const t=this._getVerticalDragRatio(o),e=this._getVerticalDragRatio(a);if(t<0&&e<-.4||t>0&&e>.4)return void this.pswp.close()}const l=s.correctPan(t,a);if(o===l)return;const h=l===a?1:.82,c=this.pswp.bgOpacity,d=l-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:l,velocity:e[t],dampingRatio:h,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(l-e)/d;this.pswp.applyBgOpacity(An(c+(1-c)*t,0,1))}n[t]=Math.floor(e),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){const{p1:e,dragAxis:i,prevP1:n,isMultitouch:s}=this.gestures,{currSlide:o,mainScroll:r}=this.pswp,a=e[t]-n[t],l=r.x+a;if(!a||!o)return!1;if("x"===t&&!o.isPannable()&&!s)return r.moveTo(l,!0),!0;const{bounds:h}=o,c=o.pan[t]+a;if(this.pswp.options.allowPanToNext&&"x"===i&&"x"===t&&!s){const e=r.getCurrSlideX(),i=r.x-e,n=a>0,s=!n;if(c>h.min[t]&&n){if(h.min[t]<=this.startPan[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,c)}else if(c<h.max[t]&&s){if(this.startPan[t]<=h.max[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,c)}else if(0!==i){if(i>0)return r.moveTo(Math.max(l,e),!0),!0;if(i<0)return r.moveTo(Math.min(l,e),!0),!0}else this._setPanWithFriction(t,c)}else"y"===t&&(r.isShifted()||h.min.y===h.max.y)||this._setPanWithFriction(t,c);return!1}_getVerticalDragRatio(t){var e,i;return(t-(null!==(e=null===(i=this.pswp.currSlide)||void 0===i?void 0:i.bounds.center.y)&&void 0!==e?e:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,e,i){const{currSlide:n}=this.pswp;if(!n)return;const{pan:s,bounds:o}=n;if(o.correctPan(t,e)!==e||i){const n=Math.round(e-s[t]);s[t]+=n*(i||.35)}else s[t]=e}}function Un(t,e,i){return t.x=(e.x+i.x)/2,t.y=(e.y+i.y)/2,t}class qn{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,kn(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:t,startP1:e,p2:i,startP2:n,pswp:s}=this.gestures,{currSlide:o}=s;if(!o)return;const r=o.zoomLevels.min,a=o.zoomLevels.max;if(!o.isZoomable()||s.mainScroll.isShifted())return;Un(this._startZoomPoint,e,n),Un(this._zoomPoint,t,i);let l=1/Sn(e,n)*Sn(t,i)*this._startZoomLevel;if(l>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),l<r)if(s.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=o.zoomLevels.initial){const t=1-(r-l)/(r/1.2);s.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||s.applyBgOpacity(t)}else l=r-.15*(r-l);else l>a&&(l=a+.05*(l-a));o.pan.x=this._calculatePanForZoomLevel("x",l),o.pan.y=this._calculatePanForZoomLevel("y",l),o.setZoomLevel(l),o.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures,{currSlide:e}=t;(!e||e.currZoomLevel<e.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&t.options.pinchToClose?t.close():this.correctZoomPan()}_calculatePanForZoomLevel(t,e){const i=e/this._startZoomLevel;return this._zoomPoint[t]-(this._startZoomPoint[t]-this._startPan[t])*i}correctZoomPan(t){const{pswp:e}=this.gestures,{currSlide:i}=e;if(null==i||!i.isZoomable())return;0===this._zoomPoint.x&&(t=!0);const n=i.currZoomLevel;let s,o=!0;n<i.zoomLevels.initial?s=i.zoomLevels.initial:n>i.zoomLevels.max?s=i.zoomLevels.max:(o=!1,s=n);const r=e.bgOpacity,a=e.bgOpacity<1,l=kn({x:0,y:0},i.pan);let h=kn({x:0,y:0},l);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=n,kn(this._startPan,l)),o&&(h={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),h={x:i.bounds.correctPan("x",h.x),y:i.bounds.correctPan("y",h.y)},i.setZoomLevel(n);const c=!Cn(h,l);if(!c&&!o&&!a)return i._setResolution(s),void i.applyCurrentZoomPan();e.animations.stopAllPan(),e.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{if(t/=1e3,c||o){if(c&&(i.pan.x=l.x+(h.x-l.x)*t,i.pan.y=l.y+(h.y-l.y)*t),o){const e=n+(s-n)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(An(r+(1-r)*t,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function Kn(t){return!!t.target.closest(".pswp__container")}class Gn{constructor(t){this.gestures=t}click(t,e){const i=e.target.classList,n=i.contains("pswp__img"),s=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");n?this._doClickOrTapAction("imageClick",t,e):s&&this._doClickOrTapAction("bgClick",t,e)}tap(t,e){Kn(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Kn(e)&&this._doClickOrTapAction("doubleTap",t,e)}_doClickOrTapAction(t,e,i){var n;const{pswp:s}=this.gestures,{currSlide:o}=s,r=t+"Action",a=s.options[r];if(!s.dispatch(r,{point:e,originalEvent:i}).defaultPrevented)if("function"!=typeof a)switch(a){case"close":case"next":s[a]();break;case"zoom":null==o||o.toggleZoom(e);break;case"zoom-or-close":null!=o&&o.isZoomable()&&o.zoomLevels.secondary!==o.zoomLevels.initial?o.toggleZoom(e):s.options.clickToCloseNonZoomable&&s.close();break;case"toggle-controls":null===(n=this.gestures.pswp.element)||void 0===n||n.classList.toggle("pswp--ui-visible")}else a.call(s,e,i)}}class Xn{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new jn(this),this.zoomLevels=new qn(this),this.tapHandler=new Gn(this),t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")}))}_bindEvents(t,e,i,n){const{pswp:s}=this,{events:o}=s,r=n?t+n:"";o.add(s.scrollWrap,t+e,this.onPointerDown.bind(this)),o.add(window,t+"move",this.onPointerMove.bind(this)),o.add(window,t+i,this.onPointerUp.bind(this)),r&&o.add(s.scrollWrap,r,this.onPointerUp.bind(this))}onPointerDown(t){const e="mousedown"===t.type||"mouse"===t.pointerType;if(e&&t.button>0)return;const{pswp:i}=this;i.opener.isOpen?i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(e&&(i.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),i.animations.stopAll(),this._updatePoints(t,"down"),1===this._numActivePoints&&(this.dragAxis=null,kn(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1):t.preventDefault()}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented||(1!==this._numActivePoints||this.isDragging?this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop()):(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,kn(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop()))))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented||(0===this._numActivePoints&&(this._rafStopLoop(),this.isDragging?this._finishDrag():this.isZooming||this.isMultitouch||this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),1===this._numActivePoints&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?Cn(this.p1,this.prevP1)||this.drag.change():Cn(this.p1,this.prevP1)&&Cn(this.p2,this.prevP2)||this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){const e=Date.now(),i=e-this._intervalTime;i<50&&!t||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=e,kn(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){const{mainScroll:e}=this.pswp;if(e.isShifted())return void e.moveIndexBy(0,!0);if(t.type.indexOf("cancel")>0)return;if("mouseup"===t.type||"mouse"===t.pointerType)return void this.tapHandler.click(this.startP1,t);const i=this.pswp.options.doubleTapAction?300:0;this._tapTimer?(this._clearTapTimer(),Sn(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(kn(this._lastStartP1,this.startP1),this._tapTimer=setTimeout((()=>{this.tapHandler.tap(this.startP1,t),this._clearTapTimer()}),i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,e){const i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,e){this.pswp.applyFilters("preventPointerEvent",!0,t,e)&&t.preventDefault()}_updatePoints(t,e){if(this._pointerEventEnabled){const i=t,n=this._ongoingPointers.findIndex((t=>t.id===i.pointerId));"up"===e&&n>-1?this._ongoingPointers.splice(n,1):"down"===e&&-1===n?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):n>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[n]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&kn(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&kn(this.p2,this._ongoingPointers[1])}else{const i=t;this._numActivePoints=0,i.type.indexOf("touch")>-1?i.touches&&i.touches.length>0&&(this._convertEventPosToPoint(i.touches[0],this.p1),this._numActivePoints++,i.touches.length>1&&(this._convertEventPosToPoint(i.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),"up"===e?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){kn(this.prevP1,this.p1),kn(this.prevP2,this.p2)}_updateStartPoints(){kn(this.startP1,this.p1),kn(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==t){const e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=10&&(this.dragAxis=e)}}}_convertEventPosToPoint(t,e){return e.x=t.pageX-this.pswp.offset.x,e.y=t.pageY-this.pswp.offset.y,"pointerId"in t?e.id=t.pointerId:void 0!==t.identifier&&(e.id=t.identifier),e}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}class Jn{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){const{pswp:e}=this,i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing),n=i!==this.slideWidth;n&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((e,i)=>{n&&Ln(e.el,(i+this._containerShiftIndex)*this.slideWidth),t&&e.slide&&e.slide.resize()}))}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const e=bn("pswp__item","div",this.pswp.container);e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.setAttribute("aria-hidden","true"),e.style.display=1===t?"block":"none",this.itemHolders.push({el:e})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,e,i){const{pswp:n}=this;let s=n.potentialIndex+t;const o=n.getNumItems();if(n.canLoop()){s=n.getLoopedIndex(s);const e=(t+o)%o;t=e<=o/2?e:e-o}else s<0?s=0:s>=o&&(s=o-1),t=s-n.potentialIndex;n.potentialIndex=s,this._currPositionIndex-=t,n.animations.stopMainScroll();const r=this.getCurrSlideX();if(e){n.animations.startSpring({isMainScroll:!0,start:this.x,end:r,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem(),n.appendHeavy()}});let t=n.potentialIndex-n.currIndex;if(n.canLoop()){const e=(t+o)%o;t=e<=o/2?e:e-o}Math.abs(t)>1&&this.updateCurrItem()}else this.moveTo(r),this.updateCurrItem();return Boolean(t)}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:e}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let n,s=Math.abs(i);s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3);for(let t=0;t<s;t++)i>0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Ln(n.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(n,e.currIndex-s+t+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Ln(n.el,this._containerShiftIndex*this.slideWidth),e.setContent(n,e.currIndex+s-t-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach(((t,e)=>{t.slide&&t.slide.setIsActive(1===e)})),e.currSlide=null===(t=this.itemHolders[1])||void 0===t?void 0:t.slide,e.contentLoader.updateLazy(i),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch("change")}moveTo(t,e){if(!this.pswp.canLoop()&&e){let e=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;e+=this.pswp.currIndex;const i=Math.round(t-this.x);(e<0&&i>0||e>=this.pswp.getNumItems()-1&&i<0)&&(t=this.x+.35*i)}this.x=t,this.pswp.container&&Ln(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:null!=e&&e})}}const Yn={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Qn=(t,e)=>e?t:Yn[t];class ts{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",(()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))}));const e=document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()}))}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){const{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t))return;let i,n,s=!1;const o="key"in t;switch(o?t.key:t.keyCode){case Qn("Escape",o):e.options.escKey&&(i="close");break;case Qn("z",o):i="toggleZoom";break;case Qn("ArrowLeft",o):n="x";break;case Qn("ArrowUp",o):n="y";break;case Qn("ArrowRight",o):n="x",s=!0;break;case Qn("ArrowDown",o):s=!0,n="y";break;case Qn("Tab",o):this._focusRoot()}if(n){t.preventDefault();const{currSlide:o}=e;e.options.arrowKeys&&"x"===n&&e.getNumItems()>1?i=s?"next":"prev":o&&o.currZoomLevel>o.zoomLevels.fit&&(o.pan[n]+=s?-80:80,o.panTo(o.pan.x,o.pan.y))}i&&(t.preventDefault(),e[i]())}_onFocusIn(t){const{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(t.target)&&e.focus()}}const es="cubic-bezier(.4,0,.22,1)";class is{constructor(t){var e;this.props=t;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=es}=t;this.onFinish=o;const l=s?"transform":"opacity",h=null!==(e=t[l])&&void 0!==e?e:"";this._target=i,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout((()=>{In(i,l,r,a),this._helperTimeout=setTimeout((()=>{i.addEventListener("transitionend",this._onTransitionEnd,!1),i.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout((()=>{this._finalizeAnimation()}),r+500),i.style[l]=h}),30)}),0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),In(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class ns{constructor(t,e,i){this.velocity=1e3*t,this._dampingRatio=e||.75,this._naturalFrequency=i||12,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,e){let i,n=0;e/=1e3;const s=Math.E**(-this._dampingRatio*this._naturalFrequency*e);if(1===this._dampingRatio)i=this.velocity+this._naturalFrequency*t,n=(t+i*e)*s,this.velocity=n*-this._naturalFrequency+i*s;else if(this._dampingRatio<1){i=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const o=Math.cos(this._dampedFrequency*e),r=Math.sin(this._dampedFrequency*e);n=s*(t*o+i*r),this.velocity=n*-this._naturalFrequency*this._dampingRatio+s*(-this._dampedFrequency*t*r+this._dampedFrequency*i*o)}return n}}class ss{constructor(t){this.props=t,this._raf=0;const{start:e,end:i,velocity:n,onUpdate:s,onComplete:o,onFinish:r=(()=>{}),dampingRatio:a,naturalFrequency:l}=t;this.onFinish=r;const h=new ns(n,a,l);let c=Date.now(),d=e-i;const p=()=>{this._raf&&(d=h.easeFrame(d,Date.now()-c),Math.abs(d)<1&&Math.abs(h.velocity)<50?(s(i),o&&o(),this.onFinish()):(c=Date.now(),s(d+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class os{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){const i=e?new ss(t):new is(t);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(t){t.destroy();const e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isPan||(t.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isMainScroll||(t.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}class rs{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();const{currSlide:e}=this.pswp;let{deltaX:i,deltaY:n}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let i=-n;1===t.deltaMode?i*=.05:i*=t.deltaMode?1:.002,i=2**i;const s=e.currZoomLevel*i;e.zoomTo(s,{x:t.clientX,y:t.clientY})}}else e.isPannable()&&(1===t.deltaMode&&(i*=18,n*=18),e.panTo(e.pan.x-i,e.pan.y-n))}}class as{constructor(t,e){var i;const n=e.name||e.className;let s=e.html;if(!1===t.options[n])return;"string"==typeof t.options[n+"SVG"]&&(s=t.options[n+"SVG"]),t.dispatch("uiElementCreate",{data:e});let o="";e.isButton?(o+="pswp__button ",o+=e.className||`pswp__button--${e.name}`):o+=e.className||`pswp__${e.name}`;let r=e.isButton?e.tagName||"button":e.tagName||"div";r=r.toLowerCase();const a=bn(o,r);if(e.isButton){"button"===r&&(a.type="button");let{title:i}=e;const{ariaLabel:s}=e;"string"==typeof t.options[n+"Title"]&&(i=t.options[n+"Title"]),i&&(a.title=i);const o=s||i;o&&a.setAttribute("aria-label",o)}a.innerHTML=function(t){if("string"==typeof t)return t;if(!t||!t.isCustomSVG)return"";const e=t;let i='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return i=i.split("%d").join(e.size||32),e.outlineID&&(i+='<use class="pswp__icn-shadow" xlink:href="#'+e.outlineID+'"/>'),i+=e.inner,i+="</svg>",i}(s),e.onInit&&e.onInit(a,t),e.onClick&&(a.onclick=i=>{"string"==typeof e.onClick?t[e.onClick]():"function"==typeof e.onClick&&e.onClick(i,a,t)});const l=e.appendTo||"bar";let h=t.element;"bar"===l?(t.topBar||(t.topBar=bn("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),h=t.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(h=t.scrollWrap)),null===(i=h)||void 0===i||i.appendChild(t.applyFilters("uiElement",a,e))}}function ls(t,e,i){t.classList.add("pswp__button--arrow"),t.setAttribute("aria-controls","pswp__items"),e.on("change",(()=>{e.options.loop||(t.disabled=i?!(e.currIndex<e.getNumItems()-1):!(e.currIndex>0))}))}const hs={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:ls},cs={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'<use xlink:href="#pswp__icn-arrow"/>',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(t,e)=>{ls(t,e,!0)}},ds={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>',outlineID:"pswp__icn-close"},onClick:"close"},ps={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},us={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>',outlineID:"pswp__icn-loading"},onInit:(t,e)=>{let i,n=null;const s=e=>{var n,s;i!==e&&(i=e,n="active",s=e,t.classList.toggle("pswp__preloader--"+n,s))},o=()=>{var t;if(null===(t=e.currSlide)||void 0===t||!t.content.isLoading())return s(!1),void(n&&(clearTimeout(n),n=null));n||(n=setTimeout((()=>{var t;s(Boolean(null===(t=e.currSlide)||void 0===t?void 0:t.content.isLoading())),n=null}),e.options.preloaderDelay))};e.on("change",o),e.on("loadComplete",(t=>{e.currSlide===t.slide&&o()})),e.ui&&(e.ui.updatePreloaderVisibility=o)}},ms={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};function fs(t,e){t.classList.toggle("pswp--zoomed-in",e)}class gs{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[ds,hs,cs,ps,us,ms],t.dispatch("uiRegister"),this.uiElementsData.sort(((t,e)=>(t.order||0)-(e.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((t=>{this.registerElement(t)})),t.on("change",(()=>{var e;null===(e=t.element)||void 0===e||e.classList.toggle("pswp--one-slide",1===t.getNumItems())})),t.on("zoomPanUpdate",(()=>this._onZoomPanUpdate()))}registerElement(t){this.isRegistered?this.items.push(new as(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:n}=e;if(this.pswp.opener.isOpen||(n=e.zoomLevels.initial),n===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=n;const s=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(s)<.01||!e.isZoomable())return fs(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");fs(t,(n===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial)<=n),"zoom"!==i.imageClickAction&&"zoom-or-close"!==i.imageClickAction||t.classList.add("pswp--click-to-zoom")}}class vs{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}}class ws{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var n,s,o;this._filters[t]||(this._filters[t]=[]),null===(n=this._filters[t])||void 0===n||n.push({fn:e,priority:i}),null===(s=this._filters[t])||void 0===s||s.sort(((t,e)=>t.priority-e.priority)),null===(o=this.pswp)||void 0===o||o.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter((t=>t.fn!==e))),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return null===(i=this._filters[t])||void 0===i||i.forEach((t=>{e[0]=t.fn.apply(this,e)})),e[0]}on(t,e){var i,n;this._listeners[t]||(this._listeners[t]=[]),null===(i=this._listeners[t])||void 0===i||i.push(e),null===(n=this.pswp)||void 0===n||n.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter((t=>e!==t))),null===(i=this.pswp)||void 0===i||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);const n=new vs(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}}class ys{constructor(t,e){if(this.element=bn("pswp__img pswp__img--placeholder",t?"img":"div",e),t){const e=this.element;e.decoding="async",e.alt="",e.src=t,e.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&("IMG"===this.element.tagName?(En(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Bn(0,0,t/250)):En(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class xs{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=Mn,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new ys(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=bn("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=bn("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const n=this.element;this.updateSrcsetSizes(),this.data.srcset&&(n.srcset=this.data.srcset),n.src=null!==(e=this.data.src)&&void 0!==e?e:"",n.alt=null!==(i=this.data.alt)&&void 0!==i?i:"",this.state=Pn,n.complete?this.onLoaded():(n.onload=()=>{this.onLoaded()},n.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=Zn,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==Zn&&this.state!==zn||this.removePlaceholder())}onError(){this.state=zn,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===Pn,this)}isError(){return this.state===zn}isImageContent(){return"image"===this.type}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(En(this.element,t,e),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==zn,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=bn("pswp__error-msg","div");i.innerText=null!==(t=null===(e=this.instance.options)||void 0===e?void 0:e.errorMsg)&&void 0!==t?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=bn("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===zn)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Nn())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!Nn()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==Zn&&this.state!==zn||this.removePlaceholder()))}}function bs(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new Rn(o,t,-1),r=e.pswp?e.pswp.viewportSize:Dn(o,e);const a=Vn(o,r,t,i);s.update(n.width,n.height,a)}return n.lazyLoad(),s&&n.setDisplayedSize(Math.ceil(n.width*s.initial),Math.ceil(n.height*s.initial)),n}class ks{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,5),this._cachedItems=[]}updateLazy(t){const{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;const{preload:i}=e.options,n=void 0===t||t>=0;let s;for(s=0;s<=i[1];s++)this.loadSlideByIndex(e.currIndex+(n?s:-s));for(s=1;s<=i[0];s++)this.loadSlideByIndex(e.currIndex+(n?-s:s))}loadSlideByIndex(t){const e=this.pswp.getLoopedIndex(t);let i=this.getContentByIndex(e);i||(i=function(t,e){const i=e.getItemData(t);if(!e.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return bs(i,e,t)}(e,this.pswp),i&&this.addToCache(i))}getContentBySlide(t){let e=this.getContentByIndex(t.index);return e||(e=this.pswp.createContentFromData(t.data,t.index),this.addToCache(e)),e.setSlide(t),e}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){const t=this._cachedItems.findIndex((t=>!t.isAttached&&!t.hasSlide));if(-1!==t){this._cachedItems.splice(t,1)[0].destroy()}}}removeByIndex(t){const e=this._cachedItems.findIndex((e=>e.index===t));-1!==e&&this._cachedItems.splice(e,1)}getContentByIndex(t){return this._cachedItems.find((e=>e.index===t))}destroy(){this._cachedItems.forEach((t=>t.destroy())),this._cachedItems=[]}}class _s extends ws{getNumItems(){var t;let e=0;const i=null===(t=this.options)||void 0===t?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));const n=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",n.numItems,i)}createContentFromData(t,e){return new xs(t,this,e)}getItemData(t){var e;const i=null===(e=this.options)||void 0===e?void 0:e.dataSource;let n={};Array.isArray(i)?n=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),n=i.items[t]);let s=n;s instanceof Element&&(s=this._domElementToItemData(s));const o=this.dispatch("itemData",{itemData:s||{},index:t});return this.applyFilters("itemData",o.itemData,t)}_getGalleryDOMElements(t){var e,i;return null!==(e=this.options)&&void 0!==e&&e.children||null!==(i=this.options)&&void 0!==i&&i.childSelector?function(t,e,i=document){let n=[];if(t instanceof Element)n=[t];else if(t instanceof NodeList||Array.isArray(t))n=Array.from(t);else{const s="string"==typeof t?t:e;s&&(n=Array.from(i.querySelectorAll(s)))}return n}(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const e={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);const s=t.querySelector("img");var n;if(s)e.msrc=s.currentSrc||s.src,e.alt=null!==(n=s.getAttribute("alt"))&&void 0!==n?n:"";(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return bs(t,this,e)}}const Ss=.003;class Cs{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout((()=>{this._start()}),this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this,e=this.pswp.currSlide,{options:i}=t;var n,s;("fade"===i.showHideAnimationType?(i.showHideOpacity=!0,this._thumbBounds=void 0):"none"===i.showHideAnimationType?(i.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=null==e?void 0:e.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=Boolean(this._duration&&this._duration>50),this._animateZoom=Boolean(this._thumbBounds)&&(null==e?void 0:e.content.usePlaceholder())&&(!this.isClosing||!t.mainScroll.isShifted()),this._animateZoom)?this._animateRootOpacity=null!==(n=i.showHideOpacity)&&void 0!==n&&n:(this._animateRootOpacity=!0,this.isOpening&&e&&(e.zoomAndPanToInitial(),e.applyCurrentZoomPan()));if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>Ss,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation)return this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,void(this.isOpening&&(t.element&&(t.element.style.opacity=String(Ss)),t.applyBgOpacity(1)));this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect?(this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=null===(s=this.pswp.currSlide)||void 0===s?void 0:s.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")):this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String(Ss)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(Ss)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(Ss)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&0!==t.mainScroll.x&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&"IMG"===this._placeholder.tagName?new Promise((t=>{let e=!1,i=!0;var n;(n=this._placeholder,"decode"in n?n.decode().catch((()=>{})):n.complete?Promise.resolve(n):new Promise(((t,e)=>{n.onload=()=>t(n),n.onerror=e}))).finally((()=>{e=!0,i||t(!0)})),setTimeout((()=>{i=!1,e&&t(!0)}),50),setTimeout(t,250)})).finally((()=>this._initiate())):this._initiate()}_initiate(){var t,e;null===(t=this.pswp.element)||void 0===t||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),null===(e=this.pswp.element)||void 0===e||e.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var e;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),null===(e=t.currSlide)||void 0===e||e.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:e}=this,{innerRect:i}=this._thumbBounds,{currSlide:n,viewportSize:s}=e;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){const e=-s.x+(this._thumbBounds.x-i.x)+i.w,n=-s.y+(this._thumbBounds.y-i.y)+i.h,o=s.x-i.w,r=s.y-i.h;t?(this._animateTo(this._cropContainer1,"transform",Bn(e,n)),this._animateTo(this._cropContainer2,"transform",Bn(o,r))):(Ln(this._cropContainer1,e,n),Ln(this._cropContainer2,o,r))}n&&(kn(n.pan,i||this._thumbBounds),n.currZoomLevel=this._thumbBounds.w/n.width,t?this._animateTo(n.container,"transform",n.getCurrentTransform()):n.applyCurrentZoomPan())}_animateTo(t,e,i){if(!this._duration)return void(t.style[e]=i);const{animations:n}=this.pswp,s={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{n.activeAnimations.length||this._onAnimationComplete()},target:t};s[e]=i,n.startTransition(s)}}const As={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class Bs extends _s{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new Hn,this.animations=new os,this.mainScroll=new Jn(this),this.gestures=new Xn(this),this.opener=new Cs(this),this.keyboard=new ts(this),this.contentLoader=new ks(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new rs(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",(()=>{const{itemHolders:t}=this.mainScroll;t[0]&&(t[0].el.style.display="block",this.setContent(t[0],this.currIndex-1)),t[2]&&(t[2].el.style.display="block",this.setContent(t[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")})),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const e=this.getNumItems();return this.options.loop&&(t>e-1&&(t-=e),t<0&&(t+=e)),An(t,0,e-1)}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.appendHeavy()}))}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var e;null===(e=this.currSlide)||void 0===e||e.zoomTo(...t)}toggleZoom(){var t;null===(t=this.currSlide)||void 0===t||t.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying)return this.options.showHideAnimationType="none",void this.close();this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),null===(t=this.element)||void 0===t||t.remove(),this.mainScroll.itemHolders.forEach((t=>{var e;null===(e=t.slide)||void 0===e||e.destroy()})),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach(((e,i)=>{var n,s;let o=(null!==(n=null===(s=this.currSlide)||void 0===s?void 0:s.index)&&void 0!==n?n:0)-1+i;var r;(this.canLoop()&&(o=this.getLoopedIndex(o)),o===t)&&(this.setContent(e,t,!0),1===i&&(this.currSlide=e.slide,null===(r=e.slide)||void 0===r||r.setIsActive(!0)))})),this.dispatch("change")}setContent(t,e,i){if(this.canLoop()&&(e=this.getLoopedIndex(e)),t.slide){if(t.slide.index===e&&!i)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(e<0||e>=this.getNumItems()))return;const n=this.getItemData(e);t.slide=new Wn(n,e,this),e===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const e=Dn(this.options,this);!t&&Cn(e,this._prevViewportSize)||(kn(this._prevViewportSize,e),this.dispatch("beforeResize"),kn(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){var t;this.hasMouse||(this.hasMouse=!0,null===(t=this.element)||void 0===t||t.classList.add("pswp--has_mouse"))}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,e){this.offset.x=t,this.offset.y=e,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=bn("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=bn("pswp__bg","div",this.element),this.scrollWrap=bn("pswp__scroll-wrap","section",this.element),this.container=bn("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new gs(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return function(t,e,i){const n=i.dispatch("thumbBounds",{index:t,itemData:e,instance:i});if(n.thumbBounds)return n.thumbBounds;const{element:s}=e;let o,r;if(s&&!1!==i.options.thumbSelector){const t=i.options.thumbSelector||"img";r=s.matches(t)?s:s.querySelector(t)}return r=i.applyFilters("thumbEl",r,e,t),r&&(o=e.thumbCropped?function(t,e,i){const n=t.getBoundingClientRect(),s=n.width/e,o=n.height/i,r=s>o?s:o,a=(n.width-e*r)/2,l=(n.height-i*r)/2,h={x:n.left+a,y:n.top+l,w:e*r};return h.innerRect={w:n.width,h:n.height,x:a,y:l},h}(r,e.width||e.w||0,e.height||e.h||0):function(t){const e=t.getBoundingClientRect();return{x:e.left,y:e.top,w:e.width}}(r)),i.applyFilters("thumbBounds",o,e,t)}(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...As,...t}}}function Ls(t,e){const i=e.getEditor();if(!i)return;const n=e.getContainer(),s=t.closest(".lake-resizer").find(".lake-resizer-info"),o=t.attr("class").indexOf("-right")>=0,r=n.width(),a=n.height()/r;let l=0,h=0;const c=t=>{const e=t.clientX-l,i=Math.round(o?h+e:h-e),r=Math.round(a*i);n.css({width:`${i}px`,height:`${r}px`}),s.text(`${i} x ${r}`)};t.on("pointerdown",(e=>{const i=e;t.get(0).setPointerCapture(i.pointerId),l=i.clientX,h=n.width(),s.show(),t.on("pointermove",c)})),t.on("pointerup",(()=>{t.off("pointermove"),s.hide(),h=e.getContainer().width();const n=Math.round(a*h);e.updateValue({width:h,height:n}),i.history.save()})),t.on("pointercancel",(()=>{t.off("pointermove"),s.hide()}))}function Ts(t){return nn(this,void 0,void 0,(function*(){const e=I("<img />");return e.css({position:"absolute",top:"0",left:"-8888px","z-index":"-1",visibility:"hidden"}),new Promise((i=>{e.on("load",(()=>{const t=e.get(0),n=t.width,s=t.height;e.remove(),e.removeAttr("style"),i({node:e,width:n,height:s})})),e.on("error",(()=>{e.remove(),i({node:e})})),e.attr("src",t),I(document.body).append(e)}))}))}function Is(t,e){return nn(this,void 0,void 0,(function*(){const i=e.value;e.getContainer().css({width:"",height:""});const s=I(a`
|
|
6
28
|
<div class="lake-button-group">
|
|
7
|
-
<button type="button" class="lake-button-remove" title="
|
|
29
|
+
<button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
|
|
8
30
|
</div>
|
|
9
|
-
`),
|
|
31
|
+
`),o=s.find(".lake-button-remove"),r=n.get("remove");r&&o.append(r);const l=I(a`
|
|
10
32
|
<div class="lake-error">
|
|
11
33
|
<div class="lake-error-icon"></div>
|
|
12
|
-
<div class="lake-error-name">${
|
|
34
|
+
<div class="lake-error-name">${i.name||""}</div>
|
|
13
35
|
</div>
|
|
14
|
-
`),
|
|
36
|
+
`),h=n.get("image");h&&l.find(".lake-error-icon").append(h),t.append(s),t.append(l)}))}const Es={type:"inline",name:"image",render:t=>{const e=t.getEditor();if(!e)return;const i=t.value,s=t.getContainer();if(i.width&&i.height&&0===s.find(".lake-progress").length){s.css({width:`${i.width}px`,height:`${i.height}px`}),s.empty();const t=I('<div class="lake-image-placeholder" />');s.append(t);const e=n.get("image");e&&t.append(e)}if(0===s.first().length&&s.append("<div />"),"loading"===i.status)return;const o=I('<div class="lake-image" />');let r;o.addClass(`lake-image-${i.status}`),r="uploading"===i.status?function(t,e){return nn(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Ts(s.url);if(!o.width||!o.height)return void(yield Is(t,e));const r=i.container.innerWidth()-2,l=o.width<r?o.width:r,h=Math.round(l*o.height/o.width);e.updateValue({width:l,height:h,originalWidth:o.width,originalHeight:o.height}),e.getContainer().css({width:`${l}px`,height:`${h}px`});const c=I(a`
|
|
15
37
|
<div class="lake-button-group">
|
|
16
|
-
<button type="button" class="lake-button-remove" title="
|
|
38
|
+
<button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
|
|
17
39
|
</div>
|
|
18
|
-
`),d=c.find(".lake-button-remove"),
|
|
40
|
+
`),d=c.find(".lake-button-remove"),p=n.get("remove");p&&d.append(p);const u=I(a`
|
|
19
41
|
<div class="lake-progress">
|
|
20
|
-
<div class="lake-percent">${Math.round(
|
|
42
|
+
<div class="lake-percent">${Math.round(s.percent||0)} %</div>
|
|
21
43
|
</div>
|
|
22
|
-
`);
|
|
44
|
+
`);l<80&&u.find(".lake-percent").hide();const m=n.get("circleNotch");m&&u.prepend(m);const f=o.node;o.node.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),t.append(c),t.append(u),t.append(f)}))}(o,t):"error"===i.status?Is(o,t):function(t,e){return nn(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value,o=yield Ts(s.url);if(!o.width||!o.height)return void(yield Is(t,e));let r=s.width,l=s.height;if(!r||!l){const t=i.container.innerWidth()-2;r=Math.round(o.width<t?o.width:t),l=Math.round(r*o.height/o.width),e.updateValue({width:r,height:l})}e.getContainer().css({width:`${r}px`,height:`${l}px`});const h=I(a`
|
|
23
45
|
<div class="lake-button-group">
|
|
24
|
-
<button type="button" class="lake-button-view" title="
|
|
25
|
-
<button type="button" class="lake-button-remove" title="
|
|
46
|
+
<button type="button" tabindex="-1" class="lake-button-view" title="${Ri.image.view()}"></button>
|
|
47
|
+
<button type="button" tabindex="-1" class="lake-button-remove" title="${Ri.image.remove()}"></button>
|
|
26
48
|
</div>
|
|
27
|
-
`),c=
|
|
49
|
+
`),c=h.find(".lake-button-view"),d=n.get("maximize");d&&c.append(d),(r<80||null===xn)&&c.hide();const p=h.find(".lake-button-remove"),u=n.get("remove");u&&p.append(u);const m=I(a`
|
|
28
50
|
<div class="lake-resizer">
|
|
29
51
|
<div class="lake-resizer-top-left"></div>
|
|
30
52
|
<div class="lake-resizer-top-right"></div>
|
|
31
53
|
<div class="lake-resizer-bottom-left"></div>
|
|
32
54
|
<div class="lake-resizer-bottom-right"></div>
|
|
33
|
-
<div class="lake-resizer-info">${
|
|
55
|
+
<div class="lake-resizer-info">${r} x ${l}</div>
|
|
34
56
|
</div>
|
|
35
|
-
`),
|
|
57
|
+
`),f=o.node;f.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),Ls(m.find(".lake-resizer-top-left"),e),Ls(m.find(".lake-resizer-top-right"),e),Ls(m.find(".lake-resizer-bottom-left"),e),Ls(m.find(".lake-resizer-bottom-right"),e),t.append(h),t.append(m),t.append(f)}))}(o,t),r.then((()=>{s.empty(),s.append(o),o.find(".lake-button-view").on("click",(()=>function(t){const e=t.getEditor();if(!e)return;const i=[];let s=0;const o=e.container.find('lake-box[name="image"]');o.each(((e,n)=>{const o=new Qt(e),r=o.value;"done"===r.status&&(i.push({id:n,src:r.originalUrl||r.url,width:r.originalWidth||r.width,height:r.originalHeight||r.height,alt:r.name}),t.node.id===o.node.id&&(s=n))}));const r=new xn({pswpModule:Bs,dataSource:i,mainClass:"lake-pswp",zoom:!1,arrowPrevSVG:n.get("left"),arrowNextSVG:n.get("right"),closeSVG:n.get("close"),arrowPrevTitle:Ri.image.previous(),arrowNextTitle:Ri.image.next(),closeTitle:Ri.image.close(),errorMsg:Ri.image.loadingError()});r.on("uiRegister",(()=>{const t=r.pswp;t.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:Ri.image.zoomOut(),html:n.get("zoomOut"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel-i;e.zoomTo(n,void 0,333)}}),t.ui.registerElement({name:"zoom-in-button",order:9,isButton:!0,title:Ri.image.zoomIn(),html:n.get("zoomIn"),onClick:()=>{const e=t.currSlide,i=(e.zoomLevels.max-e.zoomLevels.min)/5,n=e.currZoomLevel+i;e.zoomTo(n,void 0,333)}})})),r.addFilter("thumbEl",((t,e)=>{const i=o.eq(e.id).find(".lake-image-img");return i.length>0?i.get(0):t})),r.addFilter("placeholderSrc",((t,e)=>{const i=o.eq(e.data.id).find(".lake-image-img");return i.length>0?i.attr("src"):t})),r.on("openingAnimationEnd",(()=>{t.event.emit("openfullscreen")})),r.init(),r.loadAndOpen(s)}(t))),o.find(".lake-button-remove").on("click",(e=>{e.stopPropagation(),function(t){const e=t.getEditor();if(!e)return;const i=t.getData("xhr");i&&i.abort(),e.selection.range.selectBox(t.node),e.removeBox(),e.history.save()}(t)})),t.event.emit("render")})),o.on("click",(()=>{e.selection.range.selectBox(t.node)}))},html:t=>{const e=t.node.attr("value");return a`<img src="${t.value.url}" data-lake-value="${e}" />`}},Ms="text",Ps="#cf222e",Zs="#1f2328",zs="#005cc5",Ns="#0a3069",Os="#0550ae",Hs="#24292f",Ds="#24292e",$s="#0550ae",Vs="#57606a",Fs="#0550ae",Rs="#f6f8fa",Ws="#116329";function js(t){const{HighlightStyle:e,tags:i}=t;return e.define([{tag:i.keyword,color:Ps},{tag:[i.name,i.deleted,i.character,i.macroName],color:Zs},{tag:[i.propertyName],color:zs},{tag:[i.processingInstruction,i.string,i.inserted,i.special(i.string)],color:Ns},{tag:[i.function(i.variableName),i.labelName],color:zs},{tag:[i.color,i.constant(i.name),i.standard(i.name)],color:Os},{tag:[i.definition(i.name),i.separator],color:Zs},{tag:[i.className],color:Ds},{tag:[i.number,i.changed,i.annotation,i.modifier,i.self,i.namespace],color:$s},{tag:[i.typeName],color:Hs},{tag:[i.operator,i.operatorKeyword],color:Ps},{tag:[i.url,i.escape,i.regexp,i.link],color:Ws},{tag:[i.meta,i.comment],color:Vs},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.heading,fontWeight:"bold",color:Fs},{tag:[i.atom,i.bool,i.special(i.variableName)],color:Zs},{tag:i.invalid,color:Rs},{tag:i.strikethrough,textDecoration:"line-through"}])}const Us={type:"block",name:"codeBlock",render:t=>{var e;const i=t.getEditor();if(!i)return;const s=I('<div class="lake-code-block" />'),o=t.getContainer();o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.CodeMirror;if(!a)return s.addClass("lake-code-block-error"),s.text("The code cannot be displayed because window.CodeMirror is not found. Please check if the CodeMirror file is added to this page."),void s.on("click",(()=>{i.selection.range.selectBox(t.node)}));const{EditorState:l,Compartment:h,EditorView:c,keymap:d,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:f,syntaxHighlighting:g,langItems:v}=a,w=new Map;for(const t of v)w.set(t.value,t);const y=t.value,x=w.get(y.lang),b=new h,k=c.updateListener.of((e=>{var n;e.docChanged&&(n=e.state.doc.toString(),window.setTimeout((()=>{i.isComposing||(t.updateValue("code",n),i.history.save())}),0))})),_=new c({parent:r,doc:null!==(e=y.code)&&void 0!==e?e:"",extensions:[l.readOnly.of(i.readonly),p(),d.of([...u,...m,f]),g(js(a)),b.of(x&&x.component?x.component():[]),k]});s.find('[contenteditable="true"]').attr("tabindex","-1");new _e({root:s,name:"langType",downIcon:n.get("down"),defaultValue:x?y.lang:Ms,tooltip:Ri.codeBlock.langType(),width:"auto",menuType:"list",menuItems:v.map((t=>({value:t.value,text:t.text}))),onSelect:e=>{const n=w.get(e);_.dispatch({effects:b.reconfigure(n&&n.component?n.component():[])}),t.updateValue({lang:e}),i.history.save()}}).render(),t.setData("codeEditor",_),t.useEffect((()=>()=>{_.destroy(),A("CodeMirror destroyed")}))}};const qs=Array.from(x).join(",");function Ks(t){const e=[t];for(const i of t.getWalker())e.push(i);for(const t of e)"div"===t.name?t.find(qs).length>0?t.remove(!0):$(t,"p"):(t.isHeading||["blockquote","li"].indexOf(t.name)>=0)&&t.find(qs).remove(!0)}function Gs(t,e){const i=t.selection,n=i.range;if(0===e.childNodes.length)return;const s=new T(e.firstChild);let o=new T(e.lastChild);0===n.getBlocks().length&&i.setBlocks("<p />"),function(t,e){const i=t.selection.range,n=i.startNode.closest("lake-box");if(n.length>0)if("inline"===new Qt(n).type)i.isBoxLeft?(i.setStartBefore(n),i.collapseToStart()):i.isBoxRight?(i.setStartAfter(n),i.collapseToStart()):t.removeBox();else{const e=I("<p />");i.isBoxLeft?(n.before(e),i.shrinkAfter(e)):i.isBoxRight?(n.after(e),i.shrinkAfter(e)):t.removeBox()}const s=i.startNode.closestBlock();if(e.isBlockBox){const i=new Qt(e),n=""!==e.attr("value")?i.value:void 0;return t.insertBox(i.name,n),void e.remove()}if(e.first().length>0&&Z(s),s.isEmpty&&"p"===s.name)return s.replaceWith(e),e.find("lake-box").each((t=>{new Qt(t).render()})),void i.shrinkAfter(e);let o=e.first();for(;o.length>0;){"li"===o.name&&(o=o.first());const e=o.next();t.selection.insertNode(o),o=e}e.remove()}(t,s);let r=new T(e.firstChild);for(;r.length>0;){const t=r.next();"br"===r.name&&r.remove(),r=t}if(o=new T(e.lastChild),e.childNodes.length>0){const t=i.splitBlock();t.left&&(n.setEndAfter(t.left),n.collapseToEnd()),t.right&&t.right.isEmpty&&t.right.remove(),i.insertFragment(e),n.shrinkAfter(o)}V(t.container.children().filter((t=>t.isBlock))),t.history.save()}function Xs(t){t.selection.setBlocks("<p />")}function Js(t){t.selection.setBlocks("<ol><li></li></ol>")}function Ys(t){t.selection.setBlocks("<ul><li></li></ul>")}function Qs(t,e){t.selection.setBlocks(`<ul type="checklist"><li value="${e}"></li></ul>`)}const to={start:"left",end:"right"};const eo="strong";const io="sub";const no="sup";const so="code";let oo=[];const ro="lake-format-painter";class ao{constructor(t){this.linkNode=null,this.event=new qt,this.root=t,this.container=I(a`
|
|
36
58
|
<div class="lake-link-popup">
|
|
37
|
-
<div class="lake-row"
|
|
59
|
+
<div class="lake-row">${Ri.link.url()}</div>
|
|
38
60
|
<div class="lake-row lake-url-row">
|
|
39
61
|
<input type="text" name="url" />
|
|
40
|
-
<button type="button" class="lake-button-copy" title="Copy link to clipboard"></button>
|
|
41
|
-
<button type="button" class="lake-button-open" title="Open link in new tab"></button>
|
|
42
62
|
</div>
|
|
43
|
-
<div class="lake-row"
|
|
63
|
+
<div class="lake-row">${Ri.link.title()}</div>
|
|
44
64
|
<div class="lake-row">
|
|
45
65
|
<input type="text" name="title" />
|
|
46
66
|
</div>
|
|
47
|
-
<div class="lake-row">
|
|
48
|
-
<button type="button" class="lake-button-save"><span>Save</span></button>
|
|
49
|
-
<button type="button" class="lake-button-unlink"><span>Remove link</span></button>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
`);const t=a.get("open");t&&this.root.find(".lake-button-open").append(t);const n=this.root.find(".lake-button-copy"),o=a.get("copy");o&&n.append(o);const i=a.get("checkCircle");i&&n.append(i);const s=a.get("warningCircle");s&&n.append(s);const r=a.get("check");r&&this.root.find(".lake-button-save").prepend(r);const l=a.get("unlink");l&&this.root.find(".lake-button-unlink").prepend(l),e.append(this.root),this.bindEvents()}writeClipboardText(e,t){return Pn(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(e)}catch(e){t()}}))}bindEvents(){let e=null;this.root.find(".lake-button-copy").on("click",(()=>{if(!this.linkNode)return;const t=this.getInputValue("url");this.writeClipboardText(t,(()=>{const e=this.root.find(".lake-button-copy svg");e.hide(),e.eq(2).show("inline")}));const n=this.root.find(".lake-button-copy svg");n.hide(),n.eq(1).show("inline"),e&&window.clearTimeout(e),e=window.setTimeout((()=>{n.hide(),n.eq(0).show("inline")}),2e3)})),this.root.find(".lake-button-open").on("click",(()=>{if(!this.linkNode)return;const e=this.getInputValue("url");window.open(e)})),this.root.find(".lake-button-save").on("click",(()=>{this.linkNode&&(this.save(),this.hide(),this.event.emit("save"))})),this.root.find(".lake-button-unlink").on("click",(()=>{this.linkNode&&(this.linkNode.remove(!0),this.hide(),this.event.emit("remove"))}))}getInputValue(e){return this.root.find(`input[name="${e}"]`).get(0).value}setInputValue(e,t){this.root.find(`input[name="${e}"]`).get(0).value=t}save(){if(!this.linkNode)return;const e=this.getInputValue("url");let t=this.getInputValue("title");""===t&&(t="Link"),this.linkNode.attr("href",e),this.linkNode.text(t)}updatePosition(){if(!this.linkNode)return;const e=this.linkNode.get(0).getBoundingClientRect(),t=e.x+window.scrollX,n=e.y+window.scrollY;t<0||n<0?this.hide():(e.x+this.root.width()>window.innerWidth?this.root.css("left",`${t-this.root.width()+e.width}px`):this.root.css("left",`${t}px`),e.y+e.height+this.root.height()>window.innerHeight?this.root.css("top",n-this.root.height()+"px"):this.root.css("top",`${n+e.height}px`))}show(e){this.linkNode=e;const t=e.attr("href"),n=e.text();this.setInputValue("url",t),this.setInputValue("title",n),this.root.css("visibility","hidden"),this.root.show(),this.updatePosition(),this.root.css("visibility","")}hide(){this.linkNode=null,this.root.hide()}}function lo(e,t){const n=e.selection.range,o=n.getRightText();if(e.selection.splitBlock(),t=n.getBlocks()[0])return""!==o||!t.isHeading&&"blockquote"!==t.name?void(t.isList&&"checklist"===t.attr("type")&&t.find("li").attr("value","false")):(e.selection.setBlocks("<p />"),void e.history.save());e.history.save()}function co(e){const t=e.selection.range,n=t.startNode.closest("lake-box"),o=n.closestBlock();if(o.length>0&&!o.isContainer)return void(t.isBoxLeft?(t.setStartBefore(n),t.collapseToStart(),lo(e,o)):t.isBoxRight?(t.setStartAfter(n),t.collapseToStart(),lo(e,o)):e.removeBox());const i=V("<p><br /></p>");t.isBoxLeft?n.before(i):t.isBoxRight?(n.after(i),t.shrinkAfter(i)):e.removeBox()}function ho(e){const t=e.selection.range,n=t.startNode.closestBlock();if(n.length>0&&!n.isContainer){const n=t.getPrevNode(),o=t.getRightText();if("br"!==n.name&&""===o)return e.selection.insertContents("<br /><br />"),void e.history.save()}e.selection.insertContents("<br />")}function uo(e){const t=e.selection.range,n=t.startNode.closest("lake-box"),o=n.closestBlock();if(o.length>0&&!o.isContainer)return void(t.isBoxLeft?(t.setStartBefore(n),t.collapseToStart(),ho(e)):t.isBoxRight?(t.setStartAfter(n),t.collapseToStart(),ho(e)):e.removeBox());const i=V("<p><br /></p>");t.isBoxLeft?n.before(i):t.isBoxRight?(n.after(i),t.shrinkAfter(i)):e.removeBox()}function fo(e,t){const n=e.selection.range;let o=t.prev();if(0===o.length)return void("p"!==t.name&&e.selection.setBlocks("<p />"));if(o.isBox)return t.isEmpty&&t.remove(),void n.selectBoxRight(o);if("br"===o.name)return void o.remove();if(!o.isBlock){const e=new $;e.selectNodeContents(o),gt(e,"<p />"),o=e.startNode.closestBlock()}if(o.isEmpty)return void o.remove();const i=e.selection.insertBookmark();R(o,t),e.selection.toBookmark(i),e.selection.fixList()}function po(e,t){const n=e.selection.range;let o=t.next();if(0===o.length)return void e.history.save();if(o.isBox)return t.isEmpty&&t.remove(),n.selectBoxLeft(o),void e.history.save();if(!o.isBlock){const e=new $;e.selectNodeContents(o),gt(e,"<p />"),o=o.closestBlock()}const i=e.selection.insertBookmark();R(t,o),e.selection.toBookmark(i),e.selection.fixList()}const go=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),mo=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],vo=[{re:/^#+$/,getParameters:e=>{var t;return["heading",null!==(t=go.get(e))&&void 0!==t?t:"h6"]}},{re:/^\d+\.$/,getParameters:()=>["list","numbered"]},{re:/^[*\-+]$/,getParameters:()=>["list","bulleted"]},{re:/^\[\s?\]$/,getParameters:()=>["list","checklist",!1]},{re:/^\[x\]$/i,getParameters:()=>["list","checklist",!0]},{re:/^>$/,getParameters:()=>["blockQuote"]}];function xo(e){const t=e.clone(!0);t.find("lake-bookmark").remove(),""===t.html()&&e.prepend("<br />")}return En.box.add({type:"block",name:"hr",render:e=>{const t=e.getEditor();if(t)return e.useEffect((()=>{e.getContainer().find(".lake-hr").on("click",(()=>{t.selection.range.selectBox(e.node)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),En.box.add(_n),En.box.add(Wn),En.plugin.add((e=>{e.container.on("copy",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.startNode.closest("lake-box");if(0===o.length)return;if(n.isBoxLeft||n.isBoxRight)return;t.preventDefault();const i=t.clipboardData;if(!i)return;const s=new nt(o).getHTML();i.setData("text/html",s)}))})),En.plugin.add((e=>{e.container.on("cut",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.startNode.closest("lake-box");if(0===o.length)return;if(n.isBoxLeft||n.isBoxRight)return;t.preventDefault();const i=t.clipboardData;if(!i)return;const s=new nt(o).getHTML();i.setData("text/html",s),e.removeBox(),e.history.save()}))})),En.plugin.add((e=>{const{imageRequestTypes:t}=e.config;e.container.on("paste",(n=>{if(e.selection.range.isInsideBox)return;n.preventDefault();const o=n.clipboardData;if(!o)return;if(e.selection.deleteContents(),o.files.length>0){for(const n of o.files)t.indexOf(n.type)>=0&&Rn({editor:e,file:n});return}const i=o.types;if(1===i.length&&"text/plain"===i[0]){const t=o.getData("text/plain"),n=new rt(t).getFragment();return e.event.emit("beforepaste",n),void Xn(e,n)}const s=v(o.getData("text/html")),r=function(){const e=it();return e.div=e.p,k(e,((e,t)=>{delete t.id,delete t.class})),e}(),a=new st(s,r).getFragment();e.event.emit("beforepaste",a),function(e){let t=new L(e.firstChild);for(;t.length>0;){const e=t.next();t.isBlock&&Jn(t),t=e}let n=[];for(t=new L(e.firstChild);t.length>0;){const e=t.next();t.isMark||t.isText||t.isBookmark||t.isInlineBox?n.push(t):(j(n),n=[]),t=e}j(n)}(a),Xn(e,a),e.box.renderAll(e)}))})),En.plugin.add((e=>{e.command.add("undo",(()=>{e.history.undo()})),e.keystroke.setKeydown("mod+z",(t=>{e.selection.range.isInsideBox||(t.preventDefault(),e.command.execute("undo"))}))})),En.plugin.add((e=>{e.command.add("redo",(()=>{e.history.redo()})),e.keystroke.setKeydown("mod+y",(t=>{e.selection.range.isInsideBox||(t.preventDefault(),e.command.execute("redo"))}))})),En.plugin.add((e=>{e.command.add("selectAll",(()=>{const t=e.selection.range;t.selectNodeContents(e.container),t.shrink()}))})),En.plugin.add((e=>{e.command.add("heading",(t=>{e.selection.setBlocks(`<${t} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("blockQuote",(()=>{e.selection.setBlocks("<blockquote />"),e.history.save()}))})),En.plugin.add((e=>{e.command.add("list",((t,n=!1)=>{const o=e.selection.range.getBlocks();let i=!1,s=!1,r=!1;for(const e of o)i||"ol"!==e.name||(i=!0),s||"ul"!==e.name||e.hasAttr("type")||(s=!0),r||"ul"!==e.name||"checklist"!==e.attr("type")||(r=!0);i?("numbered"===t&&Gn(e),"bulleted"===t&&Yn(e),"checklist"===t&&eo(e,n)):s?("numbered"===t&&Qn(e),"bulleted"===t&&Gn(e),"checklist"===t&&eo(e,n)):r?("numbered"===t&&Qn(e),"bulleted"===t&&Yn(e),"checklist"===t&&Gn(e)):("numbered"===t&&Qn(e),"bulleted"===t&&Yn(e),"checklist"===t&&eo(e,n)),e.history.save()})),e.container.on("click",(t=>{const n=t;if(e.readonly)return;if(!n.target)return;const o=V(n.target);"li"===o.name&&""!==o.attr("value")&&n.offsetX<=18&&(o.attr("value",("true"!==o.attr("value")).toString()),e.history.save())}))})),En.plugin.add((e=>{e.command.add("align",(t=>{e.selection.setBlocks({"text-align":t}),e.history.save()}))})),En.plugin.add((e=>{e.command.add("indent",(t=>{const n=e.selection.range.getBlocks();for(const e of n)U(e,t);e.history.save()}))})),En.plugin.add((e=>{e.command.add("bold",(()=>{e.selection.getAppliedItems().find((e=>e.name===to))?e.selection.removeMark(`<${to} />`):e.selection.addMark(`<${to} />`),e.history.save()})),e.keystroke.setKeydown("mod+b",(t=>{t.preventDefault(),e.command.execute("bold")}))})),En.plugin.add((e=>{e.command.add("italic",(()=>{e.selection.getAppliedItems().find((e=>"i"===e.name))?e.selection.removeMark("<i />"):e.selection.addMark("<i />"),e.history.save()})),e.keystroke.setKeydown("mod+i",(t=>{t.preventDefault(),e.command.execute("italic")}))})),En.plugin.add((e=>{e.command.add("underline",(()=>{e.selection.getAppliedItems().find((e=>"u"===e.name))?e.selection.removeMark("<u />"):e.selection.addMark("<u />"),e.history.save()})),e.keystroke.setKeydown("mod+u",(t=>{t.preventDefault(),e.command.execute("underline")}))})),En.plugin.add((e=>{e.command.add("strikethrough",(()=>{e.selection.getAppliedItems().find((e=>"s"===e.name))?e.selection.removeMark("<s />"):e.selection.addMark("<s />"),e.history.save()})),e.keystroke.setKeydown("mod+shift+x",(t=>{t.preventDefault(),e.command.execute("strikethrough")}))})),En.plugin.add((e=>{e.command.add("subscript",(()=>{e.selection.getAppliedItems().find((e=>e.name===no))?e.selection.removeMark(`<${no} />`):e.selection.addMark(`<${no} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("superscript",(()=>{e.selection.getAppliedItems().find((e=>e.name===oo))?e.selection.removeMark(`<${oo} />`):e.selection.addMark(`<${oo} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("code",(()=>{e.selection.getAppliedItems().find((e=>e.name===io))?e.selection.removeMark(`<${io} />`):e.selection.addMark(`<${io} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontFamily",(t=>{e.selection.addMark(`<span style="font-family: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontSize",(t=>{e.selection.addMark(`<span style="font-size: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontColor",(t=>{e.selection.addMark(`<span style="color: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("highlight",(t=>{e.selection.addMark(`<span style="background-color: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("removeFormat",(()=>{e.selection.removeMark(),e.history.save()}))})),En.plugin.add((e=>{e.command.add("formatPainter",(()=>{e.container.addClass(ro);const t=e.selection.getAppliedItems();for(const e of t){const t=e.node.clone();t.isMark&&"a"!==t.name&&so.push(t)}})),e.container.on("click",(()=>{if(e.container.removeClass(ro),0!==so.length){for(const t of so)e.selection.addMark(t);so=[],e.history.save()}})),e.event.on("click",(t=>{if(t.isInside)return;const n=t.closest(".lake-toolbar-button");n.length>0&&"formatPainter"===n.attr("name")||(e.container.removeClass(ro),so=[])}))})),En.plugin.add((e=>{let t;const n=n=>{t||(t=new ao(e.popupContainer),t.event.on("save",(()=>{e.history.save()})),t.event.on("remove",(()=>{e.history.save()}))),t.show(n)};e.root.on("scroll",(()=>{t&&t.updatePosition()})),e.event.on("resize",(()=>{t&&t.updatePosition()})),e.event.on("click",(e=>{if(e.isOutside)return;if(e.closest("lake-box").length>0)return;const o=e.closest("a");0!==o.length?n(o):t&&t.hide()})),e.command.add("link",(()=>{const t=e.selection.insertLink('<a href="">New link</a>');t&&(e.history.save(),n(t))}))})),En.plugin.add((e=>{e.event.on("beforepaste",(e=>{new ve(e).find("hr").each((e=>{const t=V(e),n=new nt("hr");t.replaceWith(n.node)}))})),e.command.add("hr",(()=>{e.insertBox("hr"),e.history.save()}))})),En.plugin.add((e=>{e.event.on("beforepaste",(e=>{new ve(e).find("img").each((e=>{const t=V(e),n=new nt("image"),o=t.attr("data-lake-value");""===o?n.value={url:t.attr("src"),status:"done"}:n.node.attr("value",o),t.replaceWith(n.node)}))})),e.command.add("image",(t=>{e.insertBox("image",t),e.history.save()}))})),En.plugin.add((e=>{e.command.add("codeBlock",(()=>{const t=e.insertBox("codeBlock");if(!t)return;e.history.save();t.getData("codeEditor").focus()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("enter",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(t.preventDefault(),n.isBox)return co(e),void e.history.save();if(n.adapt(),n.isInoperative)return;if(n.isBox)return co(e),void e.history.save();let o=n.getBlocks()[0];if(o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),o.isEmpty&&"p"!==o.name)return e.selection.setBlocks("<p />"),void e.history.save();lo(e,o),e.history.save()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("shift+enter",(t=>{const n=e.selection.range;if(!n.isInsideBox){if(t.preventDefault(),n.isBox)return uo(e),void e.history.save();if(n.adapt(),!n.isInoperative){if(n.isBox)return uo(e),void e.history.save();ho(e),e.history.save()}}}))})),En.plugin.add((e=>{e.keystroke.setKeydown("backspace",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(n.isBoxLeft){const o=n.startNode.closest("lake-box"),i=o.prev();if(0===i.length){const n=o.closestBlock();return void(n.length>0&&!n.isContainer&&(t.preventDefault(),fo(e,n),e.history.save()))}if(i.isBlock)return i.isEmpty?(t.preventDefault(),i.remove(),e.selection.fixList(),void e.history.save()):(t.preventDefault(),void n.shrinkAfter(i));n.adaptBox()}if(n.isBox)return t.preventDefault(),e.removeBox(),void e.history.save();if(!n.isCollapsed)return t.preventDefault(),e.selection.deleteContents(),""===e.container.html().trim()&&e.setValue("<p><br /><focus /></p>"),void e.history.save();n.adapt();const o=n.getPrevNode();if(o.isBox)return t.preventDefault(),n.selectBox(o),e.removeBox(),void e.history.save();if(""===n.getLeftText()){t.preventDefault();let o=n.getBlocks()[0];return o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),""!==o.css("margin-left")||""!==o.css("text-indent")||""!==o.attr("indent")?(U(o,"decrease"),void e.history.save()):o.isList||"blockquote"===o.name?(e.selection.setBlocks("<p />"),void e.history.save()):(fo(e,o),void e.history.save())}"br"===o.name&&(t.preventDefault(),n.setStartBefore(o),n.collapseToStart(),o.remove(),e.history.save())}))})),En.plugin.add((e=>{e.keystroke.setKeydown("delete",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(n.isBoxRight){const o=n.startNode.closest("lake-box"),i=o.next();if(0===i.length){const n=o.closestBlock();return void(n.length>0&&!n.isContainer&&(t.preventDefault(),po(e,n),e.history.save()))}if(i.isBlock)return i.isEmpty?(t.preventDefault(),i.remove(),e.selection.fixList(),void e.history.save()):(t.preventDefault(),void n.shrinkBefore(i));n.adaptBox()}if(n.isBox)return t.preventDefault(),e.removeBox(),void e.history.save();if(!n.isCollapsed)return t.preventDefault(),e.selection.deleteContents(),""===e.container.html().trim()&&e.setValue("<p><br /><focus /></p>"),void e.history.save();n.adapt();const o=n.getNextNode();if(o.isBox)return t.preventDefault(),n.selectBox(o),e.removeBox(),void e.history.save();if(""===n.getRightText()){t.preventDefault();let o=n.getBlocks()[0];return o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),po(e,o),void e.history.save()}"br"===o.name&&(t.preventDefault(),n.setStartBefore(o),n.collapseToStart(),o.remove(),e.history.save())}))})),En.plugin.add((e=>{e.keystroke.setKeydown("tab",(t=>{t.preventDefault();e.selection.range.getBlocks().forEach((e=>{"p"===e.name&&"2em"!==e.css("text-indent")?e.css("text-indent","2em"):U(e,"increase")})),e.history.save()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("arrow-left",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(n.isBoxLeft){const e=o.prev();return e.isBlock||e.isBox?(t.preventDefault(),e.isInlineBox?void n.selectBox(e):void n.shrinkAfter(e)):(n.setStartBefore(o),void n.collapseToStart())}return n.isBoxRight?(t.preventDefault(),void n.selectBox(o)):(t.preventDefault(),void n.selectBoxLeft(o))}if(!n.isCollapsed)return;const i=n.getPrevNode();i.isBox&&(t.preventDefault(),n.selectBox(i))})),e.keystroke.setKeydown("arrow-right",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(n.isBoxLeft)return t.preventDefault(),void n.selectBox(o);if(n.isBoxRight){const e=o.next();return e.isBlock||e.isBox?(t.preventDefault(),e.isInlineBox?void n.selectBox(e):void n.shrinkBefore(e)):(n.setStartAfter(o),void n.collapseToStart())}return t.preventDefault(),void n.selectBoxRight(o)}if(!n.isCollapsed)return;const i=n.getNextNode();i.isBox&&(t.preventDefault(),n.selectBox(i))})),e.keystroke.setKeydown("arrow-up",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(o.isBlockBox){const e=o.prev();if(e.isBlock||e.isBox)return t.preventDefault(),void n.shrinkAfter(e)}n.setStartBefore(o),n.collapseToStart()}})),e.keystroke.setKeydown("arrow-down",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(o.isBlockBox){const e=o.next();if(e.isBlock||e.isBox)return t.preventDefault(),void n.shrinkBefore(e)}n.setStartAfter(o),n.collapseToStart()}}))})),En.plugin.add((e=>{e.keystroke.setKeydown("space",(t=>{const n=e.selection,o=function(e){const t=e.selection.range;let n=t.startNode,o=t.startOffset;if(0!==o){if(n.isElement){const e=n.children()[o-1];if(!e||!e.isText)return;n=e,o=n.text().length}if(!(o<1))return{node:n,offset:o}}}(e);if(!o)return;if(function(e,t){const n=e.selection,o=n.range,i=t.offset,s=t.node.text().slice(0,i);for(const t of mo){const r=t.re.exec(s);if(null!==r){e.prepareOperation();const s=n.insertBookmark(),a=s.focus.prev(),l=a.text(),c=`${l.replace(t.re,"$1")}`;a.get(0).nodeValue=c,o.setStart(a,i-r[0].length),o.setEnd(a,i-(l.length-c.length)-1);const d=t.getParameters();return e.command.execute(d.shift(),...d),n.toBookmark(s),e.commitOperation(),!0}}return!1}(e,o))return void t.preventDefault();const i=n.range.getBlocks()[0];i&&!i.isHeading&&"p"!==i.name||function(e,t){const n=e.selection,o=t.offset;let i=t.node.text().slice(0,o);i=i.replace(/[\u200B\u2060]/g,"");for(const t of vo)if(t.re.test(i)){e.prepareOperation();const o=n.insertBookmark();o.focus.prev().remove();const s=o.focus.closestBlock();xo(s),n.range.shrinkAfter(s);const r=t.getParameters(i);return e.command.execute(r.shift(),...r),n.toBookmark(o),e.commitOperation(),!0}return!1}(e,o)&&t.preventDefault()}))})),e.Box=nt,e.Editor=En,e.Fragment=ve,e.HTMLParser=st,e.Nodes=L,e.Range=$,e.TextParser=rt,e.Toolbar=class{constructor(e){this.items=e.items||zn,this.editor=e.editor,this.root=V(e.root),this.container=V('<div class="lake-toolbar" />'),this.event=new Xe,this.root.addClass("lake-custom-properties")}getValue(e){const t=e.attr("value");return""===t?[]:JSON.parse(_e(t))}setValue(e,t){e.attr("value",Ue(JSON.stringify(t)))}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(e){const t=this.editor,n=V('<button type="button" class="lake-toolbar-button" />');n.attr("name",e.name),n.attr("title",e.tooltip),e.icon&&n.append(e.icon),this.container.append(n),n.on("mouseenter",(()=>{n.attr("disabled")||n.addClass("lake-toolbar-button-hovered")})),n.on("mouseleave",(()=>{n.attr("disabled")||n.removeClass("lake-toolbar-button-hovered")})),n.on("click",(n=>{n.preventDefault(),t.focus(),e.onClick(t,e.name)}))}getMenuMap(e){const t=new Map;if(!e.menuItems)return t;for(const n of e.menuItems){const e=n.text.replace(/<[^>]*>/g,"");t.set(n.value,e)}return t}updateColorAccent(e,t){const n=e.find(".lake-dropdown-icon svg").eq(1),o=n.find("line");o.length>0?o.attr("stroke",t):n.find("path").attr("fill",t)}addDropdownMenu(e,t){for(const n of t.menuItems){const o=V(l`
|
|
53
|
-
<li value="${n.value}">
|
|
54
|
-
<div class="lake-dropdown-menu-text">${n.text}</div>
|
|
55
|
-
</li>
|
|
56
|
-
`);if(e.append(o),"color"===t.menuType&&(o.attr("title",n.text),o.find(".lake-dropdown-menu-text").css("background-color",n.value)),n.icon){const e=V('<div class="lake-dropdown-menu-icon"></div>');e.append(n.icon),o.prepend(e)}const i=a.get("check");if(i){const e=V('<div class="lake-dropdown-menu-check"></div>');e.append(i),o.prepend(e)}}}bindDropdownEvents(e,t){const n=this.editor,o=e.find(".lake-dropdown-title"),i=o.find(".lake-dropdown-text"),s=o.find(".lake-dropdown-icon"),r=o.find(".lake-dropdown-down-icon"),a=e.find(".lake-dropdown-menu");"color"===t.menuType?(s.on("mouseenter",(()=>{e.attr("disabled")||s.addClass("lake-dropdown-icon-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-dropdown-icon-hovered")})),r.on("mouseenter",(()=>{e.attr("disabled")||r.addClass("lake-dropdown-down-icon-hovered")})),r.on("mouseleave",(()=>{r.removeClass("lake-dropdown-down-icon-hovered")}))):(o.on("mouseenter",(()=>{e.attr("disabled")||o.addClass("lake-dropdown-title-hovered")})),o.on("mouseleave",(()=>{o.removeClass("lake-dropdown-title-hovered")}))),"color"===t.menuType&&s.on("click",(o=>{if(o.preventDefault(),e.attr("disabled"))return;n.focus();const i=e.attr("color")||t.defaultValue;t.onSelect(n,i)}));("color"===t.menuType&&r?r:o).on("click",(n=>{if(n.preventDefault(),e.attr("disabled"))return;const o=this.getValue(e);a.find(".lake-dropdown-menu-check").css("visibility","hidden"),a.find("li").each((e=>{const t=V(e);o.indexOf(t.attr("value"))>=0&&t.find(".lake-dropdown-menu-check").css("visibility","visible")})),a.css("visibility","hidden"),a.show("color"===t.menuType?"flex":"block");e.get(0).getBoundingClientRect().x+a.width()>window.innerWidth?(a.css("left","auto"),a.css("right","0")):(a.css("left",""),a.css("right","")),a.css("visibility","")})),a.on("click",(s=>{s.preventDefault(),n.focus();const r=V(s.target).closest("li"),a=r.attr("value");i.length>0&&i.text(r.text()),"color"===t.menuType&&""!==a&&(e.attr("color",a),this.updateColorAccent(o,a)),t.onSelect(n,a)})),n.event.on("click",(e=>{e.closest(".lake-dropdown-title").get(0)!==o.get(0)&&a.hide()}))}appendDropdown(e){var t;const n=this.getMenuMap(e),o=e.icon?V(h`
|
|
57
|
-
<div class="lake-dropdown">
|
|
58
|
-
<button type="button" class="lake-dropdown-title">
|
|
59
|
-
<div class="lake-dropdown-icon"></div>
|
|
60
|
-
<div class="lake-dropdown-down-icon"></div>
|
|
61
|
-
</button>
|
|
62
|
-
</div>
|
|
63
|
-
`):V(h`
|
|
64
|
-
<div class="lake-dropdown">
|
|
65
|
-
<button type="button" class="lake-dropdown-title">
|
|
66
|
-
<div class="lake-dropdown-text"></div>
|
|
67
|
-
<div class="lake-dropdown-down-icon"></div>
|
|
68
|
-
</button>
|
|
67
|
+
<div class="lake-row lake-button-row"></div>
|
|
69
68
|
</div>
|
|
70
|
-
`);o.attr("name",e.name),o.addClass(`lake-dropdown-${e.menuType}`);const i=o.find(".lake-dropdown-title");e.downIcon||i.addClass("lake-dropdown-title-no-down"),i.css("width",e.width),i.attr("title",e.tooltip);const s=i.find(".lake-dropdown-text"),r=i.find(".lake-dropdown-icon");e.icon&&r.append(e.icon),e.accentIcon&&r.append(e.accentIcon);const a=i.find(".lake-dropdown-down-icon");e.downIcon&&a.append(e.downIcon);const l=V('<ul class="lake-dropdown-menu" />');l.addClass(`lake-dropdown-${e.menuType}-menu`),s.length>0&&s.text(null!==(t=n.get(e.defaultValue))&&void 0!==t?t:e.defaultValue),"color"===e.menuType&&this.updateColorAccent(i,e.defaultValue),this.addDropdownMenu(l,e),o.append(i),o.append(l),this.container.append(o),this.bindDropdownEvents(o,e)}appendUpload(e){const t=this.editor,n=V(h`
|
|
71
|
-
<div class="lake-upload">
|
|
69
|
+
`)}writeClipboardText(t){return nn(this,void 0,void 0,(function*(){let e=!1;try{window.LAKE_TEST?e=window.LAKE_ERROR:yield navigator.clipboard.writeText(t)}catch(t){e=!0}return new Promise((t=>{t(e)}))}))}appendCopyButton(){let t=null;const e=new ke({root:this.container.find(".lake-url-row"),name:"copy",icon:n.get("copy"),tooltip:Ri.link.copy(),onClick:()=>{if(!this.linkNode)return;const e=this.getInputValue("url");this.writeClipboardText(e).then((e=>{const i=this.container.find('button[name="copy"] svg');if(i.hide(),e)return i.eq(2).show("inline"),void this.event.emit("copy",e);i.eq(1).show("inline"),this.event.emit("copy",e),t&&window.clearTimeout(t),t=window.setTimeout((()=>{i.hide(),i.eq(0).show("inline")}),2e3)}))}});e.render();const i=n.get("checkCircle");i&&e.node.append(i);const s=n.get("warningCircle");s&&e.node.append(s)}appendOpenButton(){new ke({root:this.container.find(".lake-url-row"),name:"open",icon:n.get("open"),tooltip:Ri.link.open(),onClick:()=>{if(!this.linkNode)return;const t=this.getInputValue("url");window.open(t)}}).render()}appendSaveButton(){new ke({root:this.container.find(".lake-button-row"),name:"save",icon:n.get("check"),text:Ri.link.save(),onClick:()=>{this.linkNode&&(this.save(),this.hide(),this.event.emit("save"))}}).render()}appendUnlinkButton(){new ke({root:this.container.find(".lake-button-row"),name:"unlink",icon:n.get("unlink"),text:Ri.link.unlink(),onClick:()=>{this.linkNode&&(this.linkNode.remove(!0),this.hide(),this.event.emit("remove"))}}).render()}getInputValue(t){return this.container.find(`input[name="${t}"]`).get(0).value}setInputValue(t,e){this.container.find(`input[name="${t}"]`).get(0).value=e}save(){if(!this.linkNode)return;const t=this.getInputValue("url");let e=this.getInputValue("title");""!==t||""!==e?(""===e&&(e=t),this.linkNode.attr("href",t),this.linkNode.text(e)):this.linkNode.remove()}updatePosition(){if(!this.linkNode)return;const t=this.linkNode.get(0).getBoundingClientRect(),e=t.x+window.scrollX,i=t.y+window.scrollY;e<0||i<0?this.hide():(t.x+this.container.width()>window.innerWidth?this.container.css("left",`${e-this.container.width()+t.width}px`):this.container.css("left",`${e}px`),t.y+t.height+this.container.height()>window.innerHeight?this.container.css("top",i-this.container.height()+"px"):this.container.css("top",`${i+t.height}px`))}render(){this.appendCopyButton(),this.appendOpenButton(),this.appendSaveButton(),this.appendUnlinkButton(),this.root.append(this.container)}show(t){if(0===this.root.find(".lake-link-popup").length&&this.render(),this.linkNode&&this.linkNode.get(0)===t.get(0))return;this.linkNode=t;const e=t.attr("href"),i=t.text();this.setInputValue("url",e),i!==e&&this.setInputValue("title",i),this.container.css("visibility","hidden"),this.container.show(),this.updatePosition(),this.container.css("visibility",""),this.container.find('input[name="url"]').focus()}hide(){this.linkNode=null,this.container.hide()}}const lo=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),ho=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],co=[{re:/^#+$/,getParameters:t=>{var e;return["heading",null!==(e=lo.get(t[0]))&&void 0!==e?e:"h6"]}},{re:/^\d+\.$/,getParameters:()=>["list","numbered"]},{re:/^[*\-+]$/,getParameters:()=>["list","bulleted"]},{re:/^\[\s?\]$/,getParameters:()=>["list","checklist",!1]},{re:/^\[x\]$/i,getParameters:()=>["list","checklist",!0]},{re:/^>$/,getParameters:()=>["blockQuote"]}],po=[{re:/^-+$/,getParameters:()=>["hr"]},{re:/^`+([a-z]*)$/i,getParameters:t=>t[1]?["codeBlock",{lang:t[1]}]:["codeBlock"]}];function uo(t){const e=t.clone(!0);e.find("lake-bookmark").remove(),""===e.html()&&t.prepend("<br />")}function mo(t,e){const i=t.selection.range,n=i.getRightText();if(t.selection.splitBlock(),e=i.getBlocks()[0])return""!==n||!e.isHeading&&"blockquote"!==e.name?void(e.isList&&"checklist"===e.attr("type")&&e.find("li").attr("value","false")):(t.selection.setBlocks("<p />"),void t.history.save());t.history.save()}function fo(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxLeft?(e.setStartBefore(i),e.collapseToStart(),mo(t,n)):e.isBoxRight?(e.setStartAfter(i),e.collapseToStart(),mo(t,n)):t.removeBox());const s=I("<p><br /></p>");e.isBoxLeft?i.before(s):e.isBoxRight?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function go(t){const e=t.selection.range,i=e.startNode.closestBlock();if(i.length>0&&!i.isContainer){const i=e.getPrevNode(),n=e.getRightText();if("br"!==i.name&&""===n)return t.selection.insertContents("<br /><br />"),void t.history.save()}t.selection.insertNode(I("<br />"))}function vo(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxLeft?(e.setStartBefore(i),e.collapseToStart(),go(t)):e.isBoxRight?(e.setStartAfter(i),e.collapseToStart(),go(t)):t.removeBox());const s=I("<p><br /></p>");e.isBoxLeft?i.before(s):e.isBoxRight?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function wo(t,e){const i=t.selection.range;let n=e.prev();if(0===n.length)return void("p"!==e.name&&t.selection.setBlocks("<p />"));if(n.isBox)return e.isEmpty&&e.remove(),void i.selectBoxRight(n);if("br"===n.name)return void n.remove();if(!n.isBlock){const t=new E;t.selectNodeContents(n),pe(t,"<p />"),n=t.startNode.closestBlock()}if(n.isEmpty)return void n.remove();const s=t.selection.insertBookmark();N(n,e),t.selection.toBookmark(s),t.selection.fixList()}function yo(t,e){const i=t.selection.range;let n=e.next();if(0===n.length)return void t.history.save();if(n.isBox)return e.isEmpty&&e.remove(),i.selectBoxLeft(n),void t.history.save();if(!n.isBlock){const t=new E;t.selectNodeContents(n),pe(t,"<p />"),n=n.closestBlock()}const s=t.selection.insertBookmark();N(e,n),t.selection.toBookmark(s),t.selection.fixList()}return Bi.box.add({type:"block",name:"hr",render:t=>{const e=t.getEditor();if(e)return t.useEffect((()=>{t.getContainer().find(".lake-hr").on("click",(()=>{e.selection.range.selectBox(t.node)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),Bi.box.add(Es),Bi.box.add(Us),Bi.plugin.add((t=>{t.container.on("copy",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxLeft||i.isBoxRight)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o)}))})),Bi.plugin.add((t=>{t.container.on("cut",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.startNode.closest("lake-box");if(0===n.length)return;if(i.isBoxLeft||i.isBoxRight)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=new Qt(n).getHTML();s.setData("text/html",o),t.removeBox(),t.history.save()}))})),Bi.plugin.add((t=>{const{imageRequestTypes:e}=t.config;t.container.on("paste",(i=>{if(t.selection.range.isInsideBox)return;i.preventDefault();const n=i.clipboardData;if(!n)return;if(t.selection.deleteContents(),n.files.length>0){for(const i of n.files)e.indexOf(i.type)>=0&&Qi({editor:t,file:i});return}const s=n.types;if(1===s.length&&"text/plain"===s[0]){const e=n.getData("text/plain"),i=new ne(e).getFragment();return t.event.emit("beforepaste",i),void Gs(t,i)}const o=u(n.getData("text/html")),r=function(){const t=ee();return t.div=t.p,g(t,((t,e)=>{delete e.id,delete e.class})),t}(),a=new ie(o,r).getFragment();t.event.emit("beforepaste",a),function(t){let e=new T(t.firstChild);for(;e.length>0;){const t=e.next();e.isBlock&&Ks(e),e=t}let i=[];for(e=new T(t.firstChild);e.length>0;){const t=e.next();e.isMark||e.isText||e.isBookmark||e.isInlineBox?i.push(e):(H(i),i=[]),e=t}H(i)}(a),Gs(t,a),t.box.renderAll(t)}))})),Bi.plugin.add((t=>{t.command.add("undo",{execute:()=>{t.history.undo()}}),t.keystroke.setKeydown("mod+z",(e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("undo"))}))})),Bi.plugin.add((t=>{t.command.add("redo",{execute:()=>{t.history.redo()}});const e=e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("redo"))};t.keystroke.setKeydown("mod+y",e),t.keystroke.setKeydown("mod+shift+z",e)})),Bi.plugin.add((t=>{t.command.add("selectAll",{execute:()=>{const e=t.selection.range;e.selectNodeContents(t.container),e.shrink()}})})),Bi.plugin.add((t=>{t.command.add("heading",{selectedValues:t=>{const e=t.find((t=>t.node.isHeading||"p"===t.name));return e?[e.name]:[]},execute:e=>{t.selection.setBlocks(`<${e} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("blockQuote",{isSelected:t=>!!t.find((t=>"blockquote"===t.name)),execute:()=>{t.selection.setBlocks("<blockquote />"),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("list",{selectedValues:t=>{let e;for(const i of t){if("ol"===i.name){e="numbered";break}if("ul"===i.name&&!i.node.hasAttr("type")){e="bulleted";break}if("ul"===i.name&&"checklist"===i.node.attr("type")){e="checklist";break}}return e?[e]:[]},execute:(e,i=!1)=>{const n=t.selection.range.getBlocks();let s=!1,o=!1,r=!1;for(const t of n)s||"ol"!==t.name||(s=!0),o||"ul"!==t.name||t.hasAttr("type")||(o=!0),r||"ul"!==t.name||"checklist"!==t.attr("type")||(r=!0);s?("numbered"===e&&Xs(t),"bulleted"===e&&Ys(t),"checklist"===e&&Qs(t,i)):o?("numbered"===e&&Js(t),"bulleted"===e&&Xs(t),"checklist"===e&&Qs(t,i)):r?("numbered"===e&&Js(t),"bulleted"===e&&Ys(t),"checklist"===e&&Xs(t)):("numbered"===e&&Js(t),"bulleted"===e&&Ys(t),"checklist"===e&&Qs(t,i)),t.history.save()}}),t.container.on("click",(e=>{const i=e;if(!i.target)return;const n=I(i.target);"li"===n.name&&""!==n.attr("value")&&i.offsetX<=18&&(n.attr("value",("true"!==n.attr("value")).toString()),t.history.save())}))})),Bi.plugin.add((t=>{t.command.add("align",{selectedValues:t=>{let e;for(const i of t)if(i.node.isBlock){e=i.node.computedCSS("text-align");break}return e?[to[e]||e]:[]},execute:e=>{t.selection.setBlocks({"text-align":e}),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("indent",{execute:e=>{const i=t.selection.range.getBlocks();for(const t of i)F(t,e);t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("bold",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),isSelected:t=>!!t.find((t=>t.name===eo)),execute:()=>{t.command.isSelected("bold")?t.selection.removeMark(`<${eo} />`):t.selection.addMark(`<${eo} />`),t.history.save()}}),t.keystroke.setKeydown("mod+b",(e=>{e.preventDefault(),t.command.execute("bold")}))})),Bi.plugin.add((t=>{t.command.add("italic",{isSelected:t=>!!t.find((t=>"i"===t.name)),execute:()=>{t.command.isSelected("italic")?t.selection.removeMark("<i />"):t.selection.addMark("<i />"),t.history.save()}}),t.keystroke.setKeydown("mod+i",(e=>{e.preventDefault(),t.command.execute("italic")}))})),Bi.plugin.add((t=>{t.command.add("underline",{isSelected:t=>!!t.find((t=>"u"===t.name)),execute:()=>{t.command.isSelected("underline")?t.selection.removeMark("<u />"):t.selection.addMark("<u />"),t.history.save()}}),t.keystroke.setKeydown("mod+u",(e=>{e.preventDefault(),t.command.execute("underline")}))})),Bi.plugin.add((t=>{t.command.add("strikethrough",{isSelected:t=>!!t.find((t=>"s"===t.name)),execute:()=>{t.command.isSelected("strikethrough")?t.selection.removeMark("<s />"):t.selection.addMark("<s />"),t.history.save()}}),t.keystroke.setKeydown("mod+shift+x",(e=>{e.preventDefault(),t.command.execute("strikethrough")}))})),Bi.plugin.add((t=>{t.command.add("subscript",{isSelected:t=>!!t.find((t=>t.name===io)),execute:()=>{t.command.isSelected("subscript")?t.selection.removeMark(`<${io} />`):t.selection.addMark(`<${io} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("superscript",{isSelected:t=>!!t.find((t=>t.name===no)),execute:()=>{t.command.isSelected("superscript")?t.selection.removeMark(`<${no} />`):t.selection.addMark(`<${no} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("code",{isSelected:t=>!!t.find((t=>t.name===so)),execute:()=>{t.command.isSelected("code")?t.selection.removeMark(`<${so} />`):t.selection.addMark(`<${so} />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontFamily",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-family").replace(/['"]/g,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-family: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontSize",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),selectedValues:t=>{for(const e of t)if("span"===e.name){return[e.node.css("font-size").replace(/\.\d+/,"")]}return[]},execute:e=>{t.selection.addMark(`<span style="font-size: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("fontColor",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="color: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("highlight",{selectedValues:t=>{for(const e of t)if("span"===e.name){return[d(e.node.computedCSS("background-color"))]}return[]},execute:e=>{t.selection.addMark(`<span style="background-color: ${e};" />`),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("removeFormat",{execute:()=>{t.selection.removeMark(),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("formatPainter",{execute:()=>{t.container.addClass(ro);const e=t.selection.getAppliedItems();for(const t of e){const e=t.node.clone();e.isMark&&"a"!==e.name&&oo.push(e)}}}),t.container.on("click",(()=>{if(t.container.removeClass(ro),0!==oo.length){for(const e of oo)t.selection.addMark(e);oo=[],t.history.save()}})),t.event.on("click",(e=>{if(e.isInside)return;e.closest('button[name="formatPainter"]').length>0||(t.container.removeClass(ro),oo=[])}))})),Bi.plugin.add((t=>{const e=new ao(t.popupContainer);e.event.on("save",(()=>{t.history.save()})),e.event.on("remove",(()=>{t.history.save()})),t.root.on("scroll",(()=>{e.updatePosition()})),t.event.on("resize",(()=>{e.updatePosition()})),t.event.on("click",(t=>{if(t.closest('button[name="link"]').length>0)return;const i=t.closest("a");0!==i.length?i.isOutside||i.closest("lake-box").length>0||e.show(i):e.hide()})),t.command.add("link",{execute:()=>{const i=t.selection.insertLink(`<a href="">${Ri.link.newLink()}</a>`);i&&(t.history.save(),e.show(i))}})})),Bi.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("hr").each((t=>{const e=I(t),i=new Qt("hr");e.replaceWith(i.node)}))})),t.command.add("hr",{execute:()=>{t.insertBox("hr"),t.history.save()}})})),Bi.plugin.add((t=>{t.event.on("beforepaste",(t=>{new mt(t).find("img").each((t=>{const e=I(t),i=new Qt("image"),n=e.attr("data-lake-value");""===n?i.value={url:e.attr("src"),status:"done"}:i.node.attr("value",n),e.replaceWith(i.node)}))})),t.command.add("image",{execute:e=>{t.insertBox("image",e),t.history.save()}})})),Bi.plugin.add((t=>{t.command.add("codeBlock",{execute:e=>{const i=t.insertBox("codeBlock",e);t.history.save();i.getData("codeEditor").focus()}})})),Bi.plugin.add((t=>{t.keystroke.setKeydown("space",(e=>{const i=t.selection.range;if(i.isBox)return;const n=function(t){const e=t.selection.range;let i=e.startNode,n=e.startOffset;if(0!==n){if(i.isElement){const t=i.children()[n-1];if(!t||!t.isText)return;i=t,n=i.text().length}if(!(n<1))return{node:i,offset:n}}}(t);if(!n)return;if(function(t,e){const i=t.selection,n=i.range,s=e.offset,o=e.node.text().slice(0,s);for(const e of ho){const r=e.re.exec(o);if(null!==r){t.prepareOperation();const o=i.insertBookmark(),a=o.focus.prev(),l=a.text(),h=`${l.replace(e.re,"$1")}`;a.get(0).nodeValue=h,n.setStart(a,s-r[0].length),n.setEnd(a,s-(l.length-h.length)-1);const c=e.getParameters();return t.command.execute(c.shift(),...c),i.toBookmark(o),t.commitOperation(),!0}}return!1}(t,n))return void e.preventDefault();const s=i.getBlocks()[0];s&&(s.isHeading||"p"===s.name)&&function(t,e){const i=t.selection,n=e.offset;let s=e.node.text().slice(0,n);s=s.replace(/[\u200B\u2060]/g,"");for(const e of co){const n=e.re.exec(s);if(null!==n){t.prepareOperation();const s=i.insertBookmark();s.focus.prev().remove();const o=s.focus.closestBlock();uo(o),i.range.shrinkAfter(o);const r=e.getParameters(n);return t.command.execute(r.shift(),...r),i.toBookmark(s),t.commitOperation(),!0}}return!1}(t,n)&&e.preventDefault()})),t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isBox)return;const n=i.getBlocks()[0];return!n||!n.isHeading&&"p"!==n.name||n.find("lake-box").length>0||""!==i.getRightText()?void 0:function(t,e){const i=t.selection;let n=e.text();n=n.replace(/[\u200B\u2060]/g,"");for(const s of po){const o=s.re.exec(n);if(null!==o){t.prepareOperation(),e.empty(),uo(e),i.range.shrinkAfter(e);const n=s.getParameters(o);return t.command.execute(n.shift(),...n),t.commitOperation(),!0}}return!1}(t,n)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(e.preventDefault(),t.rectifyContent(),i.isBox)return fo(t),void t.history.save();if(i.adapt(),i.isInoperative)return;if(i.isBox)return fo(t),void t.history.save();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),n.isEmpty&&"p"!==n.name)return t.selection.setBlocks("<p />"),void t.history.save();mo(t,n),t.history.save()}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("shift+enter",(e=>{const i=t.selection.range;if(!i.isInsideBox){if(t.rectifyContent(),e.preventDefault(),i.isBox)return vo(t),void t.history.save();if(i.adapt(),!i.isInoperative){if(i.isBox)return vo(t),void t.history.save();go(t),t.history.save()}}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("backspace",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxLeft){const n=i.startNode.closest("lake-box"),s=n.prev();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),wo(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkAfter(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getPrevNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();if("br"===n.name&&n.prev().length>0)return e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),void t.history.save();if(""===i.getLeftText()){e.preventDefault();let n=i.getBlocks()[0];if(n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),""!==n.css("margin-left")||""!==n.css("text-indent")||""!==n.attr("indent"))return F(n,"decrease"),void t.history.save();if(n.isList||"blockquote"===n.name)return t.selection.setBlocks("<p />"),void t.history.save();wo(t,n),t.history.save()}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("delete",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxRight){const n=i.startNode.closest("lake-box"),s=n.next();if(0===s.length){const i=n.closestBlock();return void(i.length>0&&!i.isContainer&&(e.preventDefault(),yo(t,i),t.history.save()))}if(s.isBlock)return s.isEmpty?(e.preventDefault(),s.remove(),t.selection.fixList(),void t.history.save()):(e.preventDefault(),void i.shrinkBefore(s));i.adaptBox()}if(i.isBox)return e.preventDefault(),t.removeBox(),void t.history.save();if(!i.isCollapsed)return e.preventDefault(),t.selection.deleteContents(),""===t.container.html().trim()&&t.setValue("<p><br /><focus /></p>"),void t.history.save();i.adapt();const n=i.getNextNode();if(n.isBox)return e.preventDefault(),i.selectBox(n),t.removeBox(),void t.history.save();"br"===n.name&&n.next().length>0&&(e.preventDefault(),i.setStartBefore(n),i.collapseToStart(),n.remove(),t.history.save());if(""===i.getRightText()){e.preventDefault();let n=i.getBlocks()[0];n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),yo(t,n),t.history.save()}}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("tab",(e=>{if(!1===t.config.indentWithTab)return;e.preventDefault();t.selection.range.getBlocks().forEach((t=>{"p"===t.name&&"2em"!==t.css("text-indent")?t.css("text-indent","2em"):F(t,"increase")})),t.history.save()}))})),Bi.plugin.add((t=>{t.keystroke.setKeydown("arrow-left",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxLeft){const t=n.prev();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkAfter(t)):(i.setStartBefore(n),void i.collapseToStart())}return i.isBoxRight?(e.preventDefault(),void i.selectBox(n)):(e.preventDefault(),void i.selectBoxLeft(n))}if(!i.isCollapsed)return;const s=i.getPrevNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-right",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(i.isBoxLeft)return e.preventDefault(),void i.selectBox(n);if(i.isBoxRight){const t=n.next();return t.isBlock||t.isBox?(e.preventDefault(),t.isInlineBox?void i.selectBox(t):void i.shrinkBefore(t)):(i.setStartAfter(n),void i.collapseToStart())}return e.preventDefault(),void i.selectBoxRight(n)}if(!i.isCollapsed)return;const s=i.getNextNode();s.isBox&&(e.preventDefault(),i.selectBox(s))})),t.keystroke.setKeydown("arrow-up",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.prev();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkAfter(t)}i.setStartBefore(n),i.collapseToStart()}})),t.keystroke.setKeydown("arrow-down",(e=>{const i=t.selection.range;if(i.isInsideBox)return;const n=i.commonAncestor.closest("lake-box");if(n.length>0){if(n.isBlockBox){const t=n.next();if(t.isBlock||t.isBox)return e.preventDefault(),void i.shrinkBefore(t)}i.setStartAfter(n),i.collapseToStart()}}))})),t.Box=Qt,t.Button=ke,t.Dropdown=_e,t.Editor=Bi,t.Fragment=mt,t.HTMLParser=ie,t.Nodes=T,t.Range=E,t.TextParser=ne,t.Toolbar=class{constructor(t){this.items=t.items||tn,this.editor=t.editor,this.root=I(t.root),this.container=I('<div class="lake-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(t){const e=this.editor;new ke({root:this.container,name:t.name,icon:t.icon,tooltip:t.tooltip,tabIndex:-1,onClick:()=>{e.focus(),t.onClick(e,t.name)}}).render()}appendDropdown(t){const e=this.editor;new _e({root:this.container,name:t.name,icon:t.icon,accentIcon:t.accentIcon,downIcon:t.downIcon,defaultValue:t.defaultValue,tooltip:t.tooltip,width:t.width,menuType:t.menuType,menuItems:t.menuItems,tabIndex:-1,onSelect:i=>{e.focus(),t.onSelect(e,i)}}).render()}appendUpload(t){const e=this.editor,i=I(a`
|
|
70
|
+
<div class="lake-upload" name="${t.name}">
|
|
72
71
|
<input type="file" />
|
|
73
|
-
<button type="button" class="lake-toolbar-button" />
|
|
74
72
|
</div>
|
|
75
|
-
`),
|
|
73
|
+
`),n=i.find('input[type="file"]'),s=n.get(0);t.accept&&n.attr("accept",t.accept),!0===t.multiple&&n.attr("multiple","true");new ke({root:i,name:t.name,icon:t.icon,tooltip:t.tooltip,tabIndex:-1,onClick:()=>{e.focus(),s.click()}}).render(),this.container.append(i),n.on("click",(t=>t.stopPropagation())),n.on("change",(t=>{const i=t.target.files||[];for(const t of i)Qi({editor:e,file:t})}))}render(){const t=this.editor;this.root.empty(),this.root.append(this.container);const e=new Map,i=[],n=[];this.items.forEach((t=>{if("|"===t)return void this.appendDivider();let s;if("string"==typeof t){if(s=en.get(t),!s)return}else s=t;return"button"===s.type?(i.push(s),void this.appendButton(s)):"dropdown"===s.type?(e.set(s.name,_e.getMenuMap(s.menuItems)),n.push(s),void this.appendDropdown(s)):void("upload"===s.type&&this.appendUpload(s))})),t.event.on("statechange",(t=>{var s;const{appliedItems:o,disabledNameMap:r,selectedNameMap:a,selectedValuesMap:l}=t;for(const t of i){const e="lake-button-selected",i=this.container.find(`button[name="${t.name}"]`);let n=r.get(t.name);if(void 0===n&&(n=!!(t.isDisabled&&o.length>0)&&t.isDisabled(o)),n?(i.attr("disabled","true"),i.removeClass(e)):i.removeAttr("disabled"),!n){let n=a.get(t.name);void 0===n&&(n=!!(t.isSelected&&o.length>0)&&t.isSelected(o)),n?i.addClass(e):i.removeClass(e)}}for(const t of n){let i=l.get(t.name);void 0===i&&(i=t.selectedValues&&o.length>0?t.selectedValues(o):[]);const n=this.container.find(`div.lake-dropdown[name="${t.name}"]`);let a=r.get(t.name);if(void 0===a&&(a=!!(t.isDisabled&&o.length>0)&&t.isDisabled(o)),a?n.attr("disabled","true"):n.removeAttr("disabled"),!a){_e.setValue(n,i);const o=n.find(".lake-dropdown-text");if(o.length>0){const n=i[0]||t.defaultValue,r=e.get(t.name),a=null!==(s=r&&r.get(n))&&void 0!==s?s:n;o.text(a)}}}}))}},t.Utils=ut,t.addMark=we,t.deleteContents=he,t.fixList=le,t.icons=n,t.insertBookmark=oe,t.insertContents=de,t.insertFragment=ce,t.insertLink=be,t.insertNode=se,t.removeMark=xe,t.setBlocks=pe,t.splitBlock=ue,t.splitMarks=ge,t.toBookmark=ae,t}({});
|
|
74
|
+
//# sourceMappingURL=lake.min.js.map
|