lakelib 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lake.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var Lake=function(t){"use strict";class e extends HTMLElement{}void 0!==customElements.get("lake-box")&&customElements.define("lake-box",e);class i extends HTMLElement{}void 0!==customElements.get("lake-bookmark")&&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>'],["file",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></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>'],["download",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"></path></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>'],["attachment",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"></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([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],[" ","&nbsp;"]]);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 c(t,e,i){return void 0===i&&(i=","),(i+t+i).indexOf(i+e+i)>=0}function h(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?`#${h(e)}${h(i)}${h(n)}`:`#${h(e)}${h(i)}${h(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(/&quot;/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){if("undefined"==typeof window)return t;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){let e=0;for(t/=1024;t>1024&&e<2;)t/=1024,e++;return`${t>0?Math.max(t,.1).toFixed(1):0} ${["KB","MB","GB"][e]}`}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 B(...t){window.LAKE_DEBUG&&console.log.apply(console.log,t)}const A={};let E=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=++E);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"]')}closestScroller(){let t=this.eq(0);for(;t.length>0&&t.isElement;){if(["scroll","auto"].indexOf(t.computedCSS("overflow-y"))>=0)return t;t=t.parent()}return new T}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;A[n]||(A[n]=[]),A[n].push({type:t,listener:e})}))}off(t,e){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=A[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:()=>{}})})),A[s]=o.filter((t=>""!==t.type))}))}emit(t,e){return this.eachElement((i=>{const n=i.lakeId;A[n].forEach((i=>{i.type===t&&i.listener(null!=e?e:new Event(t))}))}))}getEventListeners(t){const e=this.get(t).lakeId;return A[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){for(const e of Object.keys(t))this.attr(e,t[e]);return 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 c(this.get(0).className,t," ")}addClass(t){return Array.isArray(t)?(t.forEach((t=>{this.addClass(t)})),this):this.eachElement((e=>{c(e.className,t," ")||e.classList.add(t)}))}removeClass(t){return Array.isArray(t)?(t.forEach((t=>{this.removeClass(t)})),this):this.eachElement((e=>{c(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){for(const e of Object.keys(t))this.css(e,t[e]);return 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=Number.parseInt(this.computedCSS("padding-left"),10)||0,e=Number.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(){B(this.toString())}}function L(t){if(t instanceof T)return t;const e=w(t);return new T(e)}class I{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 isBoxStart(){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 isBoxEnd(){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}getRect(){const t=this.clone();let e,i,n;if(t.isCollapsed){let s="left";if(t.startNode.isElement){const e=t.startNode.children();0===e.length?t.selectNode(t.startNode):t.startOffset<e.length?t.setEnd(t.startNode,t.startOffset+1):(t.setStart(t.startNode,t.startOffset-1),s="right")}else{const e=t.startNode.text();t.startOffset<e.length?t.setEnd(t.startNode,t.startOffset+1):(t.setStart(t.startNode,t.startOffset-1),s="right")}e=t.get().getBoundingClientRect(),i="left"===s?e.x:e.right,n=1}else e=t.get().getBoundingClientRect(),i=e.x,n=e.width;const s=e.height;return DOMRect.fromRect({x:i,y:e.y,width:n>0?n:1,height:s>0?s:1})}comparePoint(t,e){return this.range.comparePoint(t.get(0),e)}compareBeforeNode(t){const e=new I;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 I;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()}selectBoxStart(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.collapseToStart()}selectBoxEnd(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.collapseToStart()}shrinkBefore(t){if(t.isBox)return void this.selectBoxStart(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.selectBoxStart(e);this.setStart(e,0)}this.collapseToStart()}shrinkAfter(t){if(t.isBox)return void this.selectBoxEnd(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.selectBoxEnd(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.isBoxEnd?this.setStartAfter(t):this.setStartBefore(t)}const e=this.endNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToEnd(),t.isBoxStart?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}getStartText(){const t=this.startNode,e=this.startOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new I;n.setStartBefore(i),n.setEnd(t,e);const s=L("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}getEndText(){const t=this.endNode,e=this.endOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new I;n.setStart(t,e),n.setEndAfter(i);const s=L("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}clone(){return new I(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){B("--- range information ---"),B("start node:",this.startNode.toString(),", offset:",this.startOffset),B("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function M(t,e,i){const n=new I;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):{start:o,end: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 O(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 I;return e.setEndAfter(t),{node:e.endNode,offset:e.endOffset}}function Z(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);O(t),O(e),t.isBlock&&t.isEmpty&&e.isEmpty&&P(t,L("<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))?Z(n,s):0===n.length?{node:t,offset:0}:z(n)}function N(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:L("<p />"),0===t.length)return e;const i=N(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=L(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 j=new Set;function R(){}const W={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:R,afterNodeAdded:R,beforeNodeMorphed:R,afterNodeMorphed:R,beforeNodeRemoved:R,afterNodeRemoved:R,beforeAttributeUpdated:R,afterAttributeUpdated:R,beforeChildrenUpdated:R},head:{style:"merge",shouldPreserve:t=>"true"===t.getAttribute("im-preserve"),shouldReAppend:t=>"true"===t.getAttribute("im-re-append"),shouldRemove:R,afterHeadMorphed:R}};function U(t,e){return!t.deadIds.has(e)}function q(t,e,i){return(t.idMap.get(i)||j).has(e)}function K(t,e){const i=t.idMap.get(e)||j;for(const e of i)t.deadIds.add(e)}function G(t,e,i){const n=t.idMap.get(e)||j;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 Y(t,e){const i=new Map;return X(t,i),X(e,i),i}function J(t,e,i){return{target:t,newContent:e,config:i=function(t){const e={};return Object.assign(e,W),Object.assign(e,t),e.callbacks={},Object.assign(e.callbacks,W.callbacks),Object.assign(e.callbacks,t.callbacks),e.head={},Object.assign(e.head,W.head),Object.assign(e.head,t.head),e}(i),morphStyle:i.morphStyle,ignoreActive:i.ignoreActive,ignoreActiveValue:i.ignoreActiveValue,idMap:Y(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 ct(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 ht(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=J(t.get(0),n,i);ct(t.get(0),n,s)}function dt(t){const e=t.get(0).getBoundingClientRect();let i=e.left,n=e.right,s=e.top,o=e.bottom,r=window.innerWidth,a=window.innerHeight;const l=t.closestContainer();if(l.length>0){const t=l.closestScroller();if(t.length>0){const e=l.parent();if(e.length>0){const t=e.get(0),r=t.offsetLeft-window.scrollX,a=t.offsetTop-window.scrollY;i-=r,n-=r,s-=a,o-=a}const c=t.get(0).getBoundingClientRect();r=c.width,a=c.height}}return{left:i,right:r-n,top:s,bottom:a-o}}const pt=new Map,ut="function"==typeof Buffer,mt="function"==typeof TextDecoder?new TextDecoder:void 0,ft="function"==typeof TextEncoder?new TextEncoder:void 0,gt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),vt=(t=>{let e={};return t.forEach(((t,i)=>e[t]=i)),e})(gt),wt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,yt=String.fromCharCode.bind(String),xt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),bt=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),kt=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),_t=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+=gt[e>>18&63]+gt[e>>12&63]+gt[e>>6&63]+gt[63&e]}return r?o.slice(0,r-3)+"===".substring(r):o},St="function"==typeof btoa?t=>btoa(t):ut?t=>Buffer.from(t,"binary").toString("base64"):_t,Ct=ut?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let i=0,n=t.length;i<n;i+=4096)e.push(yt.apply(null,t.subarray(i,i+4096)));return St(e.join(""))},Bt=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?yt(192|e>>>6)+yt(128|63&e):yt(224|e>>>12&15)+yt(128|e>>>6&63)+yt(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return yt(240|e>>>18&7)+yt(128|e>>>12&63)+yt(128|e>>>6&63)+yt(128|63&e)},At=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Et=t=>t.replace(At,Bt),Tt=ut?t=>Buffer.from(t,"utf8").toString("base64"):ft?t=>Ct(ft.encode(t)):t=>St(Et(t)),Lt=(t,e=!1)=>e?bt(Tt(t)):Tt(t),It=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mt=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 yt(55296+(e>>>10))+yt(56320+(1023&e));case 3:return yt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return yt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},Pt=t=>t.replace(It,Mt),Ot=t=>{if(t=t.replace(/\s+/g,""),!wt.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=vt[t.charAt(o++)]<<18|vt[t.charAt(o++)]<<12|(i=vt[t.charAt(o++)])<<6|(n=vt[t.charAt(o++)]),s+=64===i?yt(e>>16&255):64===n?yt(e>>16&255,e>>8&255):yt(e>>16&255,e>>8&255,255&e);return s},zt="function"==typeof atob?t=>atob(kt(t)):ut?t=>Buffer.from(t,"base64").toString("binary"):Ot,Zt=ut?t=>xt(Buffer.from(t,"base64")):t=>xt(zt(t).split("").map((t=>t.charCodeAt(0)))),Nt=ut?t=>Buffer.from(t,"base64").toString("utf8"):mt?t=>mt.decode(Zt(t)):t=>Pt(zt(t)),Ht=t=>kt(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),Dt=t=>Nt(Ht(t)),$t=Lt,Vt=Dt;var Ft="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 Rt={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,c,h=this._events[a],d=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),d){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,s),!0;case 5:return h.fn.call(h.context,e,n,s,o),!0;case 6:return h.fn.call(h.context,e,n,s,o,r),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var p,u=h.length;for(c=0;c<u;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),d){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,n);break;case 4:h[c].fn.call(h[c].context,e,n,s);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];h[c].fn.apply(h[c].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,c=[],h=a.length;l<h;l++)(a[l].fn!==e||s&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c: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}(Rt);var Wt=jt(Rt.exports);const Ut=new Map,qt=new Map,Kt={},Gt={},Xt=a`
1
+ var Lake=function(t){"use strict";class e extends HTMLElement{}void 0!==customElements.get("lake-box")&&customElements.define("lake-box",e);class i extends HTMLElement{}void 0!==customElements.get("lake-bookmark")&&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>'],["file",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></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>'],["download",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"></path></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>'],["attachment",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"></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([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],[" ","&nbsp;"]]);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 c(t,e,i){return void 0===i&&(i=","),(i+t+i).indexOf(i+e+i)>=0}function h(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?`#${h(e)}${h(i)}${h(n)}`:`#${h(e)}${h(i)}${h(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(/&quot;/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){if("undefined"==typeof window)return t;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){let e=0;for(t/=1024;t>1024&&e<2;)t/=1024,e++;return`${t>0?Math.max(t,.1).toFixed(1):0} ${["KB","MB","GB"][e]}`}function v(t,e){const i=l(e),n=window.getComputedStyle(t,null);return d(t.style[i]||n.getPropertyValue(e)||"")}function y(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 w=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 B(...t){window.LAKE_DEBUG&&console.log.apply(console.log,t)}const A={};let E=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=++E);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===w.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===w.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===w.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"]')}closestScroller(){let t=this.eq(0);for(;t.length>0&&t.isElement;){if(["scroll","auto"].indexOf(t.computedCSS("overflow-y"))>=0)return t;t=t.parent()}return new T}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;A[n]||(A[n]=[]),A[n].push({type:t,listener:e})}))}off(t,e){return this.eachElement((i=>{var n;const s=i.lakeId,o=null!==(n=A[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:()=>{}})})),A[s]=o.filter((t=>""!==t.type))}))}emit(t,e){return this.eachElement((i=>{const n=i.lakeId;A[n].forEach((i=>{i.type===t&&i.listener(null!=e?e:new Event(t))}))}))}getEventListeners(t){const e=this.get(t).lakeId;return A[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){for(const e of Object.keys(t))this.attr(e,t[e]);return 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 c(this.get(0).className,t," ")}addClass(t){return Array.isArray(t)?(t.forEach((t=>{this.addClass(t)})),this):this.eachElement((e=>{c(e.className,t," ")||e.classList.add(t)}))}removeClass(t){return Array.isArray(t)?(t.forEach((t=>{this.removeClass(t)})),this):this.eachElement((e=>{c(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){for(const e of Object.keys(t))this.css(e,t[e]);return 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=Number.parseInt(this.computedCSS("padding-left"),10)||0,e=Number.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=>{y(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=>{y(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=>{y(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=>{y(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):y(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(){B(this.toString())}}function L(t){if(t instanceof T)return t;const e=y(t);return new T(e)}class I{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 isBoxStart(){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 isBoxEnd(){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}getRect(){const t=this.clone();let e,i,n;if(t.isCollapsed){let s="left";if(t.startNode.isElement){const e=t.startNode.children();0===e.length?t.selectNode(t.startNode):t.startOffset<e.length?t.setEnd(t.startNode,t.startOffset+1):(t.setStart(t.startNode,t.startOffset-1),s="right")}else{const e=t.startNode.text();t.startOffset<e.length?t.setEnd(t.startNode,t.startOffset+1):(t.setStart(t.startNode,t.startOffset-1),s="right")}e=t.get().getBoundingClientRect(),i="left"===s?e.x:e.right,n=1}else e=t.get().getBoundingClientRect(),i=e.x,n=e.width;const s=e.height;return DOMRect.fromRect({x:i,y:e.y,width:n>0?n:1,height:s>0?s:1})}comparePoint(t,e){return this.range.comparePoint(t.get(0),e)}compareBeforeNode(t){const e=new I;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 I;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()}selectBoxStart(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.collapseToStart()}selectBoxEnd(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.collapseToStart()}shrinkBefore(t){if(t.isBox)return void this.selectBoxStart(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.selectBoxStart(e);this.setStart(e,0)}this.collapseToStart()}shrinkAfter(t){if(t.isBox)return void this.selectBoxEnd(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.selectBoxEnd(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.isBoxEnd?this.setStartAfter(t):this.setStartBefore(t)}const e=this.endNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToEnd(),t.isBoxStart?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}getStartText(){const t=this.startNode,e=this.startOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new I;n.setStartBefore(i),n.setEnd(t,e);const s=L("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}getEndText(){const t=this.endNode,e=this.endOffset;let i=t.closestBlock();if(i.isOutside&&(i=t.closestContainer()),0===i.length)return"";const n=new I;n.setStart(t,e),n.setEndAfter(i);const s=L("<div />");s.append(n.cloneContents());const o=s.text();return""===o&&s.find("lake-box").length>0?"​":o}clone(){return new I(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){B("--- range information ---"),B("start node:",this.startNode.toString(),", offset:",this.startOffset),B("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function M(t,e,i){const n=new I;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):{start:o,end: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 O(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 I;return e.setEndAfter(t),{node:e.endNode,offset:e.endOffset}}function Z(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);O(t),O(e),t.isBlock&&t.isEmpty&&e.isEmpty&&P(t,L("<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))?Z(n,s):0===n.length?{node:t,offset:0}:z(n)}function N(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:L("<p />"),0===t.length)return e;const i=N(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=L(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 j=new Set;function R(){}const W={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:R,afterNodeAdded:R,beforeNodeMorphed:R,afterNodeMorphed:R,beforeNodeRemoved:R,afterNodeRemoved:R,beforeAttributeUpdated:R,afterAttributeUpdated:R,beforeChildrenUpdated:R},head:{style:"merge",shouldPreserve:t=>"true"===t.getAttribute("im-preserve"),shouldReAppend:t=>"true"===t.getAttribute("im-re-append"),shouldRemove:R,afterHeadMorphed:R}};function U(t,e){return!t.deadIds.has(e)}function q(t,e,i){return(t.idMap.get(i)||j).has(e)}function K(t,e){const i=t.idMap.get(e)||j;for(const e of i)t.deadIds.add(e)}function G(t,e,i){const n=t.idMap.get(e)||j;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,W),Object.assign(e,t),e.callbacks={},Object.assign(e.callbacks,W.callbacks),Object.assign(e.callbacks,t.callbacks),e.head={},Object.assign(e.head,W.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 ct(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 ht(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);ct(t.get(0),n,s)}function dt(t){const e=t.get(0).getBoundingClientRect();let i=e.left,n=e.right,s=e.top,o=e.bottom,r=window.innerWidth,a=window.innerHeight;const l=t.closestContainer();if(l.length>0){const t=l.closestScroller();if(t.length>0){const e=t.get(0).getBoundingClientRect(),l=e.x,c=e.y;i-=l,n-=l,s-=c,o-=c,r=e.width,a=e.height}}return{left:i,right:r-n,top:s,bottom:a-o}}const pt=new Map,ut="function"==typeof Buffer,mt="function"==typeof TextDecoder?new TextDecoder:void 0,ft="function"==typeof TextEncoder?new TextEncoder:void 0,gt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),vt=(t=>{let e={};return t.forEach(((t,i)=>e[t]=i)),e})(gt),yt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,wt=String.fromCharCode.bind(String),xt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),bt=t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_")),kt=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),_t=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+=gt[e>>18&63]+gt[e>>12&63]+gt[e>>6&63]+gt[63&e]}return r?o.slice(0,r-3)+"===".substring(r):o},St="function"==typeof btoa?t=>btoa(t):ut?t=>Buffer.from(t,"binary").toString("base64"):_t,Ct=ut?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let i=0,n=t.length;i<n;i+=4096)e.push(wt.apply(null,t.subarray(i,i+4096)));return St(e.join(""))},Bt=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?wt(192|e>>>6)+wt(128|63&e):wt(224|e>>>12&15)+wt(128|e>>>6&63)+wt(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return wt(240|e>>>18&7)+wt(128|e>>>12&63)+wt(128|e>>>6&63)+wt(128|63&e)},At=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Et=t=>t.replace(At,Bt),Tt=ut?t=>Buffer.from(t,"utf8").toString("base64"):ft?t=>Ct(ft.encode(t)):t=>St(Et(t)),Lt=(t,e=!1)=>e?bt(Tt(t)):Tt(t),It=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mt=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 wt(55296+(e>>>10))+wt(56320+(1023&e));case 3:return wt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return wt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},Pt=t=>t.replace(It,Mt),Ot=t=>{if(t=t.replace(/\s+/g,""),!yt.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=vt[t.charAt(o++)]<<18|vt[t.charAt(o++)]<<12|(i=vt[t.charAt(o++)])<<6|(n=vt[t.charAt(o++)]),s+=64===i?wt(e>>16&255):64===n?wt(e>>16&255,e>>8&255):wt(e>>16&255,e>>8&255,255&e);return s},zt="function"==typeof atob?t=>atob(kt(t)):ut?t=>Buffer.from(t,"base64").toString("binary"):Ot,Zt=ut?t=>xt(Buffer.from(t,"base64")):t=>xt(zt(t).split("").map((t=>t.charCodeAt(0)))),Nt=ut?t=>Buffer.from(t,"base64").toString("utf8"):mt?t=>mt.decode(Zt(t)):t=>Pt(zt(t)),Ht=t=>kt(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),Dt=t=>Nt(Ht(t)),$t=Lt,Vt=Dt;var Ft="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 Rt={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,c,h=this._events[a],d=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),d){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,s),!0;case 5:return h.fn.call(h.context,e,n,s,o),!0;case 6:return h.fn.call(h.context,e,n,s,o,r),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];h.fn.apply(h.context,l)}else{var p,u=h.length;for(c=0;c<u;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),d){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,e);break;case 3:h[c].fn.call(h[c].context,e,n);break;case 4:h[c].fn.call(h[c].context,e,n,s);break;default:if(!l)for(p=1,l=new Array(d-1);p<d;p++)l[p-1]=arguments[p];h[c].fn.apply(h[c].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,c=[],h=a.length;l<h;l++)(a[l].fn!==e||s&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[o]=1===c.length?c[0]:c: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}(Rt);var Wt=jt(Rt.exports);const Ut=new Map,qt=new Map,Kt={},Gt={},Xt=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 Yt{constructor(t){if(this.event=new Wt,"string"==typeof t){const e=Ut.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=L(a`<lake-box type="${i}" name="${n}"></lake-box>`),e.value&&(this.value=e.value)}else{this.node=L(t);const e=Ut.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)}Kt[this.node.id]||(Kt[this.node.id]={}),Gt[this.node.id]||(Gt[this.node.id]={setup:[],cleanup:[]})}addFramework(){let t=this.getContainer();0===t.length?(this.node.html(Xt),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",(()=>{B(`Box '${this.name}' (id = ${this.node.id}) value:`),B(this.value)})),"block"===this.type&&t.attr("draggable","true")}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(Vt(t))}set value(t){this.node.attr("value",$t(JSON.stringify(t)))}updateValue(t,e){const i=this.value;if("string"==typeof t)i[t]=e;else for(const e of Object.keys(t))i[e]=t[e];this.value=i}getData(t){return Kt[this.node.id][t]}setData(t,e){Kt[this.node.id][t]=e}getEditor(){const t=this.node.closest("div[contenteditable]");return t.length>0?qt.get(t.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(t){Gt[this.node.id].setup.push(t)}render(){Gt[this.node.id].setup=[],Gt[this.node.id].cleanup=[];const t=Ut.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),ht(t,i)}for(const t of Gt[this.node.id].setup){const e=t();void 0!==e&&Gt[this.node.id].cleanup.push(e)}B(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){this.event.emit("blur");for(const t of Gt[this.node.id].cleanup)t();Kt[this.node.id]={},Gt[this.node.id].setup=[],Gt[this.node.id].cleanup=[],this.event.removeAllListeners(),this.node.empty(),B(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const t=Ut.get(this.name);return void 0===t?"":void 0===t.html?this.node.outerHTML():t.html(this)}}function Jt(t){if("string"==typeof t)return new Yt(t);const e=(t=L(t)).closestContainer();if(0===e.length)return new Yt(t);let i=pt.get(e.id);i||(i=new Map,pt.set(e.id,i));let n=i.get(t.id);return n||(n=new Yt(t),i.set(n.node.id,n),n)}function Qt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function te(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),Qt(e))}if(t.onSuccess)return t.onSuccess(Qt(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 ee=Object.freeze({__proto__:null,appendDeepest:P,camelCase:l,changeTagName:$,debug:B,denormalizeValue:m,encode:r,fileSize:g,fixNumberedList:V,getBox:Jt,getCSS:v,getDeepest:N,inString:c,mergeNodes:Z,modifierText:f,morph:ht,nodeAndView:dt,normalizeValue:u,parseStyle:p,query:L,removeBr:O,removeZWS:D,request:te,safeTemplate:a,setBlockIndent:F,splitNodes:M,template:s,toHex:d,toNodeList:w,wrapNodeList:H});class ie{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 ne={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function se(){return{h1:Object.assign({},ne),h2:Object.assign({},ne),h3:Object.assign({},ne),h4:Object.assign({},ne),h5:Object.assign({},ne),h6:Object.assign({},ne),p:Object.assign({},ne),blockquote:Object.assign(Object.assign({},ne),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},ne),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},ne),{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:["start","center","end"]},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 oe{constructor(t,e=se()){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&&oe.matchRule(n[t.name],t.value)&&o.set(t.name,t.value),"style"===t.name)){const e=n.style,i=new Map,s=p(t.value);for(const t of Object.keys(s)){const n=s[t];e[t]&&oe.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,"&quot;")}; `;""!==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(oe.getTrimmedText(n));else if(n.isVoid){const e=oe.getOpenTagString(n,t);""!==e&&(yield`<${e} />`)}else if(n.isElement){const i=oe.getOpenTagString(n,t),s=oe.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 re{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 oe(this.getHTML()).getFragment()}}function ae(t,e){if(t.commonAncestor.isOutside)return;const i=(e=L(e)).get(0),n=t.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function le(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.isBoxStart?e.attr("focus","start"):t.isBoxEnd?e.attr("focus","end"):e.attr("focus","center"),{anchor:new T,focus:e};if(t.isCollapsed){const e=t.clone();e.collapseToEnd();const i=L('<lake-bookmark type="focus" />');return ae(e,i),{anchor:new T,focus:i}}const i=t.clone();i.collapseToStart();const n=L('<lake-bookmark type="anchor" />');ae(i,n);const s=t.clone();s.collapseToEnd();const o=L('<lake-bookmark type="focus" />');return ae(s,o),{anchor:n,focus:o}}function ce(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 he(t,e){const i=e.anchor,n=e.focus;if(i.length>0&&0===n.length)ce(i);else{if(n.length>0&&0===i.length){if(n.isBox){const e=Jt(n);0===e.getContainer().length&&e.render();const i=n.attr("focus");return"start"===i?t.selectBoxStart(n):"center"===i?t.selectBox(n):t.selectBoxEnd(n),void n.removeAttr("focus")}return t.setStartBefore(n),t.collapseToStart(),void ce(n,t)}if(i.length>0&&n.length>0){const e=new I;e.selectNode(i),e.collapseToEnd(),-1===e.compareAfterNode(n)?(t.setStartBefore(n),ce(n),t.setEndBefore(i),ce(i)):(t.setStartBefore(i),ce(i),t.setEndBefore(n),ce(n))}}}function de(t){if(t.commonAncestor.isOutside)return;V(t.getBlocks())}function pe(t){if(t.isCollapsed)return;if(t.adaptBox(),t.adaptTable(),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,L("<br />")),t.shrinkAfter(e)))}const s=t.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=le(t);Z(o,s),he(t,r),de(t)}function ue(t,e){if(t.commonAncestor.isOutside)return;t.isCollapsed?t.adaptBox():pe(t);O(t.startNode.closestBlock());const i=le(t);i.focus.before(e),he(t,i),t.adaptBlock()}function me(t,e){const i=L(e),n=document.createDocumentFragment();i.each((t=>{n.appendChild(t)})),ue(t,n)}function fe(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=L(e),n=i.name,s=i.get(0).attributes,o=t.getBlocks();if(o.length>0){const e=le(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=N(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 he(t,e),void de(t)}const r=le(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);he(t,r),de(t),l.isEmpty&&(P(l,L("<br />")),t.shrinkAfter(l))}function ge(t){if(t.commonAncestor.isOutside)return{start:null,end:null};t.isCollapsed?t.adaptBox():pe(t);const e=t.startNode,i=e.closestOperableBlock();if(0===i.length)return{start:null,end: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.start,r=s.end),!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,L("<br />")),r&&(r.isEmpty?(P(r,L("<br />")),t.shrinkAfter(r)):t.shrinkBefore(r)),de(t),{start:o,end:r}}function ve(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function we(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?(ve(r.start),ve(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function ye(t,e=!0){if(t.commonAncestor.isOutside)return{start:null,center:null,end:null};if(t.adaptBox(),t.isCollapsed){const i=we(t.startNode,t.startOffset,e);return i.start?(t.setStartAfter(i.start),t.collapseToStart()):i.end&&(t.setStartBefore(i.end),t.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=we(t.startNode,t.startOffset,e);i.start?t.setStartAfter(i.start):i.end&&t.setStartBefore(i.end);const n=we(t.endNode,t.endOffset,e);return n.start?t.setEndAfter(n.start):n.end&&t.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function xe(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 be(t,e){if(t.commonAncestor.isOutside)return;let i=L(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"===Jt(e).type){const i=L("<p><br /></p>");t.isBoxStart?e.before(i):e.after(i),t.shrinkAfter(i)}else t.adaptBox()}O(t.startNode.closestBlock());const e=new T(document.createTextNode("​")),o=ye(t);if(o.start){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.start);t&&(t.name===n?(t.css(s),i=t):(P(t,e),i.append(t)))}return""===i.text()&&i.append(e),ae(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)}ye(t);const o=t.getMarks(!0),r=le(t);for(const t of o)if(!t.isEmpty&&t.isText){const e=xe(t,n);if(e.isMark&&e.name===n)e.css(s);else{const t=i.clone();e.before(t),t.append(e)}}he(t,r)}function ke(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function _e(t,e){if(t.commonAncestor.isOutside)return;let i;if(e){i=L(e).name}if(t.isCollapsed){if(t.isBox)return;if(i&&0===t.commonAncestor.closest(i).length)return;const e=ye(t,!1);if(!e.start)return;e.end&&ke(e.end);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.start,i);return s?(P(s,n),e.start.after(s),ke(e.start),void t.shrinkAfter(s)):(e.start.after(n),ke(e.start),n.prev().isText?(t.setStartAfter(n.prev()),t.collapseToStart(),void n.remove()):(t.setStartAfter(n),void t.collapseToStart()))}ye(t);const n=t.getMarks(),s=le(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),he(t,s)}function Se(t,e){if(t.commonAncestor.isOutside)return null;const i=L(e);if(t.isCollapsed){let e=t.commonAncestor.closest("a");if(0===e.length){e=i.clone(!0);return O(t.startNode.closestBlock()),ae(t,e),e}return""!==i.attr("href")&&e.attr({href:i.attr("href")}),e}ye(t);const n=le(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(),he(t,n),s}class Ce{constructor(t){this.config=t,this.root=t.root,this.node=L(a`
5
+ `;class Jt{constructor(t){if(this.event=new Wt,"string"==typeof t){const e=Ut.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=L(a`<lake-box type="${i}" name="${n}"></lake-box>`),e.value&&(this.value=e.value)}else{this.node=L(t);const e=Ut.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)}Kt[this.node.id]||(Kt[this.node.id]={}),Gt[this.node.id]||(Gt[this.node.id]={setup:[],cleanup:[]})}addFramework(){let t=this.getContainer();0===t.length?(this.node.html(Xt),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",(()=>{B(`Box '${this.name}' (id = ${this.node.id}) value:`),B(this.value)})),"block"===this.type&&t.attr("draggable","true")}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(Vt(t))}set value(t){this.node.attr("value",$t(JSON.stringify(t)))}updateValue(t,e){const i=this.value;if("string"==typeof t)i[t]=e;else for(const e of Object.keys(t))i[e]=t[e];this.value=i}getData(t){return Kt[this.node.id][t]}setData(t,e){Kt[this.node.id][t]=e}getEditor(){const t=this.node.closest("div[contenteditable]");return t.length>0?qt.get(t.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(t){Gt[this.node.id].setup.push(t)}render(){Gt[this.node.id].setup=[],Gt[this.node.id].cleanup=[];const t=Ut.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),ht(t,i)}for(const t of Gt[this.node.id].setup){const e=t();void 0!==e&&Gt[this.node.id].cleanup.push(e)}B(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){this.event.emit("blur");for(const t of Gt[this.node.id].cleanup)t();Kt[this.node.id]={},Gt[this.node.id].setup=[],Gt[this.node.id].cleanup=[],this.event.removeAllListeners(),this.node.empty(),B(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const t=Ut.get(this.name);return void 0===t?"":void 0===t.html?this.node.outerHTML():t.html(this)}}function Yt(t){if("string"==typeof t)return new Jt(t);const e=(t=L(t)).closestContainer();if(0===e.length)return new Jt(t);let i=pt.get(e.id);i||(i=new Map,pt.set(e.id,i));let n=i.get(t.id);return n||(n=new Jt(t),i.set(n.node.id,n),n)}function Qt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function te(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),Qt(e))}if(t.onSuccess)return t.onSuccess(Qt(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 ee=Object.freeze({__proto__:null,appendDeepest:P,camelCase:l,changeTagName:$,debug:B,denormalizeValue:m,encode:r,fileSize:g,fixNumberedList:V,getBox:Yt,getCSS:v,getDeepest:N,inString:c,mergeNodes:Z,modifierText:f,morph:ht,nodeAndView:dt,normalizeValue:u,parseStyle:p,query:L,removeBr:O,removeZWS:D,request:te,safeTemplate:a,setBlockIndent:F,splitNodes:M,template:s,toHex:d,toNodeList:y,wrapNodeList:H});class ie{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 ne={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify","start","end"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function se(){return{h1:Object.assign({},ne),h2:Object.assign({},ne),h3:Object.assign({},ne),h4:Object.assign({},ne),h5:Object.assign({},ne),h6:Object.assign({},ne),p:Object.assign({},ne),blockquote:Object.assign(Object.assign({},ne),{type:["info","tip","success","warning","error","danger"]}),ul:Object.assign(Object.assign({},ne),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},ne),{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:["start","center","end"]},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 oe{constructor(t,e=se()){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&&oe.matchRule(n[t.name],t.value)&&o.set(t.name,t.value),"style"===t.name)){const e=n.style,i=new Map,s=p(t.value);for(const t of Object.keys(s)){const n=s[t];e[t]&&oe.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,"&quot;")}; `;""!==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(oe.getTrimmedText(n));else if(n.isVoid){const e=oe.getOpenTagString(n,t);""!==e&&(yield`<${e} />`)}else if(n.isElement){const i=oe.getOpenTagString(n,t),s=oe.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 re{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 oe(this.getHTML()).getFragment()}}function ae(t,e){if(t.commonAncestor.isOutside)return;const i=(e=L(e)).get(0),n=t.get();n.insertNode(i),n.setEndAfter(i),n.collapse(!1)}function le(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.isBoxStart?e.attr("focus","start"):t.isBoxEnd?e.attr("focus","end"):e.attr("focus","center"),{anchor:new T,focus:e};if(t.isCollapsed){const e=t.clone();e.collapseToEnd();const i=L('<lake-bookmark type="focus" />');return ae(e,i),{anchor:new T,focus:i}}const i=t.clone();i.collapseToStart();const n=L('<lake-bookmark type="anchor" />');ae(i,n);const s=t.clone();s.collapseToEnd();const o=L('<lake-bookmark type="focus" />');return ae(s,o),{anchor:n,focus:o}}function ce(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 he(t,e){const i=e.anchor,n=e.focus;if(i.length>0&&0===n.length)ce(i);else{if(n.length>0&&0===i.length){if(n.isBox){const e=Yt(n);0===e.getContainer().length&&e.render();const i=n.attr("focus");return"start"===i?t.selectBoxStart(n):"center"===i?t.selectBox(n):t.selectBoxEnd(n),void n.removeAttr("focus")}return t.setStartBefore(n),t.collapseToStart(),void ce(n,t)}if(i.length>0&&n.length>0){const e=new I;e.selectNode(i),e.collapseToEnd(),-1===e.compareAfterNode(n)?(t.setStartBefore(n),ce(n),t.setEndBefore(i),ce(i)):(t.setStartBefore(i),ce(i),t.setEndBefore(n),ce(n))}}}function de(t){if(t.commonAncestor.isOutside)return;V(t.getBlocks())}function pe(t){if(t.isCollapsed)return;if(t.adaptBox(),t.adaptTable(),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,L("<br />")),t.shrinkAfter(e)))}const s=t.getBlocks()[0];if(!s)return;const o=s.prev();if(0===o.length)return;const r=le(t);Z(o,s),he(t,r),de(t)}function ue(t,e){if(t.commonAncestor.isOutside)return;t.isCollapsed?t.adaptBox():pe(t);O(t.startNode.closestBlock());const i=le(t);i.focus.before(e),he(t,i),t.adaptBlock()}function me(t,e){const i=L(e),n=document.createDocumentFragment();i.each((t=>{n.appendChild(t)})),ue(t,n)}function fe(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=L(e),n=i.name,s=i.get(0).attributes,o=t.getBlocks();if(o.length>0){const e=le(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=N(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 he(t,e),void de(t)}const r=le(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);he(t,r),de(t),l.isEmpty&&(P(l,L("<br />")),t.shrinkAfter(l))}function ge(t){if(t.commonAncestor.isOutside)return{start:null,end:null};t.isCollapsed?t.adaptBox():pe(t);const e=t.startNode,i=e.closestOperableBlock();if(0===i.length)return{start:null,end: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.start,r=s.end),!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,L("<br />")),r&&(r.isEmpty?(P(r,L("<br />")),t.shrinkAfter(r)):t.shrinkBefore(r)),de(t),{start:o,end:r}}function ve(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function ye(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?(ve(r.start),ve(r.end),r.start.isEmpty||(n=r.start),r.end.isEmpty||(s=r.end)):(n=r.start,s=r.end)),{start:n,end:s}}function we(t,e=!0){if(t.commonAncestor.isOutside)return{start:null,center:null,end:null};if(t.adaptBox(),t.isCollapsed){const i=ye(t.startNode,t.startOffset,e);return i.start?(t.setStartAfter(i.start),t.collapseToStart()):i.end&&(t.setStartBefore(i.end),t.collapseToStart()),{start:i.start,center:null,end:i.end}}const i=ye(t.startNode,t.startOffset,e);i.start?t.setStartAfter(i.start):i.end&&t.setStartBefore(i.end);const n=ye(t.endNode,t.endOffset,e);return n.start?t.setEndAfter(n.start):n.end&&t.setEndBefore(n.end),{start:i.start,center:n.start,end:n.end}}function xe(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 be(t,e){if(t.commonAncestor.isOutside)return;let i=L(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"===Yt(e).type){const i=L("<p><br /></p>");t.isBoxStart?e.before(i):e.after(i),t.shrinkAfter(i)}else t.adaptBox()}O(t.startNode.closestBlock());const e=new T(document.createTextNode("​")),o=we(t);if(o.start){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.start);t&&(t.name===n?(t.css(s),i=t):(P(t,e),i.append(t)))}return""===i.text()&&i.append(e),ae(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)}we(t);const o=t.getMarks(!0),r=le(t);for(const t of o)if(!t.isEmpty&&t.isText){const e=xe(t,n);if(e.isMark&&e.name===n)e.css(s);else{const t=i.clone();e.before(t),t.append(e)}}he(t,r)}function ke(t){if(t.isMark&&t.isEmpty)t.remove();else for(const e of t.getWalker())e.isMark&&e.isEmpty&&e.remove()}function _e(t,e){if(t.commonAncestor.isOutside)return;let i;if(e){i=L(e).name}if(t.isCollapsed){if(t.isBox)return;if(i&&0===t.commonAncestor.closest(i).length)return;const e=we(t,!1);if(!e.start)return;e.end&&ke(e.end);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.start,i);return s?(P(s,n),e.start.after(s),ke(e.start),void t.shrinkAfter(s)):(e.start.after(n),ke(e.start),n.prev().isText?(t.setStartAfter(n.prev()),t.collapseToStart(),void n.remove()):(t.setStartAfter(n),void t.collapseToStart()))}we(t);const n=t.getMarks(),s=le(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),he(t,s)}function Se(t,e){if(t.commonAncestor.isOutside)return null;const i=L(e);if(t.isCollapsed){let e=t.commonAncestor.closest("a");if(0===e.length){e=i.clone(!0);return O(t.startNode.closestBlock()),ae(t,e),e}return""!==i.attr("href")&&e.attr({href:i.attr("href")}),e}we(t);const n=le(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(),he(t,n),s}class Ce{constructor(t){this.config=t,this.root=t.root,this.node=L(a`
6
6
  <button type="button" name="${t.name}" class="lake-button" />
7
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()}))}}const Be=/^\{.*\}$/,Ae=/(\{(?:[^{}]+|\{(?:[^{}]+)*\})*\})/g,Ee=t=>t.substring(1,t.length-1),Te=(t,e=!0,i="",n="")=>t.split(Ae).map((t=>{if(!t.match(Ae))return t;const e=Ee(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,c,h]=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:c,r:h}})(Ee(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})),Le=(t,e,i)=>e.reduce(((e,i)=>{var n,s,o;return null!==(s=i.match(Be)?(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:t["*"]})((o=i,Object.fromEntries(Ee(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),Ie=/\?\?/g,Me=(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(Ie,r);const a=o.length?Le(i,o,r):r;return(""+(null!=a?a:"")).trim()})).join(""))(t,e,i,1===n.length&&o?s:n)},Pe=(t,e)=>{const i={},n=new Intl.PluralRules(t);return(t,...s)=>Me(((t,e)=>t[e]||(t[e]=Te(e)))(i,t),n,e,s)};const Oe=(t={},e)=>"string"==typeof t?e.bind(null,t):Object.assign(Object.defineProperty((()=>""),"name",{writable:!0}),t),ze=(t,e)=>new Proxy(Oe(t,e),{get:(t,i)=>i===Symbol.iterator?[][Symbol.iterator].bind(Object.values(t).map((t=>Oe(t,e)))):ze(t[i],e)});const Ze={"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",file:"File",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"},file:{download:"Download",remove:"Delete"},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:"图片",file:"文件",removeColor:"默认"},link:{newLink:"新链接",url:"链接 URL",title:"链接文本",copy:"复制到剪贴板",open:"打开链接",save:"确定",unlink:"取消链接"},image:{view:"查看大图",remove:"删除",previous:"上一张",next:"下一张",close:"关闭 (Esc)",loadingError:"图片加载失败",zoomOut:"缩小",zoomIn:"放大"},file:{download:"下载",remove:"删除"},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:"画像",file:"ファイル",removeColor:"デフォルト"},link:{newLink:"新しいリンク",url:"リンク URL",title:"リンク文字",copy:"クリップボードにコピー",open:"リンクを開く",save:"確認",unlink:"リンクを削除"},image:{view:"大きな画像を見る",remove:"削除",previous:"前の画像",next:"次の画像",close:"閉じる (Esc)",loadingError:"画像を読み込めません",zoomOut:"縮小",zoomIn:"拡大"},file:{download:"ダウンロード",remove:"削除"},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:"이미지",file:"파일",removeColor:"기본색"},link:{newLink:"새 링크",url:"링크 URL",title:"링크 텍스트",copy:"클립보드에 복사",open:"링크 열기",save:"확인",unlink:"링크 제거"},image:{view:"큰 이미지 보기",remove:"삭제",previous:"이전 이미지",next:"다음 이미지",close:"닫기 (Esc)",loadingError:"이미지를 로드할 수 없습니다",zoomOut:"축소",zoomIn:"확대"},file:{download:"다운로드",remove:"삭제"},codeBlock:{langType:"코드언어 선택"}}},Ne=Object.keys(Ze),He={},De={},$e=t=>{He[t]||(He[t]=Ze[t],(t=>{De[t]={}})(t))},Ve=t=>function(t,e,i={}){return ze(e,Pe(t,i))}(t,He[t],De[t]);Ne.forEach($e);class Fe{constructor(t){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.locale=t.locale||Ve("en-US");const e=t.placement||"bottom";if(this.node=L(a`
8
8
  <div class="lake-dropdown lake-${t.menuType}-dropdown" name="${t.name}" placement="${e}">
@@ -15,7 +15,7 @@ var Lake=function(t){"use strict";class e extends HTMLElement{}void 0!==customEl
15
15
  <li value="${r(i.value)}">
16
16
  <div class="lake-dropdown-menu-text">${o}</div>
17
17
  </li>
18
- `);if(t.append(a),"color"===e.menuType&&(a.attr("title",o),a.find(".lake-dropdown-menu-text").css("background-color",i.value)),i.icon){const t=L('<div class="lake-dropdown-menu-icon"></div>');t.append(i.icon),a.prepend(t)}const l=n.get("check");if(l){const t=L('<div class="lake-dropdown-menu-check"></div>');t.append(l),a.prepend(t)}}}showMenu(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-menu");if(e.attr("disabled"))return;const n=Fe.getValue(e);i.find(".lake-dropdown-menu-check").css("visibility","hidden"),i.find("li").each((t=>{const e=L(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");const s=e.get(0).getBoundingClientRect(),o=i.width()-(s.x+s.width),r=s.x+i.width()-window.innerWidth;r+50>0&&(o<0||o<r)?(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=L(s.target).closest("li"),a=o.attr("value");Fe.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);const s="string"==typeof e.tooltip?e.tooltip:e.tooltip(this.locale);n.attr("title",s);const o=n.find(".lake-dropdown-text"),r=n.find(".lake-dropdown-icon");e.icon&&r.append(e.icon),e.accentIcon&&r.append(e.accentIcon);const a=n.find(".lake-dropdown-down-icon");e.downIcon&&a.append(e.downIcon);const l=L('<ul class="lake-dropdown-menu" />');if(l.addClass(`lake-${e.menuType}-dropdown-menu`),Fe.setValue(i,[e.defaultValue]),o.length>0){const i=Fe.getMenuMap(e.menuItems,this.locale);o.text(null!==(t=i.get(e.defaultValue))&&void 0!==t?t:e.defaultValue)}"color"===e.menuType&&this.updateColorAccent(n,e.defaultValue),this.apppendMenuItems(l),i.append(n),i.append(l),this.root.append(i),this.bindEvents()}unmount(){this.node.remove(),document.removeEventListener("click",this.documentClickListener)}}var je=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Re="object"==typeof Ft&&Ft&&Ft.Object===Object&&Ft,We=Re,Ue="object"==typeof self&&self&&self.Object===Object&&self,qe=We||Ue||Function("return this")(),Ke=qe,Ge=function(){return Ke.Date.now()},Xe=/\s/;var Ye=function(t){for(var e=t.length;e--&&Xe.test(t.charAt(e)););return e},Je=Ye,Qe=/^\s+/;var ti=function(t){return t?t.slice(0,Je(t)+1).replace(Qe,""):t},ei=qe.Symbol,ii=ei,ni=Object.prototype,si=ni.hasOwnProperty,oi=ni.toString,ri=ii?ii.toStringTag:void 0;var ai=function(t){var e=si.call(t,ri),i=t[ri];try{t[ri]=void 0;var n=!0}catch(t){}var s=oi.call(t);return n&&(e?t[ri]=i:delete t[ri]),s},li=Object.prototype.toString;var ci=ai,hi=function(t){return li.call(t)},di=ei?ei.toStringTag:void 0;var pi=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":di&&di in Object(t)?ci(t):hi(t)};var ui=function(t){return null!=t&&"object"==typeof t},mi=pi,fi=ui;var gi=ti,vi=je,wi=function(t){return"symbol"==typeof t||fi(t)&&"[object Symbol]"==mi(t)},yi=/^[-+]0x[0-9a-f]+$/i,xi=/^0b[01]+$/i,bi=/^0o[0-7]+$/i,ki=parseInt;var _i=je,Si=Ge,Ci=function(t){if("number"==typeof t)return t;if(wi(t))return NaN;if(vi(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=vi(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=gi(t);var i=xi.test(t);return i||bi.test(t)?ki(t.slice(2),i?2:8):yi.test(t)?NaN:+t},Bi=Math.max,Ai=Math.min;var Ei=function(t,e,i){var n,s,o,r,a,l,c=0,h=!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,c=e,r=t.apply(o,i)}function m(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-c>=o}function f(){var t=Si();if(m(t))return g(t);a=setTimeout(f,function(t){var i=e-(t-l);return d?Ai(i,o-(t-c)):i}(t))}function g(t){return a=void 0,p&&n?u(t):(n=s=void 0,r)}function v(){var t=Si(),i=m(t);if(n=arguments,s=this,l=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(f,e),h?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=Ci(e)||0,_i(i)&&(h=!!i.leading,o=(d="maxWait"in i)?Bi(Ci(i.maxWait)||0,e):o,p="trailing"in i?!!i.trailing:p),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=s=a=void 0},v.flush=function(){return void 0===a?r:g(Si())},v},Ti=jt(Ei);var Li=function(){this.__data__=[],this.size=0};var Ii=function(t,e){return t===e||t!=t&&e!=e},Mi=Ii;var Pi=function(t,e){for(var i=t.length;i--;)if(Mi(t[i][0],e))return i;return-1},Oi=Pi,zi=Array.prototype.splice;var Zi=function(t){var e=this.__data__,i=Oi(e,t);return!(i<0)&&(i==e.length-1?e.pop():zi.call(e,i,1),--this.size,!0)},Ni=Pi;var Hi=function(t){var e=this.__data__,i=Ni(e,t);return i<0?void 0:e[i][1]},Di=Pi;var $i=Pi;var Vi=function(t,e){var i=this.__data__,n=$i(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},Fi=Li,ji=Zi,Ri=Hi,Wi=function(t){return Di(this.__data__,t)>-1},Ui=Vi;function qi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}qi.prototype.clear=Fi,qi.prototype.delete=ji,qi.prototype.get=Ri,qi.prototype.has=Wi,qi.prototype.set=Ui;var Ki=qi,Gi=Ki;var Xi=function(){this.__data__=new Gi,this.size=0};var Yi=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var Ji=function(t){return this.__data__.get(t)};var Qi=function(t){return this.__data__.has(t)},tn=pi,en=je;var nn,sn=function(t){if(!en(t))return!1;var e=tn(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},on=qe["__core-js_shared__"],rn=(nn=/[^.]+$/.exec(on&&on.keys&&on.keys.IE_PROTO||""))?"Symbol(src)_1."+nn:"";var an=function(t){return!!rn&&rn in t},ln=Function.prototype.toString;var cn=function(t){if(null!=t){try{return ln.call(t)}catch(t){}try{return t+""}catch(t){}}return""},hn=sn,dn=an,pn=je,un=cn,mn=/^\[object .+?Constructor\]$/,fn=Function.prototype,gn=Object.prototype,vn=fn.toString,wn=gn.hasOwnProperty,yn=RegExp("^"+vn.call(wn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var xn=function(t){return!(!pn(t)||dn(t))&&(hn(t)?yn:mn).test(un(t))},bn=function(t,e){return null==t?void 0:t[e]};var kn=function(t,e){var i=bn(t,e);return xn(i)?i:void 0},_n=kn(qe,"Map"),Sn=kn(Object,"create"),Cn=Sn;var Bn=function(){this.__data__=Cn?Cn(null):{},this.size=0};var An=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},En=Sn,Tn=Object.prototype.hasOwnProperty;var Ln=function(t){var e=this.__data__;if(En){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return Tn.call(e,t)?e[t]:void 0},In=Sn,Mn=Object.prototype.hasOwnProperty;var Pn=Sn;var On=Bn,zn=An,Zn=Ln,Nn=function(t){var e=this.__data__;return In?void 0!==e[t]:Mn.call(e,t)},Hn=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Pn&&void 0===e?"__lodash_hash_undefined__":e,this};function Dn(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Dn.prototype.clear=On,Dn.prototype.delete=zn,Dn.prototype.get=Zn,Dn.prototype.has=Nn,Dn.prototype.set=Hn;var $n=Dn,Vn=Ki,Fn=_n;var jn=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Rn=function(t,e){var i=t.__data__;return jn(e)?i["string"==typeof e?"string":"hash"]:i.map},Wn=Rn;var Un=Rn;var qn=Rn;var Kn=Rn;var Gn=function(){this.size=0,this.__data__={hash:new $n,map:new(Fn||Vn),string:new $n}},Xn=function(t){var e=Wn(this,t).delete(t);return this.size-=e?1:0,e},Yn=function(t){return Un(this,t).get(t)},Jn=function(t){return qn(this,t).has(t)},Qn=function(t,e){var i=Kn(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function ts(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}ts.prototype.clear=Gn,ts.prototype.delete=Xn,ts.prototype.get=Yn,ts.prototype.has=Jn,ts.prototype.set=Qn;var es=ts,is=Ki,ns=_n,ss=es;var os=Ki,rs=Xi,as=Yi,ls=Ji,cs=Qi,hs=function(t,e){var i=this.__data__;if(i instanceof is){var n=i.__data__;if(!ns||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new ss(n)}return i.set(t,e),this.size=i.size,this};function ds(t){var e=this.__data__=new os(t);this.size=e.size}ds.prototype.clear=rs,ds.prototype.delete=as,ds.prototype.get=ls,ds.prototype.has=cs,ds.prototype.set=hs;var ps=ds;var us=es,ms=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fs=function(t){return this.__data__.has(t)};function gs(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new us;++e<i;)this.add(t[e])}gs.prototype.add=gs.prototype.push=ms,gs.prototype.has=fs;var vs=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1};var ws=gs,ys=vs,xs=function(t,e){return t.has(e)};var bs=function(t,e,i,n,s,o){var r=1&i,a=t.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(t),h=o.get(e);if(c&&h)return c==e&&h==t;var d=-1,p=!0,u=2&i?new ws:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var m=t[d],f=e[d];if(n)var g=r?n(f,m,d,e,t,o):n(m,f,d,t,e,o);if(void 0!==g){if(g)continue;p=!1;break}if(u){if(!ys(e,(function(t,e){if(!xs(u,e)&&(m===t||s(m,t,i,n,o)))return u.push(e)}))){p=!1;break}}else if(m!==f&&!s(m,f,i,n,o)){p=!1;break}}return o.delete(t),o.delete(e),p};var ks=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i};var _s=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i},Ss=qe.Uint8Array,Cs=Ii,Bs=bs,As=ks,Es=_s,Ts=ei?ei.prototype:void 0,Ls=Ts?Ts.valueOf:void 0;var Is=function(t,e,i,n,s,o,r){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new Ss(t),new Ss(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Cs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=As;case"[object Set]":var l=1&n;if(a||(a=Es),t.size!=e.size&&!l)return!1;var c=r.get(t);if(c)return c==e;n|=2,r.set(t,e);var h=Bs(a(t),a(e),n,s,o,r);return r.delete(t),h;case"[object Symbol]":if(Ls)return Ls.call(t)==Ls.call(e)}return!1};var Ms=function(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t},Ps=Array.isArray,Os=Ms,zs=Ps;var Zs=function(t,e,i){var n=e(t);return zs(t)?n:Os(n,i(t))};var Ns=function(t,e){for(var i=-1,n=null==t?0:t.length,s=0,o=[];++i<n;){var r=t[i];e(r,i,t)&&(o[s++]=r)}return o};var Hs=Ns,Ds=function(){return[]},$s=Object.prototype.propertyIsEnumerable,Vs=Object.getOwnPropertySymbols,Fs=Vs?function(t){return null==t?[]:(t=Object(t),Hs(Vs(t),(function(e){return $s.call(t,e)})))}:Ds;var js=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n},Rs=pi,Ws=ui;var Us=function(t){return Ws(t)&&"[object Arguments]"==Rs(t)},qs=ui,Ks=Object.prototype,Gs=Ks.hasOwnProperty,Xs=Ks.propertyIsEnumerable,Ys=Us(function(){return arguments}())?Us:function(t){return qs(t)&&Gs.call(t,"callee")&&!Xs.call(t,"callee")},Js=Ys,Qs={exports:{}};var to=function(){return!1};!function(t,e){var i=qe,n=to,s=e&&!e.nodeType&&e,o=s&&t&&!t.nodeType&&t,r=o&&o.exports===s?i.Buffer:void 0,a=(r?r.isBuffer:void 0)||n;t.exports=a}(Qs,Qs.exports);var eo=Qs.exports,io=/^(?:0|[1-9]\d*)$/;var no=function(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&io.test(t))&&t>-1&&t%1==0&&t<e};var so=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},oo=pi,ro=so,ao=ui,lo={};lo["[object Float32Array]"]=lo["[object Float64Array]"]=lo["[object Int8Array]"]=lo["[object Int16Array]"]=lo["[object Int32Array]"]=lo["[object Uint8Array]"]=lo["[object Uint8ClampedArray]"]=lo["[object Uint16Array]"]=lo["[object Uint32Array]"]=!0,lo["[object Arguments]"]=lo["[object Array]"]=lo["[object ArrayBuffer]"]=lo["[object Boolean]"]=lo["[object DataView]"]=lo["[object Date]"]=lo["[object Error]"]=lo["[object Function]"]=lo["[object Map]"]=lo["[object Number]"]=lo["[object Object]"]=lo["[object RegExp]"]=lo["[object Set]"]=lo["[object String]"]=lo["[object WeakMap]"]=!1;var co=function(t){return ao(t)&&ro(t.length)&&!!lo[oo(t)]};var ho=function(t){return function(e){return t(e)}},po={exports:{}};!function(t,e){var i=Re,n=e&&!e.nodeType&&e,s=n&&t&&!t.nodeType&&t,o=s&&s.exports===n&&i.process,r=function(){try{var t=s&&s.require&&s.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=r}(po,po.exports);var uo=po.exports,mo=co,fo=ho,go=uo&&uo.isTypedArray,vo=go?fo(go):mo,wo=js,yo=Js,xo=Ps,bo=eo,ko=no,_o=vo,So=Object.prototype.hasOwnProperty;var Co=function(t,e){var i=xo(t),n=!i&&yo(t),s=!i&&!n&&bo(t),o=!i&&!n&&!s&&_o(t),r=i||n||s||o,a=r?wo(t.length,String):[],l=a.length;for(var c in t)!e&&!So.call(t,c)||r&&("length"==c||s&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ko(c,l))||a.push(c);return a},Bo=Object.prototype;var Ao=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Bo)};var Eo=function(t,e){return function(i){return t(e(i))}}(Object.keys,Object),To=Ao,Lo=Eo,Io=Object.prototype.hasOwnProperty;var Mo=sn,Po=so;var Oo=Co,zo=function(t){if(!To(t))return Lo(t);var e=[];for(var i in Object(t))Io.call(t,i)&&"constructor"!=i&&e.push(i);return e},Zo=function(t){return null!=t&&Po(t.length)&&!Mo(t)};var No=Zs,Ho=Fs,Do=function(t){return Zo(t)?Oo(t):zo(t)};var $o=function(t){return No(t,Do,Ho)},Vo=Object.prototype.hasOwnProperty;var Fo=function(t,e,i,n,s,o){var r=1&i,a=$o(t),l=a.length;if(l!=$o(e).length&&!r)return!1;for(var c=l;c--;){var h=a[c];if(!(r?h in e:Vo.call(e,h)))return!1}var d=o.get(t),p=o.get(e);if(d&&p)return d==e&&p==t;var u=!0;o.set(t,e),o.set(e,t);for(var m=r;++c<l;){var f=t[h=a[c]],g=e[h];if(n)var v=r?n(g,f,h,e,t,o):n(f,g,h,t,e,o);if(!(void 0===v?f===g||s(f,g,i,n,o):v)){u=!1;break}m||(m="constructor"==h)}if(u&&!m){var w=t.constructor,y=e.constructor;w==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof y&&y instanceof y||(u=!1)}return o.delete(t),o.delete(e),u},jo=kn(qe,"DataView"),Ro=_n,Wo=kn(qe,"Promise"),Uo=kn(qe,"Set"),qo=kn(qe,"WeakMap"),Ko=pi,Go=cn,Xo="[object Map]",Yo="[object Promise]",Jo="[object Set]",Qo="[object WeakMap]",tr="[object DataView]",er=Go(jo),ir=Go(Ro),nr=Go(Wo),sr=Go(Uo),or=Go(qo),rr=Ko;(jo&&rr(new jo(new ArrayBuffer(1)))!=tr||Ro&&rr(new Ro)!=Xo||Wo&&rr(Wo.resolve())!=Yo||Uo&&rr(new Uo)!=Jo||qo&&rr(new qo)!=Qo)&&(rr=function(t){var e=Ko(t),i="[object Object]"==e?t.constructor:void 0,n=i?Go(i):"";if(n)switch(n){case er:return tr;case ir:return Xo;case nr:return Yo;case sr:return Jo;case or:return Qo}return e});var ar=ps,lr=bs,cr=Is,hr=Fo,dr=rr,pr=Ps,ur=eo,mr=vo,fr="[object Arguments]",gr="[object Array]",vr="[object Object]",wr=Object.prototype.hasOwnProperty;var yr=function(t,e,i,n,s,o){var r=pr(t),a=pr(e),l=r?gr:dr(t),c=a?gr:dr(e),h=(l=l==fr?vr:l)==vr,d=(c=c==fr?vr:c)==vr,p=l==c;if(p&&ur(t)){if(!ur(e))return!1;r=!0,h=!1}if(p&&!h)return o||(o=new ar),r||mr(t)?lr(t,e,i,n,s,o):cr(t,e,l,i,n,s,o);if(!(1&i)){var u=h&&wr.call(t,"__wrapped__"),m=d&&wr.call(e,"__wrapped__");if(u||m){var f=u?t.value():t,g=m?e.value():e;return o||(o=new ar),s(f,g,i,n,o)}}return!!p&&(o||(o=new ar),hr(t,e,i,n,s,o))},xr=ui;var br=function t(e,i,n,s,o){return e===i||(null==e||null==i||!xr(e)&&!xr(i)?e!=e&&i!=i:yr(e,i,n,s,t,o))},kr=br;var _r=jt((function(t,e){return kr(t,e)}));function Sr(t){const e=t.get(0),i={};if(e.hasAttributes())for(const t of e.attributes)i[t.name]=t.value;return i}class Cr{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 I(t)}return new I}sync(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}updateByRange(){const t=this.getRangeFromNativeSelection();this.range.get()!==t.get()&&(this.range=t)}updateByBookmark(){const t=this.range,e=this.container,i=e.find("lake-box[focus]");if(i.length>0)return he(t,{anchor:new T,focus:i}),void this.sync();he(t,{anchor:e.find('lake-bookmark[type="anchor"]'),focus:e.find('lake-bookmark[type="focus"]')}),this.sync()}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:Sr(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:Sr(e),styles:p(e.attr("style"))}),e=e.first()}}(t,this.range),t}insertBookmark(){return le(this.range)}toBookmark(t){return he(this.range,t)}insertNode(t){return ae(this.range,t)}insertFragment(t){return ue(this.range,t)}insertContents(t){return me(this.range,t)}deleteContents(){return pe(this.range)}setBlocks(t){return fe(this.range,t)}splitBlock(){return ge(this.range)}splitMarks(t){return ye(this.range,t)}addMark(t){return be(this.range,t)}removeMark(t){return _e(this.range,t)}fixList(){return de(this.range)}insertLink(t){return Se(this.range,t)}}class Br{constructor(t){this.commandMap=new Map,this.event=new Wt,this.selection=t}add(t,e){this.commandMap.set(t,e)}delete(t){this.commandMap.delete(t)}getNames(){return Array.from(this.commandMap.keys())}has(t){return void 0!==this.commandMap.get(t)}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),B(`Command '${t}' executed`)}}var Ar,Er={exports:{}};Ar=Er,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,c,h,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,c=u,h=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,c),m=e(m,h),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 c(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 h(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(c(t),8*t.length))}(d(t))}function u(t,e){return function(t,e){var i,n,s=c(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(c(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):h(u(e,t)):i?p(t):h(p(t))}Ar.exports?Ar.exports=m:t.md5=m}(Ft);var Tr=jt(Er.exports);class Lr{constructor(t){this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new Wt,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 oe(t).getHTML()}addIdToBoxes(t){t.find("lake-box").each((t=>{const e=new T(t),i=Tr(`${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=pt.get(e.id);if(!t)return;t.delete(n.id)}}},n=t.clone(!0);this.addIdToBoxes(e),this.addIdToBoxes(n),ht(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=>{Jt(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),le(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.updateByBookmark(),B(`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.updateByBookmark(),B(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(t=!0){if(!this.canSave)return;const e=this.cloneContainer(),i=this.getValue(e);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(i)||(this.list.splice(this.index,1/0,e),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),t&&this.event.emit("save",m(i)),B(`History saved, the last index is ${this.index}`))}}var Ir=["Shift","Meta","Alt","Control"],Mr="object"==typeof navigator?navigator.platform:"",Pr=/Mac|iPod|iPhone|iPad/.test(Mr),Or=Pr?"Meta":"Control",zr="Win32"===Mr?["Control","Alt"]:Pr?["Alt"]:[];function Zr(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||zr.includes(e)&&t.getModifierState("AltGraph"))}function Nr(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?Or:t})),i]}))}function Hr(t,e){var i;void 0===e&&(e={});var n=null!=(i=e.timeout)?i:1e3,s=Object.keys(t).map((function(e){return[Nr(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!Zr(t,e)}))||Ir.find((function(i){return!e[0].includes(i)&&e[1]!==i&&Zr(t,i)})))}(t,s[0])?Zr(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 Dr=new Map([["#","shift+#"]]);class $r{constructor(t){this.keydownEventList=[],this.keyupEventList=[],this.container=t}normalizeType(t){var e;return t=(t=null!==(e=Dr.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=Hr({[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=Hr({[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 Vr={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,onMessage:(t,e)=>{"success"!==t?"warning"!==t?"error"===t&&console.error(e):console.warn(e):console.log(e)}};class Fr{constructor(t){if(this.unsavedInputData="",this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.isComposing=!1,this.event=new Wt,this.box=Fr.box,this.copyListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("copy",t)},this.cutListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("cut",t)},this.pasteListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("paste",t)},this.beforeunloadListener=()=>{this.history.save()},this.selectionchangeListener=()=>{this.selection.updateByRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=t=>{const e=new T(t.target);!e.get(0).isConnected||e.closest(".lake-popup").length>0||this.event.emit("click",e)},this.resizeListener=()=>{this.event.emit("resize")},this.updateBoxSelectionStyle=Ti((()=>{if(0===this.root.first().length)return;const t=this.selection.range,e=t.clone();e.adaptBox(),this.container.find("lake-box").each((i=>{const n=Jt(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-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(e.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(t.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}})),this.event.emit("boxselectionstylechange")}),50,{leading:!1,trailing:!0,maxWait:50}),this.emitStateChangeEvent=Ti((()=>{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)}}const o={appliedItems:e,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};_r(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),100,{leading:!1,trailing:!0,maxWait:100}),this.emitChangeEvent=t=>{this.rectifyContent(),this.emitStateChangeEvent(),this.togglePlaceholderClass(t),this.scrollToCaret(),this.event.emit("change",t)},!t.root)throw new Error("The root of the config must be specified.");this.root=L(t.root),this.toolbar=t.toolbar,this.config=Object.assign({},Vr);for(const e of Object.keys(t))this.config[e]=t[e];this.containerWrapper=L('<div class="lake-container-wrapper" />'),this.container=L('<div class="lake-container" />'),this.overlayContainer=L('<div class="lake-overlay" />'),this.popupContainer=L('<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.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Cr(this.container),this.command=new Br(this.selection),this.history=new Lr(this.selection),this.keystroke=new $r(this.container),qt.set(this.container.id,this)}togglePlaceholderClass(t){const e="lake-show-placeholder";"<p><br /></p>"===(t=m(t)).replace("<focus />","")?this.container.addClass(e):this.container.removeClass(e)}inputInBoxStrip(){const t=this.selection,e=t.range,i=e.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Jt(n).type)e.isBoxStart?(e.setStartBefore(n),e.collapseToStart()):(e.setStartAfter(n),e.collapseToStart());else{const t=L("<p />");e.isBoxStart?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",(t=>{const e=t,i=this.selection.range;(i.isBoxStart||i.isBoxEnd||"insertText"!==e.inputType&&"insertCompositionText"!==e.inputType)&&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(i.isBoxStart||i.isBoxEnd)return this.inputInBoxStrip(),this.history.save(),void this.event.emit("input",e);if(("insertText"===e.inputType||"insertCompositionText"===e.inputType)&&(this.unsavedInputData+=null!==(t=e.data)&&void 0!==t?t:"",this.unsavedInputData.length<this.config.minChangeSize))return this.event.emit("input",e),void this.emitChangeEvent(this.getValue());this.history.save(),this.event.emit("input",e)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(t=>{this.box.renderAll(this.container),this.emitChangeEvent(t)})),this.history.event.on("redo",(t=>{this.box.renderAll(this.container),this.emitChangeEvent(t)})),this.history.event.on("save",(t=>{this.box.rectifyInstances(this.container),this.emitChangeEvent(t)}))}get hasFocus(){const t=document.activeElement;return!!t&&L(t).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Ve(this.config.lang)}rectifyContent(){let t=this.container.children();for(const e of t)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),B("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 B("Rectifying content: default paragraph was added");if(1===t.length){const e=t[0];if(e.isVoid){const t=L("<p />");e.before(t),t.append(e),this.selection.range.shrinkAfter(t),B("Rectifying content: void element was wrapped in paragraph")}}}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(!1),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}setPluginConfig(t,e){this.config[t]||(this.config[t]={});for(const i of Object.keys(e))void 0===this.config[t][i]&&(this.config[t][i]=e[i])}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const t=this.selection.range.getRect(),e=this.container.get(0).getBoundingClientRect(),i=L('<div class="lake-artificial-caret" />'),n=t.x-e.x,s=t.y-e.y;let o,r,a,l;i.css({position:"absolute",top:`${s}px`,left:`${n}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(i);const c=this.container.closestScroller();if(c.length>0){const t=c.get(0),e=t.getBoundingClientRect();o=t.scrollLeft,r=t.scrollTop,a=e.width,l=e.height}else{const t=this.containerWrapper.get(0);o=window.scrollX,r=window.scrollY,a=window.innerWidth-t.offsetLeft,l=window.innerHeight-t.offsetTop}let h=!1,d=!0;(n<o||n>o+a)&&(h=!0),s<r?(h=!0,d=!0):s>r+l&&(h=!0,d=!1),h&&i.get(0).scrollIntoView(d),i.remove()}setValue(t){t=u(t);const e=new oe(t),i=e.getFragment();this.container.empty(),this.togglePlaceholderClass(e.getHTML()),this.container.append(i),Fr.box.renderAll(this.container),this.selection.updateByBookmark()}getValue(){const t=this.selection.insertBookmark();let e=new oe(this.container).getHTML();return e=m(e),this.selection.toBookmark(t),e}selectBox(t){let e=t;e=t instanceof Yt?t.node:t,this.selection.range.selectBox(e)}insertBox(t,e){const i=function(t,e,i){if(t.commonAncestor.isOutside)return null;const n=Jt(e);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return ue(t,s),n.render(),t.selectBoxEnd(n.node),n;const o=ge(t);return o.start&&(t.setEndAfter(o.start),t.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),ue(t,s),n.render(),t.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.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.container).set(i.node.id,i),i}removeBox(t=null){if(t&&this.selectBox(t),t=function(t){if(t.commonAncestor.isOutside)return null;const e=t.commonAncestor.closest("lake-box");if(0===e.length)return null;const i=Jt(e);if("block"===i.type){const n=L("<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,L("<br />")),t.shrinkAfter(n)),i}(this.selection.range),t){this.box.getInstances(this.container).delete(t.node.id)}return t}render(){const t=u(this.config.value),e=new oe(t),i=e.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),L(document.body).append(this.popupContainer),this.togglePlaceholderClass(e.getHTML()),this.container.append(i),Fr.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save()),Fr.box.renderAll(this.container),this.toolbar&&this.toolbar.render(this),document.addEventListener("copy",this.copyListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),window.addEventListener("resize",this.resizeListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.event.removeAllListeners(),this.command.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener),window.removeEventListener("resize",this.resizeListener))}}Fr.version="0.1.9",Fr.box=new class{add(t){Ut.set(t.name,t)}remove(t){Ut.delete(t)}getNames(){return Array.from(Ut.keys())}getInstances(t){let e=pt.get(t.id);return e||(e=new Map,pt.set(t.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))}renderAll(t){this.rectifyInstances(t);const e=this.getInstances(t);t.find("lake-box").each((t=>{const i=L(t);if(e.get(i.id))return;Jt(i).render()}))}},Fr.plugin=new class{constructor(){this.pluginList=[]}add(t){this.pluginList.push(t)}loadAll(t){this.pluginList.forEach((e=>{e(t)}))}};const jr=[{icon:n.get("numberedList"),value:"numbered",text:t=>t.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:t=>t.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:t=>t.toolbar.checklist()}],Rr=[{icon:n.get("alignLeft"),value:"left",text:t=>t.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:t=>t.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:t=>t.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:t=>t.toolbar.alignJustify()}],Wr=[{icon:n.get("increaseIndent"),value:"increase",text:t=>t.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:t=>t.toolbar.decreaseIndent()}],Ur=[{icon:n.get("italic"),value:"italic",text:t=>t.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:t=>t.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:t=>t.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:t=>t.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:t=>t.toolbar.subscript()},{icon:n.get("code"),value:"code",text:t=>t.toolbar.code()}],qr=["#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"],Kr=[{icon:n.get("removeFormat"),value:"",text:t=>t.toolbar.removeColor()}];for(const t of qr)Kr.push({value:t.toLowerCase(),text:t.toUpperCase()});const Gr=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Xr=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:t=>t.toolbar.undo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:t=>t.toolbar.redo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:t=>t.toolbar.selectAll(),onClick:(t,e)=>{t.command.execute(e)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:t=>t.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:t=>t.toolbar.blockQuote(),onClick:(t,e)=>{t.command.execute(e)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.toolbar.increaseIndent(),onClick:t=>{t.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:t=>t.toolbar.decreaseIndent(),onClick:t=>{t.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:t=>t.toolbar.bold(),onClick:(t,e)=>{t.command.execute(e)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:t=>t.toolbar.italic(),onClick:(t,e)=>{t.command.execute(e)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:t=>t.toolbar.underline(),onClick:(t,e)=>{t.command.execute(e)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:t=>t.toolbar.strikethrough(),onClick:(t,e)=>{t.command.execute(e)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:t=>t.toolbar.superscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:t=>t.toolbar.subscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"code",type:"button",icon:n.get("code"),tooltip:t=>t.toolbar.code(),onClick:(t,e)=>{t.command.execute(e)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:t=>t.toolbar.removeFormat(),onClick:(t,e)=>{t.command.execute(e)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:t=>t.toolbar.formatPainter(),onClick:(t,e)=>{t.command.execute(e)}},{name:"link",type:"button",icon:n.get("link"),tooltip:t=>t.toolbar.link(),onClick:(t,e)=>{t.command.execute(e)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:t=>t.toolbar.hr(),onClick:(t,e)=>{t.command.execute(e)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:t=>t.toolbar.codeBlock(),onClick:(t,e)=>{t.command.execute(e)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:t=>t.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:t=>`<span style="font-weight: bold; font-size: 26px;">${t.toolbar.heading1()}</span>`},{value:"h2",text:t=>`<span style="font-weight: bold; font-size: 24px;">${t.toolbar.heading2()}</span>`},{value:"h3",text:t=>`<span style="font-weight: bold; font-size: 22px;">${t.toolbar.heading3()}</span>`},{value:"h4",text:t=>`<span style="font-weight: bold; font-size: 20px;">${t.toolbar.heading4()}</span>`},{value:"h5",text:t=>`<span style="font-weight: bold; font-size: 18px;">${t.toolbar.heading5()}</span>`},{value:"h6",text:t=>`<span style="font-weight: bold; font-size: 16px;">${t.toolbar.heading6()}</span>`},{value:"p",text:t=>t.toolbar.paragraph()}],onSelect:(t,e)=>{t.command.execute("heading",e)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),defaultValue:"",tooltip:t=>t.toolbar.list(),width:"auto",menuType:"list",menuItems:jr,onSelect:(t,e)=>{t.command.execute("list",e)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),defaultValue:"",tooltip:t=>t.toolbar.align(),width:"auto",menuType:"list",menuItems:Rr,onSelect:(t,e)=>{t.command.execute("align",e)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),defaultValue:"",tooltip:t=>t.toolbar.indent(),width:"auto",menuType:"list",menuItems:Wr,onSelect:(t,e)=>{t.command.execute("indent",e)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:t=>t.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:t=>t.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:t=>t.toolbar.moreStyle(),width:"auto",menuType:"list",menuItems:Ur,selectedValues:t=>{var e;const i=[];for(const n of t)if(n.node.isMark){const t=null!==(e=Gr.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:t=>t.toolbar.fontColor(),width:"auto",menuType:"color",menuItems:Kr,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:t=>t.toolbar.highlight(),width:"auto",menuType:"color",menuItems:Kr,onSelect:(t,e)=>{t.command.execute("highlight",e)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:t=>t.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:t=>t.toolbar.file(),accept:"*",multiple:!0}];function Yr(t){const{editor:e,name:i,file:n,onError:s,onSuccess:o}=t,{requestMethod:r,requestAction:a,requestTypes:l}=e.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File '${n.name}' is not allowed for uploading.`),new Error(`Cannot upload file '${n.name}' because its type '${n.type}' is not found in ['${l.join("', '")}'].`);const c=e.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified}),h=te({onProgress:t=>{const e=c.node.find(".lake-percent"),i=Math.round(t.percent);e.text(`${i<100?i:99} %`)},onError:(t,e)=>{B(t.toString(),e),c.updateValue("status","error"),c.render(),s&&s(t.toString())},onSuccess:t=>{if(!t.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:t.url}),c.render(),e.history.save(),o&&o()},file:n,action:a,method:r});return c.setData("xhr",h),c}const Jr=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Qr=new Map;Xr.forEach((t=>{Qr.set(t.name,t)}));function ta(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())}))}
18
+ `);if(t.append(a),"color"===e.menuType&&(a.attr("title",o),a.find(".lake-dropdown-menu-text").css("background-color",i.value)),i.icon){const t=L('<div class="lake-dropdown-menu-icon"></div>');t.append(i.icon),a.prepend(t)}const l=n.get("check");if(l){const t=L('<div class="lake-dropdown-menu-check"></div>');t.append(l),a.prepend(t)}}}showMenu(){const t=this.config,e=this.node,i=e.find(".lake-dropdown-menu");if(e.attr("disabled"))return;const n=Fe.getValue(e);i.find(".lake-dropdown-menu-check").css("visibility","hidden"),i.find("li").each((t=>{const e=L(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");const s=e.get(0).getBoundingClientRect(),o=i.width()-(s.x+s.width),r=s.x+i.width()-window.innerWidth;r+50>0&&(o<0||o<r)?(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=L(s.target).closest("li"),a=o.attr("value");Fe.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);const s="string"==typeof e.tooltip?e.tooltip:e.tooltip(this.locale);n.attr("title",s);const o=n.find(".lake-dropdown-text"),r=n.find(".lake-dropdown-icon");e.icon&&r.append(e.icon),e.accentIcon&&r.append(e.accentIcon);const a=n.find(".lake-dropdown-down-icon");e.downIcon&&a.append(e.downIcon);const l=L('<ul class="lake-dropdown-menu" />');if(l.addClass(`lake-${e.menuType}-dropdown-menu`),Fe.setValue(i,[e.defaultValue]),o.length>0){const i=Fe.getMenuMap(e.menuItems,this.locale);o.text(null!==(t=i.get(e.defaultValue))&&void 0!==t?t:e.defaultValue)}"color"===e.menuType&&this.updateColorAccent(n,e.defaultValue),this.apppendMenuItems(l),i.append(n),i.append(l),this.root.append(i),this.bindEvents()}unmount(){this.node.remove(),document.removeEventListener("click",this.documentClickListener)}}var je=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Re="object"==typeof Ft&&Ft&&Ft.Object===Object&&Ft,We=Re,Ue="object"==typeof self&&self&&self.Object===Object&&self,qe=We||Ue||Function("return this")(),Ke=qe,Ge=function(){return Ke.Date.now()},Xe=/\s/;var Je=function(t){for(var e=t.length;e--&&Xe.test(t.charAt(e)););return e},Ye=Je,Qe=/^\s+/;var ti=function(t){return t?t.slice(0,Ye(t)+1).replace(Qe,""):t},ei=qe.Symbol,ii=ei,ni=Object.prototype,si=ni.hasOwnProperty,oi=ni.toString,ri=ii?ii.toStringTag:void 0;var ai=function(t){var e=si.call(t,ri),i=t[ri];try{t[ri]=void 0;var n=!0}catch(t){}var s=oi.call(t);return n&&(e?t[ri]=i:delete t[ri]),s},li=Object.prototype.toString;var ci=ai,hi=function(t){return li.call(t)},di=ei?ei.toStringTag:void 0;var pi=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":di&&di in Object(t)?ci(t):hi(t)};var ui=function(t){return null!=t&&"object"==typeof t},mi=pi,fi=ui;var gi=ti,vi=je,yi=function(t){return"symbol"==typeof t||fi(t)&&"[object Symbol]"==mi(t)},wi=/^[-+]0x[0-9a-f]+$/i,xi=/^0b[01]+$/i,bi=/^0o[0-7]+$/i,ki=parseInt;var _i=je,Si=Ge,Ci=function(t){if("number"==typeof t)return t;if(yi(t))return NaN;if(vi(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=vi(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=gi(t);var i=xi.test(t);return i||bi.test(t)?ki(t.slice(2),i?2:8):wi.test(t)?NaN:+t},Bi=Math.max,Ai=Math.min;var Ei=function(t,e,i){var n,s,o,r,a,l,c=0,h=!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,c=e,r=t.apply(o,i)}function m(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-c>=o}function f(){var t=Si();if(m(t))return g(t);a=setTimeout(f,function(t){var i=e-(t-l);return d?Ai(i,o-(t-c)):i}(t))}function g(t){return a=void 0,p&&n?u(t):(n=s=void 0,r)}function v(){var t=Si(),i=m(t);if(n=arguments,s=this,l=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(f,e),h?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=Ci(e)||0,_i(i)&&(h=!!i.leading,o=(d="maxWait"in i)?Bi(Ci(i.maxWait)||0,e):o,p="trailing"in i?!!i.trailing:p),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=s=a=void 0},v.flush=function(){return void 0===a?r:g(Si())},v},Ti=jt(Ei);var Li=function(){this.__data__=[],this.size=0};var Ii=function(t,e){return t===e||t!=t&&e!=e},Mi=Ii;var Pi=function(t,e){for(var i=t.length;i--;)if(Mi(t[i][0],e))return i;return-1},Oi=Pi,zi=Array.prototype.splice;var Zi=function(t){var e=this.__data__,i=Oi(e,t);return!(i<0)&&(i==e.length-1?e.pop():zi.call(e,i,1),--this.size,!0)},Ni=Pi;var Hi=function(t){var e=this.__data__,i=Ni(e,t);return i<0?void 0:e[i][1]},Di=Pi;var $i=Pi;var Vi=function(t,e){var i=this.__data__,n=$i(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this},Fi=Li,ji=Zi,Ri=Hi,Wi=function(t){return Di(this.__data__,t)>-1},Ui=Vi;function qi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}qi.prototype.clear=Fi,qi.prototype.delete=ji,qi.prototype.get=Ri,qi.prototype.has=Wi,qi.prototype.set=Ui;var Ki=qi,Gi=Ki;var Xi=function(){this.__data__=new Gi,this.size=0};var Ji=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var Yi=function(t){return this.__data__.get(t)};var Qi=function(t){return this.__data__.has(t)},tn=pi,en=je;var nn,sn=function(t){if(!en(t))return!1;var e=tn(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},on=qe["__core-js_shared__"],rn=(nn=/[^.]+$/.exec(on&&on.keys&&on.keys.IE_PROTO||""))?"Symbol(src)_1."+nn:"";var an=function(t){return!!rn&&rn in t},ln=Function.prototype.toString;var cn=function(t){if(null!=t){try{return ln.call(t)}catch(t){}try{return t+""}catch(t){}}return""},hn=sn,dn=an,pn=je,un=cn,mn=/^\[object .+?Constructor\]$/,fn=Function.prototype,gn=Object.prototype,vn=fn.toString,yn=gn.hasOwnProperty,wn=RegExp("^"+vn.call(yn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var xn=function(t){return!(!pn(t)||dn(t))&&(hn(t)?wn:mn).test(un(t))},bn=function(t,e){return null==t?void 0:t[e]};var kn=function(t,e){var i=bn(t,e);return xn(i)?i:void 0},_n=kn(qe,"Map"),Sn=kn(Object,"create"),Cn=Sn;var Bn=function(){this.__data__=Cn?Cn(null):{},this.size=0};var An=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},En=Sn,Tn=Object.prototype.hasOwnProperty;var Ln=function(t){var e=this.__data__;if(En){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return Tn.call(e,t)?e[t]:void 0},In=Sn,Mn=Object.prototype.hasOwnProperty;var Pn=Sn;var On=Bn,zn=An,Zn=Ln,Nn=function(t){var e=this.__data__;return In?void 0!==e[t]:Mn.call(e,t)},Hn=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Pn&&void 0===e?"__lodash_hash_undefined__":e,this};function Dn(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Dn.prototype.clear=On,Dn.prototype.delete=zn,Dn.prototype.get=Zn,Dn.prototype.has=Nn,Dn.prototype.set=Hn;var $n=Dn,Vn=Ki,Fn=_n;var jn=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Rn=function(t,e){var i=t.__data__;return jn(e)?i["string"==typeof e?"string":"hash"]:i.map},Wn=Rn;var Un=Rn;var qn=Rn;var Kn=Rn;var Gn=function(){this.size=0,this.__data__={hash:new $n,map:new(Fn||Vn),string:new $n}},Xn=function(t){var e=Wn(this,t).delete(t);return this.size-=e?1:0,e},Jn=function(t){return Un(this,t).get(t)},Yn=function(t){return qn(this,t).has(t)},Qn=function(t,e){var i=Kn(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function ts(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}ts.prototype.clear=Gn,ts.prototype.delete=Xn,ts.prototype.get=Jn,ts.prototype.has=Yn,ts.prototype.set=Qn;var es=ts,is=Ki,ns=_n,ss=es;var os=Ki,rs=Xi,as=Ji,ls=Yi,cs=Qi,hs=function(t,e){var i=this.__data__;if(i instanceof is){var n=i.__data__;if(!ns||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new ss(n)}return i.set(t,e),this.size=i.size,this};function ds(t){var e=this.__data__=new os(t);this.size=e.size}ds.prototype.clear=rs,ds.prototype.delete=as,ds.prototype.get=ls,ds.prototype.has=cs,ds.prototype.set=hs;var ps=ds;var us=es,ms=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fs=function(t){return this.__data__.has(t)};function gs(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new us;++e<i;)this.add(t[e])}gs.prototype.add=gs.prototype.push=ms,gs.prototype.has=fs;var vs=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1};var ys=gs,ws=vs,xs=function(t,e){return t.has(e)};var bs=function(t,e,i,n,s,o){var r=1&i,a=t.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(t),h=o.get(e);if(c&&h)return c==e&&h==t;var d=-1,p=!0,u=2&i?new ys:void 0;for(o.set(t,e),o.set(e,t);++d<a;){var m=t[d],f=e[d];if(n)var g=r?n(f,m,d,e,t,o):n(m,f,d,t,e,o);if(void 0!==g){if(g)continue;p=!1;break}if(u){if(!ws(e,(function(t,e){if(!xs(u,e)&&(m===t||s(m,t,i,n,o)))return u.push(e)}))){p=!1;break}}else if(m!==f&&!s(m,f,i,n,o)){p=!1;break}}return o.delete(t),o.delete(e),p};var ks=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t,n){i[++e]=[n,t]})),i};var _s=function(t){var e=-1,i=Array(t.size);return t.forEach((function(t){i[++e]=t})),i},Ss=qe.Uint8Array,Cs=Ii,Bs=bs,As=ks,Es=_s,Ts=ei?ei.prototype:void 0,Ls=Ts?Ts.valueOf:void 0;var Is=function(t,e,i,n,s,o,r){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new Ss(t),new Ss(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Cs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=As;case"[object Set]":var l=1&n;if(a||(a=Es),t.size!=e.size&&!l)return!1;var c=r.get(t);if(c)return c==e;n|=2,r.set(t,e);var h=Bs(a(t),a(e),n,s,o,r);return r.delete(t),h;case"[object Symbol]":if(Ls)return Ls.call(t)==Ls.call(e)}return!1};var Ms=function(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t},Ps=Array.isArray,Os=Ms,zs=Ps;var Zs=function(t,e,i){var n=e(t);return zs(t)?n:Os(n,i(t))};var Ns=function(t,e){for(var i=-1,n=null==t?0:t.length,s=0,o=[];++i<n;){var r=t[i];e(r,i,t)&&(o[s++]=r)}return o};var Hs=Ns,Ds=function(){return[]},$s=Object.prototype.propertyIsEnumerable,Vs=Object.getOwnPropertySymbols,Fs=Vs?function(t){return null==t?[]:(t=Object(t),Hs(Vs(t),(function(e){return $s.call(t,e)})))}:Ds;var js=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n},Rs=pi,Ws=ui;var Us=function(t){return Ws(t)&&"[object Arguments]"==Rs(t)},qs=ui,Ks=Object.prototype,Gs=Ks.hasOwnProperty,Xs=Ks.propertyIsEnumerable,Js=Us(function(){return arguments}())?Us:function(t){return qs(t)&&Gs.call(t,"callee")&&!Xs.call(t,"callee")},Ys=Js,Qs={exports:{}};var to=function(){return!1};!function(t,e){var i=qe,n=to,s=e&&!e.nodeType&&e,o=s&&t&&!t.nodeType&&t,r=o&&o.exports===s?i.Buffer:void 0,a=(r?r.isBuffer:void 0)||n;t.exports=a}(Qs,Qs.exports);var eo=Qs.exports,io=/^(?:0|[1-9]\d*)$/;var no=function(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&io.test(t))&&t>-1&&t%1==0&&t<e};var so=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},oo=pi,ro=so,ao=ui,lo={};lo["[object Float32Array]"]=lo["[object Float64Array]"]=lo["[object Int8Array]"]=lo["[object Int16Array]"]=lo["[object Int32Array]"]=lo["[object Uint8Array]"]=lo["[object Uint8ClampedArray]"]=lo["[object Uint16Array]"]=lo["[object Uint32Array]"]=!0,lo["[object Arguments]"]=lo["[object Array]"]=lo["[object ArrayBuffer]"]=lo["[object Boolean]"]=lo["[object DataView]"]=lo["[object Date]"]=lo["[object Error]"]=lo["[object Function]"]=lo["[object Map]"]=lo["[object Number]"]=lo["[object Object]"]=lo["[object RegExp]"]=lo["[object Set]"]=lo["[object String]"]=lo["[object WeakMap]"]=!1;var co=function(t){return ao(t)&&ro(t.length)&&!!lo[oo(t)]};var ho=function(t){return function(e){return t(e)}},po={exports:{}};!function(t,e){var i=Re,n=e&&!e.nodeType&&e,s=n&&t&&!t.nodeType&&t,o=s&&s.exports===n&&i.process,r=function(){try{var t=s&&s.require&&s.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=r}(po,po.exports);var uo=po.exports,mo=co,fo=ho,go=uo&&uo.isTypedArray,vo=go?fo(go):mo,yo=js,wo=Ys,xo=Ps,bo=eo,ko=no,_o=vo,So=Object.prototype.hasOwnProperty;var Co=function(t,e){var i=xo(t),n=!i&&wo(t),s=!i&&!n&&bo(t),o=!i&&!n&&!s&&_o(t),r=i||n||s||o,a=r?yo(t.length,String):[],l=a.length;for(var c in t)!e&&!So.call(t,c)||r&&("length"==c||s&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ko(c,l))||a.push(c);return a},Bo=Object.prototype;var Ao=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Bo)};var Eo=function(t,e){return function(i){return t(e(i))}}(Object.keys,Object),To=Ao,Lo=Eo,Io=Object.prototype.hasOwnProperty;var Mo=sn,Po=so;var Oo=Co,zo=function(t){if(!To(t))return Lo(t);var e=[];for(var i in Object(t))Io.call(t,i)&&"constructor"!=i&&e.push(i);return e},Zo=function(t){return null!=t&&Po(t.length)&&!Mo(t)};var No=Zs,Ho=Fs,Do=function(t){return Zo(t)?Oo(t):zo(t)};var $o=function(t){return No(t,Do,Ho)},Vo=Object.prototype.hasOwnProperty;var Fo=function(t,e,i,n,s,o){var r=1&i,a=$o(t),l=a.length;if(l!=$o(e).length&&!r)return!1;for(var c=l;c--;){var h=a[c];if(!(r?h in e:Vo.call(e,h)))return!1}var d=o.get(t),p=o.get(e);if(d&&p)return d==e&&p==t;var u=!0;o.set(t,e),o.set(e,t);for(var m=r;++c<l;){var f=t[h=a[c]],g=e[h];if(n)var v=r?n(g,f,h,e,t,o):n(f,g,h,t,e,o);if(!(void 0===v?f===g||s(f,g,i,n,o):v)){u=!1;break}m||(m="constructor"==h)}if(u&&!m){var y=t.constructor,w=e.constructor;y==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(u=!1)}return o.delete(t),o.delete(e),u},jo=kn(qe,"DataView"),Ro=_n,Wo=kn(qe,"Promise"),Uo=kn(qe,"Set"),qo=kn(qe,"WeakMap"),Ko=pi,Go=cn,Xo="[object Map]",Jo="[object Promise]",Yo="[object Set]",Qo="[object WeakMap]",tr="[object DataView]",er=Go(jo),ir=Go(Ro),nr=Go(Wo),sr=Go(Uo),or=Go(qo),rr=Ko;(jo&&rr(new jo(new ArrayBuffer(1)))!=tr||Ro&&rr(new Ro)!=Xo||Wo&&rr(Wo.resolve())!=Jo||Uo&&rr(new Uo)!=Yo||qo&&rr(new qo)!=Qo)&&(rr=function(t){var e=Ko(t),i="[object Object]"==e?t.constructor:void 0,n=i?Go(i):"";if(n)switch(n){case er:return tr;case ir:return Xo;case nr:return Jo;case sr:return Yo;case or:return Qo}return e});var ar=ps,lr=bs,cr=Is,hr=Fo,dr=rr,pr=Ps,ur=eo,mr=vo,fr="[object Arguments]",gr="[object Array]",vr="[object Object]",yr=Object.prototype.hasOwnProperty;var wr=function(t,e,i,n,s,o){var r=pr(t),a=pr(e),l=r?gr:dr(t),c=a?gr:dr(e),h=(l=l==fr?vr:l)==vr,d=(c=c==fr?vr:c)==vr,p=l==c;if(p&&ur(t)){if(!ur(e))return!1;r=!0,h=!1}if(p&&!h)return o||(o=new ar),r||mr(t)?lr(t,e,i,n,s,o):cr(t,e,l,i,n,s,o);if(!(1&i)){var u=h&&yr.call(t,"__wrapped__"),m=d&&yr.call(e,"__wrapped__");if(u||m){var f=u?t.value():t,g=m?e.value():e;return o||(o=new ar),s(f,g,i,n,o)}}return!!p&&(o||(o=new ar),hr(t,e,i,n,s,o))},xr=ui;var br=function t(e,i,n,s,o){return e===i||(null==e||null==i||!xr(e)&&!xr(i)?e!=e&&i!=i:wr(e,i,n,s,t,o))},kr=br;var _r=jt((function(t,e){return kr(t,e)}));function Sr(t){const e=t.get(0),i={};if(e.hasAttributes())for(const t of e.attributes)i[t.name]=t.value;return i}class Cr{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 I(t)}return new I}sync(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}updateByRange(){const t=this.getRangeFromNativeSelection();this.range.get()!==t.get()&&(this.range=t)}updateByBookmark(){const t=this.range,e=this.container,i=e.find("lake-box[focus]");if(i.length>0)return he(t,{anchor:new T,focus:i}),void this.sync();he(t,{anchor:e.find('lake-bookmark[type="anchor"]'),focus:e.find('lake-bookmark[type="focus"]')}),this.sync()}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:Sr(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:Sr(e),styles:p(e.attr("style"))}),e=e.first()}}(t,this.range),t}insertBookmark(){return le(this.range)}toBookmark(t){return he(this.range,t)}insertNode(t){return ae(this.range,t)}insertFragment(t){return ue(this.range,t)}insertContents(t){return me(this.range,t)}deleteContents(){return pe(this.range)}setBlocks(t){return fe(this.range,t)}splitBlock(){return ge(this.range)}splitMarks(t){return we(this.range,t)}addMark(t){return be(this.range,t)}removeMark(t){return _e(this.range,t)}fixList(){return de(this.range)}insertLink(t){return Se(this.range,t)}}class Br{constructor(t){this.commandMap=new Map,this.event=new Wt,this.selection=t}add(t,e){this.commandMap.set(t,e)}delete(t){this.commandMap.delete(t)}getNames(){return Array.from(this.commandMap.keys())}has(t){return void 0!==this.commandMap.get(t)}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),B(`Command '${t}' executed`)}}var Ar,Er={exports:{}};Ar=Er,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,c,h,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,c=u,h=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,c),m=e(m,h),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 c(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 h(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(c(t),8*t.length))}(d(t))}function u(t,e){return function(t,e){var i,n,s=c(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(c(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):h(u(e,t)):i?p(t):h(p(t))}Ar.exports?Ar.exports=m:t.md5=m}(Ft);var Tr=jt(Er.exports);class Lr{constructor(t){this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new Wt,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 oe(t).getHTML()}addIdToBoxes(t){t.find("lake-box").each((t=>{const e=new T(t),i=Tr(`${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=pt.get(e.id);if(!t)return;t.delete(n.id)}}},n=t.clone(!0);this.addIdToBoxes(e),this.addIdToBoxes(n),ht(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=>{Yt(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),le(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.updateByBookmark(),B(`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.updateByBookmark(),B(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(t=!0){if(!this.canSave)return;const e=this.cloneContainer(),i=this.getValue(e);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(i)||(this.list.splice(this.index,1/0,e),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),t&&this.event.emit("save",m(i)),B(`History saved, the last index is ${this.index}`))}}var Ir=["Shift","Meta","Alt","Control"],Mr="object"==typeof navigator?navigator.platform:"",Pr=/Mac|iPod|iPhone|iPad/.test(Mr),Or=Pr?"Meta":"Control",zr="Win32"===Mr?["Control","Alt"]:Pr?["Alt"]:[];function Zr(t,e){return"function"==typeof t.getModifierState&&(t.getModifierState(e)||zr.includes(e)&&t.getModifierState("AltGraph"))}function Nr(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?Or:t})),i]}))}function Hr(t,e){var i;void 0===e&&(e={});var n=null!=(i=e.timeout)?i:1e3,s=Object.keys(t).map((function(e){return[Nr(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!Zr(t,e)}))||Ir.find((function(i){return!e[0].includes(i)&&e[1]!==i&&Zr(t,i)})))}(t,s[0])?Zr(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 Dr=new Map([["#","shift+#"]]);class $r{constructor(t){this.keydownEventList=[],this.keyupEventList=[],this.container=t}normalizeType(t){var e;return t=(t=null!==(e=Dr.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=Hr({[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=Hr({[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 Vr={value:"<p><br /></p>",readonly:!1,spellcheck:!1,tabIndex:0,placeholder:"",indentWithTab:!0,lang:"en-US",minChangeSize:5,onMessage:(t,e)=>{"success"!==t?"warning"!==t?"error"===t&&console.error(e):console.warn(e):console.log(e)}};class Fr{constructor(t){if(this.unsavedInputData="",this.state={appliedItems:[],disabledNameMap:new Map,selectedNameMap:new Map,selectedValuesMap:new Map},this.isComposing=!1,this.event=new Wt,this.box=Fr.box,this.copyListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("copy",t)},this.cutListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("cut",t)},this.pasteListener=t=>{this.selection.range.commonAncestor.closestContainer().get(0)===this.container.get(0)&&this.event.emit("paste",t)},this.beforeunloadListener=()=>{this.history.save()},this.selectionchangeListener=()=>{this.selection.updateByRange(),this.updateBoxSelectionStyle(),this.emitStateChangeEvent()},this.clickListener=t=>{const e=new T(t.target);!e.get(0).isConnected||e.closest(".lake-popup").length>0||this.event.emit("click",e)},this.resizeListener=()=>{this.event.emit("resize")},this.updateBoxSelectionStyle=Ti((()=>{if(0===this.root.first().length)return;const t=this.selection.range,e=t.clone();e.adaptBox(),this.container.find("lake-box").each((i=>{const n=Yt(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-hovered"),s.removeClass("lake-box-selected"),s.removeClass("lake-box-focused"),s.addClass("lake-box-activated"),void n.event.emit("focus");if(e.intersectsNode(n.node))return s.removeClass("lake-box-activated"),void(t.isCollapsed?(s.removeClass("lake-box-hovered"),s.removeClass("lake-box-selected"),s.addClass("lake-box-focused"),n.event.emit("focus")):(s.removeClass("lake-box-focused"),s.addClass("lake-box-selected"),n.event.emit("blur")));s.removeClass("lake-box-activated"),s.removeClass("lake-box-focused"),s.removeClass("lake-box-selected"),n.event.emit("blur")}})),this.event.emit("boxselectionstylechange")}),50,{leading:!1,trailing:!0,maxWait:50}),this.emitStateChangeEvent=Ti((()=>{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)}}const o={appliedItems:e,disabledNameMap:i,selectedNameMap:n,selectedValuesMap:s};_r(o,this.state)||(this.toolbar&&this.toolbar.updateState(o),this.event.emit("statechange",o),this.state=o)}),100,{leading:!1,trailing:!0,maxWait:100}),this.emitChangeEvent=t=>{this.rectifyContent(),this.emitStateChangeEvent(),this.togglePlaceholderClass(t),this.scrollToCaret(),this.event.emit("change",t)},!t.root)throw new Error("The root of the config must be specified.");this.root=L(t.root),this.toolbar=t.toolbar,this.config=Object.assign({},Vr);for(const e of Object.keys(t))this.config[e]=t[e];this.containerWrapper=L('<div class="lake-container-wrapper" />'),this.container=L('<div class="lake-container" />'),this.overlayContainer=L('<div class="lake-overlay" />'),this.popupContainer=L('<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.config.placeholder&&this.container.attr("placeholder",this.config.placeholder),this.selection=new Cr(this.container),this.command=new Br(this.selection),this.history=new Lr(this.selection),this.keystroke=new $r(this.container),qt.set(this.container.id,this)}togglePlaceholderClass(t){const e="lake-show-placeholder";"<p><br /></p>"===(t=m(t)).replace("<focus />","")?this.container.addClass(e):this.container.removeClass(e)}inputInBoxStrip(){const t=this.selection,e=t.range,i=e.startNode.closest(".lake-box-strip"),n=i.closest("lake-box");if("inline"===Yt(n).type)e.isBoxStart?(e.setStartBefore(n),e.collapseToStart()):(e.setStartAfter(n),e.collapseToStart());else{const t=L("<p />");e.isBoxStart?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",(t=>{const e=t,i=this.selection.range;(i.isBoxStart||i.isBoxEnd||"insertText"!==e.inputType&&"insertCompositionText"!==e.inputType)&&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(i.isBoxStart||i.isBoxEnd)return this.inputInBoxStrip(),this.history.save(),void this.event.emit("input",e);if(("insertText"===e.inputType||"insertCompositionText"===e.inputType)&&(this.unsavedInputData+=null!==(t=e.data)&&void 0!==t?t:"",this.unsavedInputData.length<this.config.minChangeSize))return this.event.emit("input",e),void this.emitChangeEvent(this.getValue());this.history.save(),this.event.emit("input",e)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(t=>{this.box.renderAll(this.container),this.emitChangeEvent(t)})),this.history.event.on("redo",(t=>{this.box.renderAll(this.container),this.emitChangeEvent(t)})),this.history.event.on("save",(t=>{this.box.rectifyInstances(this.container),this.emitChangeEvent(t)}))}get hasFocus(){const t=document.activeElement;return!!t&&L(t).closest(".lake-container").get(0)===this.container.get(0)}get locale(){return Ve(this.config.lang)}rectifyContent(){let t=this.container.children();for(const e of t)(e.isBlock||e.isMark)&&""===e.html()&&(e.remove(),B("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 B("Rectifying content: default paragraph was added");if(1===t.length){const e=t[0];if(e.isVoid){const t=L("<p />");e.before(t),t.append(e),this.selection.range.shrinkAfter(t),B("Rectifying content: void element was wrapped in paragraph")}}}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(!1),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}setPluginConfig(t,e){this.config[t]||(this.config[t]={});for(const i of Object.keys(e))void 0===this.config[t][i]&&(this.config[t][i]=e[i])}focus(){this.container.focus()}blur(){this.container.blur()}scrollToCaret(){const t=this.selection.range.getRect(),e=this.container.get(0).getBoundingClientRect(),i=L('<div class="lake-artificial-caret" />'),n=t.x-e.x,s=t.y-e.y;let o,r,a,l;i.css({position:"absolute",top:`${s}px`,left:`${n}px`,width:`${t.width}px`,height:`${t.height}px`,"z-index":"-1"}),this.overlayContainer.find(".lake-artificial-caret").remove(),this.overlayContainer.append(i);const c=this.container.closestScroller();if(c.length>0){const t=c.get(0),e=t.getBoundingClientRect();o=t.scrollLeft,r=t.scrollTop,a=e.width,l=e.height}else{const t=this.containerWrapper.get(0);o=window.scrollX,r=window.scrollY,a=window.innerWidth-t.offsetLeft,l=window.innerHeight-t.offsetTop}let h=!1,d=!0;(n<o||n>o+a)&&(h=!0),s<r?(h=!0,d=!0):s>r+l&&(h=!0,d=!1),h&&i.get(0).scrollIntoView(d),i.remove()}setValue(t){t=u(t);const e=new oe(t),i=e.getFragment();this.container.empty(),this.togglePlaceholderClass(e.getHTML()),this.container.append(i),Fr.box.renderAll(this.container),this.selection.updateByBookmark()}getValue(){const t=this.selection.insertBookmark();let e=new oe(this.container).getHTML();return e=m(e),this.selection.toBookmark(t),e}selectBox(t){let e=t;e=t instanceof Jt?t.node:t,this.selection.range.selectBox(e)}insertBox(t,e){const i=function(t,e,i){if(t.commonAncestor.isOutside)return null;const n=Yt(e);i&&(n.value=i);const s=document.createDocumentFragment();if(s.appendChild(n.node.get(0)),"inline"===n.type)return ue(t,s),n.render(),t.selectBoxEnd(n.node),n;const o=ge(t);return o.start&&(t.setEndAfter(o.start),t.collapseToEnd()),o.end&&o.end.isEmpty&&o.end.remove(),ue(t,s),n.render(),t.selectBoxEnd(n.node),o.start&&o.start.isEmpty&&o.start.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.container).set(i.node.id,i),i}removeBox(t=null){if(t&&this.selectBox(t),t=function(t){if(t.commonAncestor.isOutside)return null;const e=t.commonAncestor.closest("lake-box");if(0===e.length)return null;const i=Yt(e);if("block"===i.type){const n=L("<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,L("<br />")),t.shrinkAfter(n)),i}(this.selection.range),t){this.box.getInstances(this.container).delete(t.node.id)}return t}render(){const t=u(this.config.value),e=new oe(t),i=e.getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),L(document.body).append(this.popupContainer),this.togglePlaceholderClass(e.getHTML()),this.container.append(i),Fr.plugin.loadAll(this),this.readonly||(this.selection.updateByBookmark(),this.history.save()),Fr.box.renderAll(this.container),this.toolbar&&this.toolbar.render(this),document.addEventListener("copy",this.copyListener),this.readonly||(document.addEventListener("cut",this.cutListener),document.addEventListener("paste",this.pasteListener),window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),document.addEventListener("click",this.clickListener),window.addEventListener("resize",this.resizeListener),this.bindInputEvents(),this.bindHistoryEvents())}unmount(){this.event.removeAllListeners(),this.command.event.removeAllListeners(),this.history.event.removeAllListeners(),this.root.empty(),this.popupContainer.remove(),document.removeEventListener("copy",this.copyListener),this.readonly||(document.removeEventListener("cut",this.cutListener),document.removeEventListener("paste",this.pasteListener),window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener),document.removeEventListener("click",this.clickListener),window.removeEventListener("resize",this.resizeListener))}}Fr.version="0.1.10",Fr.box=new class{add(t){Ut.set(t.name,t)}remove(t){Ut.delete(t)}getNames(){return Array.from(Ut.keys())}getInstances(t){let e=pt.get(t.id);return e||(e=new Map,pt.set(t.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))}renderAll(t){this.rectifyInstances(t);const e=this.getInstances(t);t.find("lake-box").each((t=>{const i=L(t);if(e.get(i.id))return;Yt(i).render()}))}},Fr.plugin=new class{constructor(){this.pluginList=[]}add(t){this.pluginList.push(t)}loadAll(t){this.pluginList.forEach((e=>{e(t)}))}};const jr=[{icon:n.get("numberedList"),value:"numbered",text:t=>t.toolbar.numberedList()},{icon:n.get("bulletedList"),value:"bulleted",text:t=>t.toolbar.bulletedList()},{icon:n.get("checklist"),value:"checklist",text:t=>t.toolbar.checklist()}],Rr=[{icon:n.get("alignLeft"),value:"left",text:t=>t.toolbar.alignLeft()},{icon:n.get("alignCenter"),value:"center",text:t=>t.toolbar.alignCenter()},{icon:n.get("alignRight"),value:"right",text:t=>t.toolbar.alignRight()},{icon:n.get("alignJustify"),value:"justify",text:t=>t.toolbar.alignJustify()}],Wr=[{icon:n.get("increaseIndent"),value:"increase",text:t=>t.toolbar.increaseIndent()},{icon:n.get("decreaseIndent"),value:"decrease",text:t=>t.toolbar.decreaseIndent()}],Ur=[{icon:n.get("italic"),value:"italic",text:t=>t.toolbar.italic()},{icon:n.get("underline"),value:"underline",text:t=>t.toolbar.underline()},{icon:n.get("strikethrough"),value:"strikethrough",text:t=>t.toolbar.strikethrough()},{icon:n.get("superscript"),value:"superscript",text:t=>t.toolbar.superscript()},{icon:n.get("subscript"),value:"subscript",text:t=>t.toolbar.subscript()},{icon:n.get("code"),value:"code",text:t=>t.toolbar.code()}],qr=["#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"],Kr=[{icon:n.get("removeFormat"),value:"",text:t=>t.toolbar.removeColor()}];for(const t of qr)Kr.push({value:t.toLowerCase(),text:t.toUpperCase()});const Gr=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Xr=[{name:"undo",type:"button",icon:n.get("undo"),tooltip:t=>t.toolbar.undo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"redo",type:"button",icon:n.get("redo"),tooltip:t=>t.toolbar.redo(),onClick:(t,e)=>{t.command.execute(e)}},{name:"selectAll",type:"button",icon:n.get("selectAll"),tooltip:t=>t.toolbar.selectAll(),onClick:(t,e)=>{t.command.execute(e)}},{name:"paragraph",type:"button",icon:n.get("paragraph"),tooltip:t=>t.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:t=>t.toolbar.blockQuote(),onClick:(t,e)=>{t.command.execute(e)}},{name:"numberedList",type:"button",icon:n.get("numberedList"),tooltip:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.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:t=>t.toolbar.increaseIndent(),onClick:t=>{t.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:n.get("decreaseIndent"),tooltip:t=>t.toolbar.decreaseIndent(),onClick:t=>{t.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:n.get("bold"),tooltip:t=>t.toolbar.bold(),onClick:(t,e)=>{t.command.execute(e)}},{name:"italic",type:"button",icon:n.get("italic"),tooltip:t=>t.toolbar.italic(),onClick:(t,e)=>{t.command.execute(e)}},{name:"underline",type:"button",icon:n.get("underline"),tooltip:t=>t.toolbar.underline(),onClick:(t,e)=>{t.command.execute(e)}},{name:"strikethrough",type:"button",icon:n.get("strikethrough"),tooltip:t=>t.toolbar.strikethrough(),onClick:(t,e)=>{t.command.execute(e)}},{name:"superscript",type:"button",icon:n.get("superscript"),tooltip:t=>t.toolbar.superscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"subscript",type:"button",icon:n.get("subscript"),tooltip:t=>t.toolbar.subscript(),onClick:(t,e)=>{t.command.execute(e)}},{name:"code",type:"button",icon:n.get("code"),tooltip:t=>t.toolbar.code(),onClick:(t,e)=>{t.command.execute(e)}},{name:"removeFormat",type:"button",icon:n.get("removeFormat"),tooltip:t=>t.toolbar.removeFormat(),onClick:(t,e)=>{t.command.execute(e)}},{name:"formatPainter",type:"button",icon:n.get("formatPainter"),tooltip:t=>t.toolbar.formatPainter(),onClick:(t,e)=>{t.command.execute(e)}},{name:"link",type:"button",icon:n.get("link"),tooltip:t=>t.toolbar.link(),onClick:(t,e)=>{t.command.execute(e)}},{name:"hr",type:"button",icon:n.get("hr"),tooltip:t=>t.toolbar.hr(),onClick:(t,e)=>{t.command.execute(e)}},{name:"codeBlock",type:"button",icon:n.get("codeBlock"),tooltip:t=>t.toolbar.codeBlock(),onClick:(t,e)=>{t.command.execute(e)}},{name:"heading",type:"dropdown",downIcon:n.get("down"),defaultValue:"p",tooltip:t=>t.toolbar.heading(),width:"100px",menuType:"list",menuItems:[{value:"h1",text:t=>`<span style="font-weight: bold; font-size: 26px;">${t.toolbar.heading1()}</span>`},{value:"h2",text:t=>`<span style="font-weight: bold; font-size: 24px;">${t.toolbar.heading2()}</span>`},{value:"h3",text:t=>`<span style="font-weight: bold; font-size: 22px;">${t.toolbar.heading3()}</span>`},{value:"h4",text:t=>`<span style="font-weight: bold; font-size: 20px;">${t.toolbar.heading4()}</span>`},{value:"h5",text:t=>`<span style="font-weight: bold; font-size: 18px;">${t.toolbar.heading5()}</span>`},{value:"h6",text:t=>`<span style="font-weight: bold; font-size: 16px;">${t.toolbar.heading6()}</span>`},{value:"p",text:t=>t.toolbar.paragraph()}],onSelect:(t,e)=>{t.command.execute("heading",e)}},{name:"list",type:"dropdown",downIcon:n.get("down"),icon:n.get("list"),defaultValue:"",tooltip:t=>t.toolbar.list(),width:"auto",menuType:"list",menuItems:jr,onSelect:(t,e)=>{t.command.execute("list",e)}},{name:"align",type:"dropdown",downIcon:n.get("down"),icon:n.get("alignLeft"),defaultValue:"",tooltip:t=>t.toolbar.align(),width:"auto",menuType:"list",menuItems:Rr,onSelect:(t,e)=>{t.command.execute("align",e)}},{name:"indent",type:"dropdown",downIcon:n.get("down"),icon:n.get("increaseIndent"),defaultValue:"",tooltip:t=>t.toolbar.indent(),width:"auto",menuType:"list",menuItems:Wr,onSelect:(t,e)=>{t.command.execute("indent",e)}},{name:"fontFamily",type:"dropdown",downIcon:n.get("down"),defaultValue:"Segoe UI",tooltip:t=>t.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:t=>t.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:t=>t.toolbar.moreStyle(),width:"auto",menuType:"list",menuItems:Ur,selectedValues:t=>{var e;const i=[];for(const n of t)if(n.node.isMark){const t=null!==(e=Gr.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:t=>t.toolbar.fontColor(),width:"auto",menuType:"color",menuItems:Kr,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:t=>t.toolbar.highlight(),width:"auto",menuType:"color",menuItems:Kr,onSelect:(t,e)=>{t.command.execute("highlight",e)}},{name:"image",type:"upload",icon:n.get("image"),tooltip:t=>t.toolbar.image(),accept:"image/*",multiple:!0},{name:"file",type:"upload",icon:n.get("attachment"),tooltip:t=>t.toolbar.file(),accept:"*",multiple:!0}];function Jr(t){const{editor:e,name:i,file:n,onError:s,onSuccess:o}=t,{requestMethod:r,requestAction:a,requestTypes:l}=e.config[i];if(l.indexOf(n.type)<0)throw s&&s(`File '${n.name}' is not allowed for uploading.`),new Error(`Cannot upload file '${n.name}' because its type '${n.type}' is not found in ['${l.join("', '")}'].`);const c=e.insertBox(i,{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified}),h=te({onProgress:t=>{const e=c.node.find(".lake-percent"),i=Math.round(t.percent);e.text(`${i<100?i:99} %`)},onError:(t,e)=>{B(t.toString(),e),c.updateValue("status","error"),c.render(),s&&s(t.toString())},onSuccess:t=>{if(!t.url)return c.updateValue("status","error"),c.render(),void(s&&s("Cannot find the url field."));c.updateValue({status:"done",url:t.url}),c.render(),e.history.save(),o&&o()},file:n,action:a,method:r});return c.setData("xhr",h),c}const Yr=["undo","redo","|","heading","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],Qr=new Map;Xr.forEach((t=>{Qr.set(t.name,t)}));function ta(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
19
  /*!
20
20
  * PhotoSwipe Lightbox 5.4.3 - https://photoswipe.com
21
21
  * (c) 2023 Dmytro Semenov
@@ -24,7 +24,7 @@ function ea(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i
24
24
  /*!
25
25
  * PhotoSwipe 5.4.3 - https://photoswipe.com
26
26
  * (c) 2023 Dmytro Semenov
27
- */function wa(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function ya(t,e){return t.x=e.x,t.y=e.y,void 0!==e.id&&(t.id=e.id),t}function xa(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function ba(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 ka(t,e){return t.x===e.x&&t.y===e.y}function _a(t,e,i){return Math.min(Math.max(t,e),i)}function Sa(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ca(t,e,i,n){t.style.transform=Sa(e,i,n)}const Ba="cubic-bezier(.4,0,.22,1)";function Aa(t,e,i,n){t.style.transition=e?`${e} ${i}ms ${n||Ba}`:"none"}function Ea(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}const Ta="idle",La="loading",Ia="loaded",Ma="error";function Pa(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let Oa=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{Oa=!0}}))}catch(Mr){}class za{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=!!Oa&&{passive:n||!1};t[r](e,i,a)}}))}}function Za(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function Na(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 Ha(t,e,i,n){return{x:e.x-Na("left",t,e,i,n)-Na("right",t,e,i,n),y:e.y-Na("top",t,e,i,n)-Na("bottom",t,e,i,n)}}class Da{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=Na("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 _a(e,this.max[t],this.min[t])}}class $a{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 Va{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 $a(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=wa("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 Da(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=_a(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),xa(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),ya(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Ca(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;ya(this.panAreaSize,Ha(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 Sa(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class Fa{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&ya(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&&(xa(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 c=l===a?1:.82,h=this.pswp.bgOpacity,d=l-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:l,velocity:e[t],dampingRatio:c,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(l-e)/d;this.pswp.applyBgOpacity(_a(h+(1-h)*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:c}=o,h=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(h>c.min[t]&&n){if(c.min[t]<=this.startPan[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}else if(h<c.max[t]&&s){if(this.startPan[t]<=c.max[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}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,h)}else"y"===t&&(r.isShifted()||c.min.y===c.max.y)||this._setPanWithFriction(t,h);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 ja(t,e,i){return t.x=(e.x+i.x)/2,t.y=(e.y+i.y)/2,t}class Ra{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,ya(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;ja(this._startZoomPoint,e,n),ja(this._zoomPoint,t,i);let l=1/ba(e,n)*ba(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=ya({x:0,y:0},i.pan);let c=ya({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,ya(this._startPan,l)),o&&(c={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),c={x:i.bounds.correctPan("x",c.x),y:i.bounds.correctPan("y",c.y)},i.setZoomLevel(n);const h=!ka(c,l);if(!h&&!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,h||o){if(h&&(i.pan.x=l.x+(c.x-l.x)*t,i.pan.y=l.y+(c.y-l.y)*t),o){const e=n+(s-n)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(_a(r+(1-r)*t,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function Wa(t){return!!t.target.closest(".pswp__container")}class Ua{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){Wa(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Wa(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 qa{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 Fa(this),this.zoomLevels=new Ra(this),this.tapHandler=new Ua(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,ya(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,ya(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?ka(this.p1,this.prevP1)||this.drag.change():ka(this.p1,this.prevP1)&&ka(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,ya(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(),ba(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(ya(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&&ya(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&ya(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(){ya(this.prevP1,this.p1),ya(this.prevP2,this.p2)}_updateStartPoints(){ya(this.startP1,this.p1),ya(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 Ka{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&&Ca(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=wa("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++,Ca(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--,Ca(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&&Ca(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:null!=e&&e})}}const Ga={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Xa=(t,e)=>e?t:Ga[t];class Ya{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 Xa("Escape",o):e.options.escKey&&(i="close");break;case Xa("z",o):i="toggleZoom";break;case Xa("ArrowLeft",o):n="x";break;case Xa("ArrowUp",o):n="y";break;case Xa("ArrowRight",o):n="x",s=!0;break;case Xa("ArrowDown",o):s=!0,n="y";break;case Xa("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 Ja="cubic-bezier(.4,0,.22,1)";class Qa{constructor(t){var e;this.props=t;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=Ja}=t;this.onFinish=o;const l=s?"transform":"opacity",c=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((()=>{Aa(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]=c}),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),Aa(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class tl{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 el{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 c=new tl(n,a,l);let h=Date.now(),d=e-i;const p=()=>{this._raf&&(d=c.easeFrame(d,Date.now()-h),Math.abs(d)<1&&Math.abs(c.velocity)<50?(s(i),o&&o(),this.onFinish()):(h=Date.now(),s(d+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class il{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){const i=e?new el(t):new Qa(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 nl{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 sl{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=wa(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 c=t.element;"bar"===l?(t.topBar||(t.topBar=wa("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),c=t.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(c=t.scrollWrap)),null===(i=c)||void 0===i||i.appendChild(t.applyFilters("uiElement",a,e))}}function ol(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 rl={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:ol},al={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)=>{ol(t,e,!0)}},ll={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"},cl={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"},hl={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)}},dl={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};function pl(t,e){t.classList.toggle("pswp--zoomed-in",e)}class ul{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=[ll,rl,al,cl,hl,dl],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 sl(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 pl(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");pl(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 ml{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}}class fl{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 ml(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}}class gl{constructor(t,e){if(this.element=wa("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?(Ea(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Sa(0,0,t/250)):Ea(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class vl{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=Ta,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 gl(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=wa("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=wa("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=La,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=Ia,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!==Ia&&this.state!==Ma||this.removePlaceholder())}onError(){this.state=Ma,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===La,this)}isError(){return this.state===Ma}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&&(Ea(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!==Ma,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=wa("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=wa("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===Ma)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||Pa())?(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&&!Pa()?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!==Ia&&this.state!==Ma||this.removePlaceholder()))}}function wl(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new $a(o,t,-1),r=e.pswp?e.pswp.viewportSize:Za(o,e);const a=Ha(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 yl{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 wl(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 xl extends fl{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 vl(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 wl(t,this,e)}}const bl=.003;class kl{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>bl,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(bl)),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(bl)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(bl)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(bl)))):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",Sa(e,n)),this._animateTo(this._cropContainer2,"transform",Sa(o,r))):(Ca(this._cropContainer1,e,n),Ca(this._cropContainer2,o,r))}n&&(ya(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 _l={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 Sl extends xl{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 za,this.animations=new il,this.mainScroll=new Ka(this),this.gestures=new qa(this),this.opener=new kl(this),this.keyboard=new Ya(this),this.contentLoader=new yl(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 nl(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)),_a(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 Va(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=Za(this.options,this);!t&&ka(e,this._prevViewportSize)||(ya(this._prevViewportSize,e),this.dispatch("beforeResize"),ya(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=wa("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=wa("pswp__bg","div",this.element),this.scrollWrap=wa("pswp__scroll-wrap","section",this.element),this.container=wa("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 ul(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,c={x:n.left+a,y:n.top+l,w:e*r};return c.innerRect={w:n.width,h:n.height,x:a,y:l},c}(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),{..._l,...t}}}function Cl(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,c=0;const h=t=>{const e=t.clientX-l,i=Math.round(o?c+e:c-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,c=n.width(),s.show(),t.on("pointermove",h)})),t.on("pointerup",(()=>{t.off("pointermove"),s.hide(),c=e.getContainer().width();const n=Math.round(a*c);e.updateValue({width:c,height:n}),i.history.save()})),t.on("pointercancel",(()=>{t.off("pointermove"),s.hide()}))}function Bl(t){return ta(this,void 0,void 0,(function*(){const e=L("<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),L(document.body).append(e)}))}))}function Al(t,e){return ta(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value;e.getContainer().css({width:"",height:""});const o=L(a`
27
+ */function ya(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i&&i.appendChild(n),n}function wa(t,e){return t.x=e.x,t.y=e.y,void 0!==e.id&&(t.id=e.id),t}function xa(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function ba(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 ka(t,e){return t.x===e.x&&t.y===e.y}function _a(t,e,i){return Math.min(Math.max(t,e),i)}function Sa(t,e,i){let n=`translate3d(${t}px,${e||0}px,0)`;return void 0!==i&&(n+=` scale3d(${i},${i},1)`),n}function Ca(t,e,i,n){t.style.transform=Sa(e,i,n)}const Ba="cubic-bezier(.4,0,.22,1)";function Aa(t,e,i,n){t.style.transition=e?`${e} ${i}ms ${n||Ba}`:"none"}function Ea(t,e,i){t.style.width="number"==typeof e?`${e}px`:e,t.style.height="number"==typeof i?`${i}px`:i}const Ta="idle",La="loading",Ia="loaded",Ma="error";function Pa(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}let Oa=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{Oa=!0}}))}catch(Mr){}class za{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=!!Oa&&{passive:n||!1};t[r](e,i,a)}}))}}function Za(t,e){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function Na(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 Ha(t,e,i,n){return{x:e.x-Na("left",t,e,i,n)-Na("right",t,e,i,n),y:e.y-Na("top",t,e,i,n)-Na("bottom",t,e,i,n)}}class Da{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=Na("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 _a(e,this.max[t],this.min[t])}}class $a{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 Va{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 $a(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=ya("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 Da(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=_a(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),xa(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),wa(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Ca(this.container,t,e,i)}calculateSize(){const{pswp:t}=this;wa(this.panAreaSize,Ha(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 Sa(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class Fa{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&wa(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&&(xa(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 c=l===a?1:.82,h=this.pswp.bgOpacity,d=l-o;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:o,end:l,velocity:e[t],dampingRatio:c,onUpdate:e=>{if(r&&this.pswp.bgOpacity<1){const t=1-(l-e)/d;this.pswp.applyBgOpacity(_a(h+(1-h)*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:c}=o,h=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(h>c.min[t]&&n){if(c.min[t]<=this.startPan[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}else if(h<c.max[t]&&s){if(this.startPan[t]<=c.max[t])return r.moveTo(l,!0),!0;this._setPanWithFriction(t,h)}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,h)}else"y"===t&&(r.isShifted()||c.min.y===c.max.y)||this._setPanWithFriction(t,h);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 ja(t,e,i){return t.x=(e.x+i.x)/2,t.y=(e.y+i.y)/2,t}class Ra{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,wa(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;ja(this._startZoomPoint,e,n),ja(this._zoomPoint,t,i);let l=1/ba(e,n)*ba(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=wa({x:0,y:0},i.pan);let c=wa({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,wa(this._startPan,l)),o&&(c={x:this._calculatePanForZoomLevel("x",s),y:this._calculatePanForZoomLevel("y",s)}),i.setZoomLevel(s),c={x:i.bounds.correctPan("x",c.x),y:i.bounds.correctPan("y",c.y)},i.setZoomLevel(n);const h=!ka(c,l);if(!h&&!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,h||o){if(h&&(i.pan.x=l.x+(c.x-l.x)*t,i.pan.y=l.y+(c.y-l.y)*t),o){const e=n+(s-n)*t;i.setZoomLevel(e)}i.applyCurrentZoomPan()}a&&e.bgOpacity<1&&e.applyBgOpacity(_a(r+(1-r)*t,0,1))},onComplete:()=>{i._setResolution(s),i.applyCurrentZoomPan()}})}}function Wa(t){return!!t.target.closest(".pswp__container")}class Ua{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){Wa(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){Wa(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 qa{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 Fa(this),this.zoomLevels=new Ra(this),this.tapHandler=new Ua(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,wa(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,wa(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?ka(this.p1,this.prevP1)||this.drag.change():ka(this.p1,this.prevP1)&&ka(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,wa(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(),ba(this._lastStartP1,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(wa(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&&wa(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&wa(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(){wa(this.prevP1,this.p1),wa(this.prevP2,this.p2)}_updateStartPoints(){wa(this.startP1,this.p1),wa(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 Ka{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&&Ca(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=ya("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++,Ca(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--,Ca(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&&Ca(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:null!=e&&e})}}const Ga={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Xa=(t,e)=>e?t:Ga[t];class Ja{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 Xa("Escape",o):e.options.escKey&&(i="close");break;case Xa("z",o):i="toggleZoom";break;case Xa("ArrowLeft",o):n="x";break;case Xa("ArrowUp",o):n="y";break;case Xa("ArrowRight",o):n="x",s=!0;break;case Xa("ArrowDown",o):s=!0,n="y";break;case Xa("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 Ya="cubic-bezier(.4,0,.22,1)";class Qa{constructor(t){var e;this.props=t;const{target:i,onComplete:n,transform:s,onFinish:o=(()=>{}),duration:r=333,easing:a=Ya}=t;this.onFinish=o;const l=s?"transform":"opacity",c=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((()=>{Aa(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]=c}),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),Aa(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}class tl{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 el{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 c=new tl(n,a,l);let h=Date.now(),d=e-i;const p=()=>{this._raf&&(d=c.easeFrame(d,Date.now()-h),Math.abs(d)<1&&Math.abs(c.velocity)<50?(s(i),o&&o(),this.onFinish()):(h=Date.now(),s(d+i),this._raf=requestAnimationFrame(p)))};this._raf=requestAnimationFrame(p)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class il{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){const i=e?new el(t):new Qa(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 nl{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 sl{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=ya(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 c=t.element;"bar"===l?(t.topBar||(t.topBar=ya("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),c=t.topBar):(a.classList.add("pswp__hide-on-close"),"wrapper"===l&&(c=t.scrollWrap)),null===(i=c)||void 0===i||i.appendChild(t.applyFilters("uiElement",a,e))}}function ol(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 rl={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:ol},al={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)=>{ol(t,e,!0)}},ll={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"},cl={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"},hl={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)}},dl={name:"counter",order:5,onInit:(t,e)=>{e.on("change",(()=>{t.innerText=e.currIndex+1+e.options.indexIndicatorSep+e.getNumItems()}))}};function pl(t,e){t.classList.toggle("pswp--zoomed-in",e)}class ul{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=[ll,rl,al,cl,hl,dl],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 sl(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 pl(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");pl(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 ml{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}}class fl{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 ml(t,e);return null===(i=this._listeners[t])||void 0===i||i.forEach((t=>{t.call(this,n)})),n}}class gl{constructor(t,e){if(this.element=ya("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?(Ea(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Sa(0,0,t/250)):Ea(this.element,t,e))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class vl{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=Ta,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 gl(t,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=ya("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=ya("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=La,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=Ia,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!==Ia&&this.state!==Ma||this.removePlaceholder())}onError(){this.state=Ma,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===La,this)}isError(){return this.state===Ma}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&&(Ea(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!==Ma,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=ya("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=ya("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===Ma)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||Pa())?(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&&!Pa()?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!==Ia&&this.state!==Ma||this.removePlaceholder()))}}function yl(t,e,i){const n=e.createContentFromData(t,i);let s;const{options:o}=e;if(o){let r;s=new $a(o,t,-1),r=e.pswp?e.pswp.viewportSize:Za(o,e);const a=Ha(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 wl{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 yl(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 xl extends fl{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 vl(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 yl(t,this,e)}}const bl=.003;class kl{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>bl,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(bl)),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(bl)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(bl)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(bl)))):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",Sa(e,n)),this._animateTo(this._cropContainer2,"transform",Sa(o,r))):(Ca(this._cropContainer1,e,n),Ca(this._cropContainer2,o,r))}n&&(wa(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 _l={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 Sl extends xl{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 za,this.animations=new il,this.mainScroll=new Ka(this),this.gestures=new qa(this),this.opener=new kl(this),this.keyboard=new Ja(this),this.contentLoader=new wl(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 nl(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)),_a(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 Va(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=Za(this.options,this);!t&&ka(e,this._prevViewportSize)||(wa(this._prevViewportSize,e),this.dispatch("beforeResize"),wa(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=ya("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=ya("pswp__bg","div",this.element),this.scrollWrap=ya("pswp__scroll-wrap","section",this.element),this.container=ya("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 ul(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,c={x:n.left+a,y:n.top+l,w:e*r};return c.innerRect={w:n.width,h:n.height,x:a,y:l},c}(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),{..._l,...t}}}function Cl(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,c=0;const h=t=>{const e=t.clientX-l,i=Math.round(o?c+e:c-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,c=n.width(),s.show(),t.on("pointermove",h)})),t.on("pointerup",(()=>{t.off("pointermove"),s.hide(),c=e.getContainer().width();const n=Math.round(a*c);e.updateValue({width:c,height:n}),i.history.save()})),t.on("pointercancel",(()=>{t.off("pointermove"),s.hide()}))}function Bl(t){return ta(this,void 0,void 0,(function*(){const e=L("<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),L(document.body).append(e)}))}))}function Al(t,e){return ta(this,void 0,void 0,(function*(){const i=e.getEditor();if(!i)return;const s=e.value;e.getContainer().css({width:"",height:""});const o=L(a`
28
28
  <div class="lake-button-group">
29
29
  <button type="button" tabindex="-1" class="lake-button-remove" title="${i.locale.image.remove()}"></button>
30
30
  </div>
@@ -54,7 +54,7 @@ function ea(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i
54
54
  <div class="lake-resizer-bottom-right"></div>
55
55
  <div class="lake-resizer-info">${r} x ${l}</div>
56
56
  </div>
57
- `),f=o.node;f.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),Cl(m.find(".lake-resizer-top-left"),e),Cl(m.find(".lake-resizer-top-right"),e),Cl(m.find(".lake-resizer-bottom-left"),e),Cl(m.find(".lake-resizer-bottom-right"),e),t.append(c),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=Jt(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 va({pswpModule:Sl,dataSource:i,mainClass:"lake-pswp",zoom:!1,returnFocus:!1,arrowPrevSVG:n.get("left"),arrowNextSVG:n.get("right"),closeSVG:n.get("close"),arrowPrevTitle:e.locale.image.previous(),arrowNextTitle:e.locale.image.next(),closeTitle:e.locale.image.close(),errorMsg:e.locale.image.loadingError()});let a;r.on("uiRegister",(()=>{const t=r.pswp;t.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:e.locale.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:e.locale.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",(()=>{a=e.selection.range,t.event.emit("openfullscreen")})),r.on("destroy",(()=>{window.setTimeout((()=>{a&&(e.selection.range=a,e.selection.sync()),t.event.emit("closefullscreen")}),0)})),r.init(),r.loadAndOpen(s)}(t))),e.readonly?o.find(".lake-button-remove").hide():o.find(".lake-button-remove").on("click",(i=>{i.stopPropagation();const n=t.getData("xhr");n&&n.abort(),e.removeBox(t),e.history.save(),e.selection.sync()})),t.event.emit("render")})),o.on("click",(()=>{e.selectBox(t)}))},html:t=>{const e=t.node.attr("value");return a`<img src="${t.value.url}" data-lake-value="${e}" />`}},Tl=new Map;class Ll{constructor(t){this.placement="top",this.buttonItemList=[],this.dropdownItemList=[],this.root=L(t.root),this.editor=t.editor,this.box=t.box,this.items=t.items,t.placement&&(this.placement=t.placement),this.container=L('<div class="lake-box-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-box-toolbar-divider" />')}appendButton(t){new Ce({root:this.container,name:t.name,icon:t.icon,tooltip:"string"==typeof t.tooltip?t.tooltip:t.tooltip(this.editor.locale),tabIndex:-1,onClick:()=>{t.onClick(this.box,t.name)}}).render()}appendDropdown(t){new Fe({root:this.container,locale:this.editor.locale,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,placement:"top"===this.placement?"bottom":"top",onSelect:e=>{t.onSelect(this.box,e)}}).render()}updatePosition(){const t=dt(this.box.node);if(t.left<0||t.right<0||t.top<0||t.bottom<0)return void this.container.hide();this.container.show("flex");const e=this.box.node.get(0).getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY,s=(i+e.width/2-this.container.width()/2).toFixed(1),o=(n-this.container.height()-6).toFixed(1);this.container.css({left:`${s}px`,top:`${o}px`})}render(){this.root.empty(),this.root.append(this.container),this.items.forEach((t=>{if("|"===t)return void this.appendDivider();let e;if("string"==typeof t){if(e=Tl.get(t),!e)return}else e=t;if("button"===e.type)return this.buttonItemList.push(e),void this.appendButton(e);"dropdown"===e.type&&(this.dropdownItemList.push(e),this.appendDropdown(e))})),this.updatePosition()}unmount(){this.container.remove()}}const Il=[{name:"download",type:"button",icon:n.get("download"),tooltip:t=>t.file.download(),onClick:t=>{window.open(t.value.url)}},{name:"remove",type:"button",icon:n.get("remove"),tooltip:t=>t.file.remove(),onClick:t=>{const e=t.getEditor();e&&(e.removeBox(t),e.history.save(),e.selection.sync())}}];const Ml={type:"inline",name:"file",render:t=>{const e=t.getEditor();if(!e)return;const i=t.value,s=t.getContainer(),o=L('<div class="lake-file" />');if(o.addClass(`lake-file-${i.status}`),e.readonly&&o.addClass("lake-file-readonly"),function(t,e){ta(this,void 0,void 0,(function*(){if(!e.getEditor())return;const i=e.value,s=L(a`
57
+ `),f=o.node;f.addClass("lake-image-img"),f.attr({draggable:"false",alt:s.name}),Cl(m.find(".lake-resizer-top-left"),e),Cl(m.find(".lake-resizer-top-right"),e),Cl(m.find(".lake-resizer-bottom-left"),e),Cl(m.find(".lake-resizer-bottom-right"),e),t.append(c),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=Yt(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 va({pswpModule:Sl,dataSource:i,mainClass:"lake-pswp",zoom:!1,returnFocus:!1,arrowPrevSVG:n.get("left"),arrowNextSVG:n.get("right"),closeSVG:n.get("close"),arrowPrevTitle:e.locale.image.previous(),arrowNextTitle:e.locale.image.next(),closeTitle:e.locale.image.close(),errorMsg:e.locale.image.loadingError()});let a;r.on("uiRegister",(()=>{const t=r.pswp;t.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:e.locale.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:e.locale.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",(()=>{a=e.selection.range,t.event.emit("openfullscreen")})),r.on("destroy",(()=>{window.setTimeout((()=>{a&&(e.selection.range=a,e.selection.sync()),t.event.emit("closefullscreen")}),0)})),r.init(),r.loadAndOpen(s)}(t))),e.readonly?o.find(".lake-button-remove").hide():o.find(".lake-button-remove").on("click",(i=>{i.stopPropagation();const n=t.getData("xhr");n&&n.abort(),e.removeBox(t),e.history.save(),e.selection.sync()})),t.event.emit("render")})),o.on("click",(()=>{e.selectBox(t)}))},html:t=>{const e=t.node.attr("value");return a`<img src="${t.value.url}" data-lake-value="${e}" />`}},Tl=new Map;class Ll{constructor(t){this.placement="top",this.buttonItemList=[],this.dropdownItemList=[],this.root=L(t.root),this.editor=t.editor,this.box=t.box,this.items=t.items,t.placement&&(this.placement=t.placement),this.container=L('<div class="lake-box-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-box-toolbar-divider" />')}appendButton(t){new Ce({root:this.container,name:t.name,icon:t.icon,tooltip:"string"==typeof t.tooltip?t.tooltip:t.tooltip(this.editor.locale),tabIndex:-1,onClick:()=>{t.onClick(this.box,t.name)}}).render()}appendDropdown(t){new Fe({root:this.container,locale:this.editor.locale,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,placement:"top"===this.placement?"bottom":"top",onSelect:e=>{t.onSelect(this.box,e)}}).render()}updatePosition(){const t=dt(this.box.node);if(t.left<0||t.right<0||t.top<0||t.bottom<0)return void this.container.hide();this.container.show("flex");const e=this.box.node.get(0).getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY,s=(i+e.width/2-this.container.width()/2).toFixed(1),o=(n-this.container.height()-6).toFixed(1);this.container.css({left:`${s}px`,top:`${o}px`})}render(){this.root.empty(),this.root.append(this.container),this.items.forEach((t=>{if("|"===t)return void this.appendDivider();let e;if("string"==typeof t){if(e=Tl.get(t),!e)return}else e=t;if("button"===e.type)return this.buttonItemList.push(e),void this.appendButton(e);"dropdown"===e.type&&(this.dropdownItemList.push(e),this.appendDropdown(e))})),this.updatePosition()}unmount(){this.container.remove()}}const Il=[{name:"download",type:"button",icon:n.get("download"),tooltip:t=>t.file.download(),onClick:t=>{window.open(t.value.url)}},{name:"remove",type:"button",icon:n.get("remove"),tooltip:t=>t.file.remove(),onClick:t=>{const e=t.getEditor();e&&(e.removeBox(t),e.history.save(),e.selection.sync())}}];const Ml={type:"inline",name:"file",render:t=>{const e=t.getEditor();if(!e)return;const i=t.value,s=t.getContainer(),o=L('<div class="lake-file" />');if(o.addClass(`lake-file-${i.status}`),e.readonly&&o.addClass("lake-file-readonly"),function(t,e){ta(this,void 0,void 0,(function*(){if(!e.getEditor())return;const i=e.value,s=L(a`
58
58
  <div class="lake-file-info">
59
59
  <div class="lake-file-type"></div>
60
60
  <div class="lake-file-name">${i.name} (${g(i.size)})</div>
@@ -63,7 +63,7 @@ function ea(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i
63
63
  <div class="lake-progress">
64
64
  <div class="lake-percent">${Math.round(i.percent||0)} %</div>
65
65
  </div>
66
- `),e=n.get("circleNotch");e&&t.prepend(e),o.replaceWith(t)}else{const t="error"===i.status?n.get("warningCircle"):n.get("file");t&&o.append(t)}t.append(s)}))}(o,t),s.empty(),s.append(o),e.readonly)o.on("click",(()=>{window.open(i.url)}));else{o.on("click",(()=>{e.selectBox(t)}));let n=null;const s=()=>{n&&n.updatePosition()};t.event.on("focus",(()=>{const o="done"===i.status?Il:Il.filter((t=>"remove"===t.name));n=new Ll({root:e.popupContainer,editor:e,box:t,items:o}),n.render(),e.root.on("scroll",s)})),t.event.on("blur",(()=>{n&&(n.unmount(),n=null),e.root.off("scroll",s)}))}t.event.emit("render")}},Pl="#57606a",Ol="#444d56",zl="#953800",Zl="#0550ae",Nl="#444d56",Hl="#24292e",Dl="#005cc5",$l="#0550ae",Vl="#444d56",Fl="#444d56",jl="#0a3069",Rl="#0550ae",Wl="#0550ae",Ul="#116329",ql="#0550ae",Kl="#cf222e",Gl="#24292f",Xl="#cf222e",Yl="#57606a",Jl="#57606a",Ql="#8250df",tc="#0550ae",ec="#f6f8fa",ic="#cf222e",nc="#0550ae",sc="#005cc5",oc="#444d56",rc="#444d56";function ac(t){const{HighlightStyle:e,tags:i}=t;return e.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Pl},{tag:[i.name],color:Ol},{tag:[i.variableName,i.self],color:zl},{tag:[i.typeName,i.tagName],color:Zl},{tag:[i.propertyName,i.attributeName],color:Nl},{tag:[i.className],color:Hl},{tag:[i.labelName],color:Dl},{tag:[i.namespace],color:$l},{tag:[i.macroName],color:Vl},{tag:[i.literal],color:Fl},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:jl},{tag:[i.number,i.integer,i.float],color:Rl},{tag:[i.bool,i.null,i.atom],color:Wl},{tag:[i.regexp,i.escape,i.url],color:Ul},{tag:[i.color],color:ql},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:Kl},{tag:[i.modifier],color:Gl},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:Xl},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:Yl},{tag:[i.content],color:Jl},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:Ql},{tag:i.heading,fontWeight:"bold",color:tc},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:ec},{tag:[i.definition(i.name)],color:ic},{tag:[i.constant(i.name)],color:nc},{tag:[i.function(i.variableName)],color:sc},{tag:[i.standard(i.name)],color:oc},{tag:[i.special(i.variableName)],color:rc}])}const lc={type:"block",name:"codeBlock",render:t=>{var e;const i=t.getEditor();if(!i)return;const s=L('<div class="lake-code-block" />'),o=t.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selectBox(t)}));const{EditorState:l,Compartment:c,EditorView:h,keymap:d,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:f,syntaxHighlighting:g}=a,v=a.langItems,w=i.config.codeBlock,y=v.filter((t=>w.langList.indexOf(t.value)>=0)),x=new Map;for(const t of y)x.set(t.value,t);const b=t.value,k=x.get(b.lang),_=new c,S=h.updateListener.of((e=>{var n;e.docChanged&&(n=e.state.doc.toString(),window.setTimeout((()=>{i.isComposing||(t.updateValue("code",n),i.history.save())}),0))})),C=new h({parent:r,doc:null!==(e=b.code)&&void 0!==e?e:"",extensions:[l.readOnly.of(i.readonly),h.editable.of(!i.readonly),p(),d.of([...u,...m,f]),g(ac(a)),_.of(k&&k.component?k.component():[]),S]});s.find('[contenteditable="true"]').attr("tabindex","-1");new Fe({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:w.defaultLang,tooltip:i.locale.codeBlock.langType(),width:"auto",menuType:"list",menuItems:y.map((t=>({value:t.value,text:t.text}))),onSelect:e=>{const n=x.get(e);C.dispatch({effects:_.reconfigure(n&&n.component?n.component():[])}),t.updateValue({lang:e}),i.history.save()}}).render(),t.setData("codeEditor",C);const A=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",A),t.useEffect((()=>()=>{C.destroy(),i.event.off("resize",A),B("CodeMirror destroyed")}))}};const cc=Array.from(x).join(",");function hc(t){const e=[t];for(const i of t.getWalker())e.push(i);for(const t of e)"div"===t.name?t.find(cc).length>0?t.remove(!0):$(t,"p"):(t.isHeading||["blockquote","li"].indexOf(t.name)>=0)&&t.find(cc).remove(!0)}function dc(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"===Jt(n).type)i.isBoxStart?(i.setStartBefore(n),i.collapseToStart()):i.isBoxEnd?(i.setStartAfter(n),i.collapseToStart()):t.removeBox();else{const e=L("<p />");i.isBoxStart?(n.before(e),i.shrinkAfter(e)):i.isBoxEnd?(n.after(e),i.shrinkAfter(e)):t.removeBox()}const s=i.startNode.closestBlock();if(e.isBlockBox){const i=Jt(e),n=""!==e.attr("value")?i.value:void 0;return t.insertBox(i.name,n),void e.remove()}if(e.first().length>0&&O(s),s.isEmpty&&"p"===s.name)return s.replaceWith(e),e.find("lake-box").each((t=>{Jt(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.start&&(n.setEndAfter(t.start),n.collapseToEnd()),t.end&&t.end.isEmpty&&t.end.remove(),i.insertFragment(e),n.shrinkAfter(o)}V(t.container.children().filter((t=>t.isBlock))),t.history.save()}const pc=["info","tip","warning","danger"];function uc(t){t.selection.setBlocks("<p />")}function mc(t){t.selection.setBlocks("<ol><li></li></ol>")}function fc(t){t.selection.setBlocks("<ul><li></li></ul>")}function gc(t,e){t.selection.setBlocks(`<ul type="checklist"><li value="${e}"></li></ul>`)}const vc={start:"left",end:"right"};const wc="strong";const yc="sub";const xc="sup";const bc="code";const kc="lake-format-painter";class _c{constructor(t){this.linkNode=null,this.config=t,this.root=t.root,this.locale=t.locale||Ve("en-US"),this.container=L(a`
66
+ `),e=n.get("circleNotch");e&&t.prepend(e),o.replaceWith(t)}else{const t="error"===i.status?n.get("warningCircle"):n.get("file");t&&o.append(t)}t.append(s)}))}(o,t),s.empty(),s.append(o),e.readonly)o.on("click",(()=>{window.open(i.url)}));else{o.on("click",(()=>{e.selectBox(t)}));let n=null;const s=()=>{n&&n.updatePosition()};t.event.on("focus",(()=>{const o="done"===i.status?Il:Il.filter((t=>"remove"===t.name));n=new Ll({root:e.popupContainer,editor:e,box:t,items:o}),n.render(),e.root.on("scroll",s)})),t.event.on("blur",(()=>{n&&(n.unmount(),n=null),e.root.off("scroll",s)}))}t.event.emit("render")}},Pl="#57606a",Ol="#444d56",zl="#953800",Zl="#0550ae",Nl="#444d56",Hl="#24292e",Dl="#005cc5",$l="#0550ae",Vl="#444d56",Fl="#444d56",jl="#0a3069",Rl="#0550ae",Wl="#0550ae",Ul="#116329",ql="#0550ae",Kl="#cf222e",Gl="#24292f",Xl="#cf222e",Jl="#57606a",Yl="#57606a",Ql="#8250df",tc="#0550ae",ec="#f6f8fa",ic="#cf222e",nc="#0550ae",sc="#005cc5",oc="#444d56",rc="#444d56";function ac(t){const{HighlightStyle:e,tags:i}=t;return e.define([{tag:[i.comment,i.lineComment,i.blockComment,i.docComment],color:Pl},{tag:[i.name],color:Ol},{tag:[i.variableName,i.self],color:zl},{tag:[i.typeName,i.tagName],color:Zl},{tag:[i.propertyName,i.attributeName],color:Nl},{tag:[i.className],color:Hl},{tag:[i.labelName],color:Dl},{tag:[i.namespace],color:$l},{tag:[i.macroName],color:Vl},{tag:[i.literal],color:Fl},{tag:[i.string,i.docString,i.character,i.attributeValue,i.unit],color:jl},{tag:[i.number,i.integer,i.float],color:Rl},{tag:[i.bool,i.null,i.atom],color:Wl},{tag:[i.regexp,i.escape,i.url],color:Ul},{tag:[i.color],color:ql},{tag:[i.keyword,i.operatorKeyword,i.controlKeyword,i.definitionKeyword,i.moduleKeyword],color:Kl},{tag:[i.modifier],color:Gl},{tag:[i.operator,i.derefOperator,i.arithmeticOperator,i.logicOperator,i.bitwiseOperator,i.compareOperator,i.updateOperator,i.definitionOperator,i.typeOperator,i.controlOperator],color:Xl},{tag:[i.punctuation,i.separator,i.bracket,i.angleBracket,i.squareBracket,i.paren,i.brace,i.contentSeparator],color:Jl},{tag:[i.content],color:Yl},{tag:[i.meta,i.documentMeta,i.annotation,i.processingInstruction],color:Ql},{tag:i.heading,fontWeight:"bold",color:tc},{tag:i.strong,fontWeight:"bold"},{tag:i.emphasis,fontStyle:"italic"},{tag:i.link,textDecoration:"underline"},{tag:i.strikethrough,textDecoration:"line-through"},{tag:[i.invalid,i.inserted,i.deleted,i.changed],color:ec},{tag:[i.definition(i.name)],color:ic},{tag:[i.constant(i.name)],color:nc},{tag:[i.function(i.variableName)],color:sc},{tag:[i.standard(i.name)],color:oc},{tag:[i.special(i.variableName)],color:rc}])}const lc={type:"block",name:"codeBlock",render:t=>{var e;const i=t.getEditor();if(!i)return;const s=L('<div class="lake-code-block" />'),o=t.getContainer();o.css("width",i.container.innerWidth()-2+"px"),o.empty(),o.append(s);const r=s.get(0);if(!r)return;const a=window.LakeCodeMirror;if(!a)return s.addClass("lake-code-block-error"),s.text('\n The code cannot be displayed because window.LakeCodeMirror is not found.\n Please check if the "lake-codemirror" library is added to this page.\n '.trim()),void s.on("click",(()=>{i.selectBox(t)}));const{EditorState:l,Compartment:c,EditorView:h,keymap:d,history:p,defaultKeymap:u,historyKeymap:m,indentWithTab:f,syntaxHighlighting:g}=a,v=a.langItems,y=i.config.codeBlock,w=v.filter((t=>y.langList.indexOf(t.value)>=0)),x=new Map;for(const t of w)x.set(t.value,t);const b=t.value,k=x.get(b.lang),_=new c,S=h.updateListener.of((e=>{var n;e.docChanged&&(n=e.state.doc.toString(),window.setTimeout((()=>{i.isComposing||(t.updateValue("code",n),i.history.save())}),0))})),C=new h({parent:r,doc:null!==(e=b.code)&&void 0!==e?e:"",extensions:[l.readOnly.of(i.readonly),h.editable.of(!i.readonly),p(),d.of([...u,...m,f]),g(ac(a)),_.of(k&&k.component?k.component():[]),S]});s.find('[contenteditable="true"]').attr("tabindex","-1");new Fe({root:s,name:"langType",downIcon:n.get("down"),defaultValue:k?b.lang:y.defaultLang,tooltip:i.locale.codeBlock.langType(),width:"auto",menuType:"list",menuItems:w.map((t=>({value:t.value,text:t.text}))),onSelect:e=>{const n=x.get(e);C.dispatch({effects:_.reconfigure(n&&n.component?n.component():[])}),t.updateValue({lang:e}),i.history.save()}}).render(),t.setData("codeEditor",C);const A=()=>{o.css("width",i.container.innerWidth()-2+"px")};i.event.on("resize",A),t.useEffect((()=>()=>{C.destroy(),i.event.off("resize",A),B("CodeMirror destroyed")}))}};const cc=Array.from(x).join(",");function hc(t){const e=[t];for(const i of t.getWalker())e.push(i);for(const t of e)"div"===t.name?t.find(cc).length>0?t.remove(!0):$(t,"p"):(t.isHeading||["blockquote","li"].indexOf(t.name)>=0)&&t.find(cc).remove(!0)}function dc(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"===Yt(n).type)i.isBoxStart?(i.setStartBefore(n),i.collapseToStart()):i.isBoxEnd?(i.setStartAfter(n),i.collapseToStart()):t.removeBox();else{const e=L("<p />");i.isBoxStart?(n.before(e),i.shrinkAfter(e)):i.isBoxEnd?(n.after(e),i.shrinkAfter(e)):t.removeBox()}const s=i.startNode.closestBlock();if(e.isBlockBox){const i=Yt(e),n=""!==e.attr("value")?i.value:void 0;return t.insertBox(i.name,n),void e.remove()}if(e.first().length>0&&O(s),s.isEmpty&&"p"===s.name)return s.replaceWith(e),e.find("lake-box").each((t=>{Yt(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.start&&(n.setEndAfter(t.start),n.collapseToEnd()),t.end&&t.end.isEmpty&&t.end.remove(),i.insertFragment(e),n.shrinkAfter(o)}V(t.container.children().filter((t=>t.isBlock))),t.history.save()}const pc=["info","tip","warning","danger"];function uc(t){t.selection.setBlocks("<p />")}function mc(t){t.selection.setBlocks("<ol><li></li></ol>")}function fc(t){t.selection.setBlocks("<ul><li></li></ul>")}function gc(t,e){t.selection.setBlocks(`<ul type="checklist"><li value="${e}"></li></ul>`)}const vc={start:"left",end:"right"};const yc="strong";const wc="sub";const xc="sup";const bc="code";const kc="lake-format-painter";class _c{constructor(t){this.linkNode=null,this.config=t,this.root=t.root,this.locale=t.locale||Ve("en-US"),this.container=L(a`
67
67
  <div class="lake-link-popup">
68
68
  <div class="lake-row">${this.locale.link.url()}</div>
69
69
  <div class="lake-row lake-url-row">
@@ -75,15 +75,15 @@ function ea(t,e,i){const n=document.createElement(e);return t&&(n.className=t),i
75
75
  </div>
76
76
  <div class="lake-row lake-button-row"></div>
77
77
  </div>
78
- `)}writeClipboardText(t){return ta(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(){const t=this.config;let e=null;const i=new Ce({root:this.container.find(".lake-url-row"),name:"copy",icon:n.get("copy"),tooltip:this.locale.link.copy(),onClick:()=>{if(!this.linkNode)return;const i=this.getInputValue("url");this.writeClipboardText(i).then((i=>{const n=this.container.find('button[name="copy"] svg');if(n.hide(),i)return n.eq(2).show("inline"),void(t.onCopy&&t.onCopy(i));n.eq(1).show("inline"),t.onCopy&&t.onCopy(i),e&&window.clearTimeout(e),e=window.setTimeout((()=>{n.hide(),n.eq(0).show("inline")}),2e3)}))}});i.render();const s=n.get("checkCircle");s&&i.node.append(s);const o=n.get("warningCircle");o&&i.node.append(o)}appendOpenButton(){new Ce({root:this.container.find(".lake-url-row"),name:"open",icon:n.get("open"),tooltip:this.locale.link.open(),onClick:()=>{if(!this.linkNode)return;const t=this.getInputValue("url");window.open(t)}}).render()}appendSaveButton(){new Ce({root:this.container.find(".lake-button-row"),name:"save",icon:n.get("check"),text:this.locale.link.save(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode;this.save(),this.hide(),this.config.onSave&&this.config.onSave(t)}}).render()}appendUnlinkButton(){new Ce({root:this.container.find(".lake-button-row"),name:"unlink",icon:n.get("unlink"),text:this.locale.link.unlink(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode.last();this.linkNode.remove(!0),this.hide(),this.config.onRemove&&this.config.onRemove(t)}}).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=dt(this.linkNode);if(t.left<0||t.right<0||t.top<0||t.bottom<0)return void this.container.css("visibility","hidden");this.container.css("visibility","");const e=this.linkNode.get(0).getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;e.x+this.container.width()>window.innerWidth?this.container.css("left",`${i-this.container.width()+e.width}px`):this.container.css("left",`${i}px`),e.y+e.height+this.container.height()>window.innerHeight?this.container.css("top",n-this.container.height()+"px"):this.container.css("top",`${n+e.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 Sc=["text","c","csharp","cpp","css","go","html","java","javascript","json","markdown","php","python","rust","sql","typescript","xml","yaml"];const Cc=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),Bc=new Map([["js","javascript"],["ts","typescript"],["md","markdown"],["htm","html"]]),Ac=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],Ec=[{re:/^#+$/,getParameters:t=>{var e;return["heading",null!==(e=Cc.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"]}],Tc=[{re:/^:{3,}([a-z]*)$/i,getParameters:t=>t[1]?["blockQuote",t[1]]:["blockQuote","info"]},{re:/^-{3,}$/,getParameters:()=>["hr"]},{re:/^`{3,}([a-z]*)$/i,getParameters:t=>{var e;return t[1]?["codeBlock",{lang:null!==(e=Bc.get(t[1]))&&void 0!==e?e:t[1]}]:["codeBlock"]}}];function Lc(t){const e=t.clone(!0);e.find("lake-bookmark").remove(),""===e.html()&&t.prepend("<br />")}function Ic(t,e){const i=t.selection.range,n=i.getEndText();t.selection.splitBlock(),(e=i.getBlocks()[0])&&(""!==n||!e.isHeading&&"blockquote"!==e.name?e.isList&&"checklist"===e.attr("type")&&e.find("li").attr("value","false"):t.selection.setBlocks("<p />"))}function Mc(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Ic(t,n)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Ic(t,n)):t.removeBox());const s=L("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function Pc(t){const e=t.selection.range,i=e.startNode.closestBlock();if(i.length>0&&!i.isContainer){const i=e.getPrevNode(),n=e.getEndText();if("br"!==i.name&&""===n)return t.selection.insertContents("<br /><br />"),void t.history.save()}t.selection.insertNode(L("<br />"))}function Oc(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Pc(t)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Pc(t)):t.removeBox());const s=L("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function zc(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.selectBoxEnd(n);if("br"===n.name)return void n.remove();if(!n.isBlock){const t=new I;t.selectNodeContents(n),fe(t,"<p />"),n=t.startNode.closestBlock()}if(n.isEmpty)return void n.remove();const s=t.selection.insertBookmark();Z(n,e),t.selection.toBookmark(s),t.selection.fixList()}function Zc(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.selectBoxStart(n),void t.history.save();if(!n.isBlock){const t=new I;t.selectNodeContents(n),fe(t,"<p />"),n=n.closestBlock()}const s=t.selection.insertBookmark();Z(e,n),t.selection.toBookmark(s),t.selection.fixList()}return Fr.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.selectBox(t)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),Fr.box.add(El),Fr.box.add(Ml),Fr.box.add(lc),Fr.plugin.add((t=>{t.event.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.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=Jt(n).getHTML();s.setData("text/html",o)}))})),Fr.plugin.add((t=>{t.readonly||t.event.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.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=Jt(n).getHTML();s.setData("text/html",o),t.removeBox(),t.history.save()}))})),Fr.plugin.add((t=>{t.readonly||t.event.on("paste",(e=>{const{requestTypes:i}=t.config.image;if(t.selection.range.isInsideBox)return;e.preventDefault();const n=e.clipboardData;if(!n)return;if(t.selection.deleteContents(),n.files.length>0){for(const e of n.files)i.indexOf(e.type)>=0&&Yr({editor:t,name:0===e.type.indexOf("image/")?"image":"file",file:e,onError:e=>t.config.onMessage("error",e)});return}const s=n.types;if(1===s.length&&"text/plain"===s[0]){const e=n.getData("text/plain"),i=new re(e).getFragment();return t.event.emit("beforepaste",i),void dc(t,i)}const o=u(n.getData("text/html")),r=function(){const t=se();t.div=t.p;for(const e of Object.keys(t)){const i=t[e];delete i.id,delete i.class}return t}(),a=new oe(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&&hc(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),dc(t,a),t.box.renderAll(t.container)}))})),Fr.plugin.add((t=>{if(t.readonly)return;let e=null,i=null,n=null,s="bottom";t.container.on("dragstart",(n=>{e=null;const s=n,o=s.dataTransfer;if(!o)return;o.effectAllowed="move";const r=L(s.target).closest("lake-box");if(0===r.length)return void s.preventDefault();"inline"!==Jt(r).type?(e=r,i=L(a`
78
+ `)}writeClipboardText(t){return ta(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(){const t=this.config;let e=null;const i=new Ce({root:this.container.find(".lake-url-row"),name:"copy",icon:n.get("copy"),tooltip:this.locale.link.copy(),onClick:()=>{if(!this.linkNode)return;const i=this.getInputValue("url");this.writeClipboardText(i).then((i=>{const n=this.container.find('button[name="copy"] svg');if(n.hide(),i)return n.eq(2).show("inline"),void(t.onCopy&&t.onCopy(i));n.eq(1).show("inline"),t.onCopy&&t.onCopy(i),e&&window.clearTimeout(e),e=window.setTimeout((()=>{n.hide(),n.eq(0).show("inline")}),2e3)}))}});i.render();const s=n.get("checkCircle");s&&i.node.append(s);const o=n.get("warningCircle");o&&i.node.append(o)}appendOpenButton(){new Ce({root:this.container.find(".lake-url-row"),name:"open",icon:n.get("open"),tooltip:this.locale.link.open(),onClick:()=>{if(!this.linkNode)return;const t=this.getInputValue("url");window.open(t)}}).render()}appendSaveButton(){new Ce({root:this.container.find(".lake-button-row"),name:"save",icon:n.get("check"),text:this.locale.link.save(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode;this.save(),this.hide(),this.config.onSave&&this.config.onSave(t)}}).render()}appendUnlinkButton(){new Ce({root:this.container.find(".lake-button-row"),name:"unlink",icon:n.get("unlink"),text:this.locale.link.unlink(),onClick:()=>{if(!this.linkNode)return;const t=this.linkNode.last();this.linkNode.remove(!0),this.hide(),this.config.onRemove&&this.config.onRemove(t)}}).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=dt(this.linkNode);if(t.left<0||t.right<0||t.top<0||t.bottom<0)return void this.container.css("visibility","hidden");this.container.css("visibility","");const e=this.linkNode.get(0).getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;e.x+this.container.width()>window.innerWidth?this.container.css("left",`${i-this.container.width()+e.width}px`):this.container.css("left",`${i}px`),e.y+e.height+this.container.height()>window.innerHeight?this.container.css("top",n-this.container.height()+"px"):this.container.css("top",`${n+e.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 Sc=["text","c","csharp","cpp","css","go","html","java","javascript","json","markdown","php","python","rust","sql","typescript","xml","yaml"];const Cc=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),Bc=new Map([["js","javascript"],["ts","typescript"],["md","markdown"],["htm","html"]]),Ac=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],Ec=[{re:/^#+$/,getParameters:t=>{var e;return["heading",null!==(e=Cc.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"]}],Tc=[{re:/^:{3,}([a-z]*)$/i,getParameters:t=>t[1]?["blockQuote",t[1]]:["blockQuote","info"]},{re:/^-{3,}$/,getParameters:()=>["hr"]},{re:/^`{3,}([a-z]*)$/i,getParameters:t=>{var e;return t[1]?["codeBlock",{lang:null!==(e=Bc.get(t[1]))&&void 0!==e?e:t[1]}]:["codeBlock"]}}];function Lc(t){const e=t.clone(!0);e.find("lake-bookmark").remove(),""===e.html()&&t.prepend("<br />")}function Ic(t,e){const i=t.selection.range,n=i.getEndText();t.selection.splitBlock(),(e=i.getBlocks()[0])&&(""!==n||!e.isHeading&&"blockquote"!==e.name?e.isList&&"checklist"===e.attr("type")&&e.find("li").attr("value","false"):t.selection.setBlocks("<p />"))}function Mc(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Ic(t,n)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Ic(t,n)):t.removeBox());const s=L("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function Pc(t){const e=t.selection.range,i=e.startNode.closestBlock();if(i.length>0&&!i.isContainer){const i=e.getPrevNode(),n=e.getEndText();if("br"!==i.name&&""===n)return t.selection.insertContents("<br /><br />"),void t.history.save()}t.selection.insertNode(L("<br />"))}function Oc(t){const e=t.selection.range,i=e.startNode.closest("lake-box"),n=i.closestBlock();if(n.length>0&&!n.isContainer)return void(e.isBoxStart?(e.setStartBefore(i),e.collapseToStart(),Pc(t)):e.isBoxEnd?(e.setStartAfter(i),e.collapseToStart(),Pc(t)):t.removeBox());const s=L("<p><br /></p>");e.isBoxStart?i.before(s):e.isBoxEnd?(i.after(s),e.shrinkAfter(s)):t.removeBox()}function zc(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.selectBoxEnd(n);if("br"===n.name)return void n.remove();if(!n.isBlock){const t=new I;t.selectNodeContents(n),fe(t,"<p />"),n=t.startNode.closestBlock()}if(n.isEmpty)return void n.remove();const s=t.selection.insertBookmark();Z(n,e),t.selection.toBookmark(s),t.selection.fixList()}function Zc(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.selectBoxStart(n),void t.history.save();if(!n.isBlock){const t=new I;t.selectNodeContents(n),fe(t,"<p />"),n=n.closestBlock()}const s=t.selection.insertBookmark();Z(e,n),t.selection.toBookmark(s),t.selection.fixList()}return Fr.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.selectBox(t)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),Fr.box.add(El),Fr.box.add(Ml),Fr.box.add(lc),Fr.plugin.add((t=>{t.event.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.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=Yt(n).getHTML();s.setData("text/html",o)}))})),Fr.plugin.add((t=>{t.readonly||t.event.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.isBoxStart||i.isBoxEnd)return;e.preventDefault();const s=e.clipboardData;if(!s)return;const o=Yt(n).getHTML();s.setData("text/html",o),t.removeBox(),t.history.save()}))})),Fr.plugin.add((t=>{t.readonly||t.event.on("paste",(e=>{const{requestTypes:i}=t.config.image;if(t.selection.range.isInsideBox)return;e.preventDefault();const n=e.clipboardData;if(!n)return;if(t.selection.deleteContents(),n.files.length>0){for(const e of n.files)i.indexOf(e.type)>=0&&Jr({editor:t,name:0===e.type.indexOf("image/")?"image":"file",file:e,onError:e=>t.config.onMessage("error",e)});return}const s=n.types;if(1===s.length&&"text/plain"===s[0]){const e=n.getData("text/plain"),i=new re(e).getFragment();return t.event.emit("beforepaste",i),void dc(t,i)}const o=u(n.getData("text/html")),r=function(){const t=se();t.div=t.p;for(const e of Object.keys(t)){const i=t[e];delete i.id,delete i.class}return t}(),a=new oe(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&&hc(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),dc(t,a),t.box.renderAll(t.container)}))})),Fr.plugin.add((t=>{if(t.readonly)return;let e=null,i=null,n=null,s="bottom";t.container.on("dragstart",(n=>{e=null;const s=n,o=s.dataTransfer;if(!o)return;o.effectAllowed="move";const r=L(s.target).closest("lake-box");if(0===r.length)return void s.preventDefault();"inline"!==Yt(r).type?(e=r,i=L(a`
79
79
  <div class="lake-drop-indication">
80
80
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#000000" viewBox="0 0 256 256">
81
81
  <path d="M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"></path>
82
82
  </svg>
83
83
  </div>
84
- `),t.overlayContainer.append(i)):s.preventDefault()})),t.container.on("dragover",(e=>{const o=e;o.preventDefault();const r=o.dataTransfer;if(!r)return;if(r.dropEffect="move",!i)return;const a=L(o.target);if(a.isContainer)return;const l=a.closest("lake-box");n=l.length>0?l.isBlockBox?l:l.closestBlock():a.closestBlock();const c=t.container.get(0).getBoundingClientRect();let h=n.get(0).getBoundingClientRect();s="bottom";let d=h.x-c.x,p=h.y+h.height-c.y+parseInt(n.computedCSS("margin-bottom"),10)/2;if(o.clientY<h.y+h.height/2){const e=n.prev();e.length>0&&e.isBlock||e.isBlockBox?(n=e,h=n.get(0).getBoundingClientRect(),d=h.x-c.x,p=h.y+h.height-c.y+parseInt(n.computedCSS("margin-bottom"),10)/2):(s="top",p=h.y-c.y-parseInt(t.container.computedCSS("padding-top"),10)/2)}i.css({top:`${p}px`,left:`${d}px`,width:`${h.width}px`,display:"block"})})),t.container.on("dragend",(()=>{i&&(i.remove(),i=null)})),t.container.on("drop",(o=>{const r=o;if(r.dataTransfer&&i&&(i.remove(),i=null,e&&n&&e.isBox)){if(e.get(0)===n.get(0))return;if("bottom"===s&&e.get(0)===n.next().get(0))return;r.preventDefault();const i=Jt(e),o=t.selection.range;n.isBox?"top"===s?o.selectBoxStart(n):o.selectBoxEnd(n):(o.selectNodeContents(n),"top"===s?o.collapseToStart():o.collapseToEnd()),t.insertBox(i.name,i.value),e.remove(),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||(t.command.add("undo",{execute:()=>{t.history.undo()}}),t.keystroke.setKeydown("mod+z",(e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("undo"))})))})),Fr.plugin.add((t=>{if(t.readonly)return;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)})),Fr.plugin.add((t=>{t.readonly||t.command.add("selectAll",{execute:()=>{const e=t.selection.range;e.selectNodeContents(t.container),e.shrink()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("blockQuote",{isSelected:t=>!!t.find((t=>"blockquote"===t.name)),execute:e=>{e&&pc.indexOf(e)>=0?t.selection.setBlocks(a`<blockquote type="${e}" />`):t.selection.setBlocks("<blockquote />"),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||(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&&uc(t),"bulleted"===e&&fc(t),"checklist"===e&&gc(t,i)):o?("numbered"===e&&mc(t),"bulleted"===e&&uc(t),"checklist"===e&&gc(t,i)):r?("numbered"===e&&mc(t),"bulleted"===e&&fc(t),"checklist"===e&&uc(t)):("numbered"===e&&mc(t),"bulleted"===e&&fc(t),"checklist"===e&&gc(t,i)),t.history.save()}}),t.container.on("click",(e=>{const i=e;if(!i.target)return;const n=L(i.target);"li"===n.name&&""!==n.attr("value")&&i.offsetX<=18&&(n.attr("value",("true"!==n.attr("value")).toString()),t.history.save())})))})),Fr.plugin.add((t=>{t.readonly||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?[vc[e]||e]:[]},execute:e=>{t.selection.setBlocks({"text-align":e}),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("indent",{execute:e=>{const i=t.selection.range.getBlocks();for(const t of i)F(t,e);t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||(t.command.add("bold",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),isSelected:t=>!!t.find((t=>t.name===wc)),execute:()=>{t.command.isSelected("bold")?t.selection.removeMark(`<${wc} />`):t.selection.addMark(`<${wc} />`),t.history.save()}}),t.keystroke.setKeydown("mod+b",(e=>{e.preventDefault(),t.command.execute("bold")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||t.command.add("subscript",{isSelected:t=>!!t.find((t=>t.name===yc)),execute:()=>{t.command.isSelected("subscript")?t.selection.removeMark(`<${yc} />`):t.selection.addMark(`<${yc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("superscript",{isSelected:t=>!!t.find((t=>t.name===xc)),execute:()=>{t.command.isSelected("superscript")?t.selection.removeMark(`<${xc} />`):t.selection.addMark(`<${xc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("code",{isSelected:t=>!!t.find((t=>t.name===bc)),execute:()=>{t.command.isSelected("code")?t.selection.removeMark(`<${bc} />`):t.selection.addMark(`<${bc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("removeFormat",{execute:()=>{t.selection.removeMark(),t.history.save()}})})),Fr.plugin.add((t=>{if(t.readonly)return;let e=[];t.command.add("formatPainter",{execute:()=>{t.container.addClass(kc);const i=t.selection.getAppliedItems();for(const t of i){const i=t.node.clone();i.isMark&&"a"!==i.name&&e.push(i)}}}),t.container.on("click",(()=>{if(t.container.removeClass(kc),0!==e.length){for(const i of e)t.selection.addMark(i);e=[],t.history.save()}})),t.event.on("click",(i=>{if(i.isInside&&i.closestContainer().get(0)===t.container.get(0))return;i.closest('button[name="formatPainter"]').length>0||(t.container.removeClass(kc),e=[])}))})),Fr.plugin.add((t=>{if(t.readonly)return;const e=new _c({root:t.popupContainer,locale:t.locale,onSave:e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.sync(),t.history.save()},onRemove:e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.sync(),t.history.save()}});t.root.on("scroll",(()=>{e.updatePosition()})),t.event.on("resize",(()=>{e.updatePosition()})),t.event.on("click",(i=>{if(i.closest('button[name="link"]').length>0)return;const n=i.closest("a");0!==n.length?n.isOutside||n.closestContainer().get(0)!==t.container.get(0)||n.closest("lake-box").length>0?e.hide():e.show(n):e.hide()})),t.command.add("link",{execute:()=>{const i=t.selection.insertLink(`<a href="">${t.locale.link.newLink()}</a>`);i&&(t.history.save(),e.show(i))}})})),Fr.plugin.add((t=>{t.readonly||(t.event.on("beforepaste",(t=>{new ie(t).find("hr").each((t=>{const e=L(t),i=Jt("hr");e.replaceWith(i.node)}))})),t.command.add("hr",{execute:()=>{t.insertBox("hr"),t.history.save()}}))})),Fr.plugin.add((t=>{t.setPluginConfig("image",{requestMethod:"POST",requestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]}),t.readonly||(t.event.on("beforepaste",(t=>{new ie(t).find("img").each((t=>{const e=L(t),i=Jt("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()}}))})),Fr.plugin.add((t=>{t.setPluginConfig("file",{requestMethod:"POST",requestTypes:["application/zip","application/x-zip-compressed","application/vnd.rar","image/gif","image/jpeg","image/png","image/svg+xml","text/plain","text/html","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"]}),t.readonly||t.command.add("file",{execute:e=>{t.insertBox("file",e),t.history.save()}})})),Fr.plugin.add((t=>{window.LakeCodeMirror&&(t.setPluginConfig("codeBlock",{langList:Sc,defaultLang:"text"}),t.readonly||t.command.add("codeBlock",{execute:e=>{const i=t.insertBox("codeBlock",e);t.history.save();i.getData("codeEditor").focus()}}))})),Fr.plugin.add((t=>{t.readonly||(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 Ac){const r=e.re.exec(o);if(null!==r){const o=e.getParameters(),a=o.shift();if(!t.command.has(a))return!1;t.prepareOperation();const l=i.insertBookmark(),c=l.focus.prev(),h=c.text(),d=`${h.replace(e.re,"$1")}​`;return c.get(0).nodeValue=d,n.setStart(c,s-r[0].length),n.setEnd(c,s-(h.length-d.length)-1),t.command.execute(a,...o),i.toBookmark(l),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 Ec){const n=e.re.exec(s);if(null!==n){const s=e.getParameters(n),o=s.shift();if(!t.command.has(o))return!1;t.prepareOperation();const r=i.insertBookmark();r.focus.prev().remove();const a=r.focus.closestBlock();return Lc(a),i.range.shrinkAfter(a),t.command.execute(o,...s),i.toBookmark(r),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.getEndText()?void 0:function(t,e){const i=t.selection;let n=e.text();n=n.replace(/[\u200B\u2060]/g,"");for(const s of Tc){const o=s.re.exec(n);if(null!==o){const n=s.getParameters(o),r=n.shift();return!!t.command.has(r)&&(t.prepareOperation(),e.empty(),Lc(e),i.range.shrinkAfter(e),t.command.execute(r,...n),t.commitOperation(),!0)}}return!1}(t,n)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0})))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(e.preventDefault(),t.rectifyContent(),i.isBox)return Mc(t),void t.history.save();if(i.adapt(),i.isInoperative)return;if(i.isBox)return Mc(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();Ic(t,n),t.history.save()}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("shift+enter",(e=>{const i=t.selection.range;if(!i.isInsideBox){if(t.rectifyContent(),e.preventDefault(),i.isBox)return Oc(t),void t.history.save();if(i.adapt(),!i.isInoperative){if(i.isBox)return Oc(t),void t.history.save();Pc(t),t.history.save()}}}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("backspace",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxStart){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(),zc(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(),t.removeBox(n),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.getStartText()){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();zc(t,n),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("delete",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxEnd){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(),Zc(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(),t.removeBox(n),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.getEndText()){e.preventDefault();let n=i.getBlocks()[0];n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),Zc(t,n),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||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()}))})),Fr.plugin.add((t=>{t.readonly||(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.isBoxStart){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.isBoxEnd?(e.preventDefault(),void i.selectBox(n)):(e.preventDefault(),void i.selectBoxStart(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.isBoxStart)return e.preventDefault(),void i.selectBox(n);if(i.isBoxEnd){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.selectBoxEnd(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()}})))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("escape",(e=>{const i=t.selection,n=i.range;if(n.isBoxCenter||n.isInsideBox){e.preventDefault();const t=n.commonAncestor.closest("lake-box");return n.selectBoxEnd(t),void i.sync()}t.hasFocus&&(e.preventDefault(),t.blur())}))})),t.Box=Yt,t.Button=Ce,t.Dropdown=Fe,t.Editor=Fr,t.Fragment=ie,t.HTMLParser=oe,t.Nodes=T,t.Range=I,t.TextParser=re,t.Toolbar=class{constructor(t){this.placement="top",this.allMenuMap=new Map,this.buttonItemList=[],this.dropdownItemList=[],this.root=L(t.root),this.items=t.items||Jr,t.placement&&(this.placement=t.placement),this.container=L('<div class="lake-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(t,e){new Ce({root:this.container,name:e.name,icon:e.icon,tooltip:"string"==typeof e.tooltip?e.tooltip:e.tooltip(t.locale),tabIndex:-1,onClick:()=>{t.focus(),e.onClick(t,e.name)}}).render()}appendDropdown(t,e){new Fe({root:this.container,locale:t.locale,name:e.name,icon:e.icon,accentIcon:e.accentIcon,downIcon:e.downIcon,defaultValue:e.defaultValue,tooltip:e.tooltip,width:e.width,menuType:e.menuType,menuItems:e.menuItems,tabIndex:-1,placement:"top"===this.placement?"bottom":"top",onSelect:i=>{t.focus(),e.onSelect(t,i)}}).render()}appendUpload(t,e){const i=L(a`
84
+ `),t.overlayContainer.append(i)):s.preventDefault()})),t.container.on("dragover",(e=>{const o=e;o.preventDefault();const r=o.dataTransfer;if(!r)return;if(r.dropEffect="move",!i)return;const a=L(o.target);if(a.isContainer)return;const l=a.closest("lake-box");n=l.length>0?l.isBlockBox?l:l.closestBlock():a.closestBlock();const c=t.container.get(0).getBoundingClientRect();let h=n.get(0).getBoundingClientRect();s="bottom";let d=h.x-c.x,p=h.y+h.height-c.y+parseInt(n.computedCSS("margin-bottom"),10)/2;if(o.clientY<h.y+h.height/2){const e=n.prev();e.length>0&&e.isBlock||e.isBlockBox?(n=e,h=n.get(0).getBoundingClientRect(),d=h.x-c.x,p=h.y+h.height-c.y+parseInt(n.computedCSS("margin-bottom"),10)/2):(s="top",p=h.y-c.y-parseInt(t.container.computedCSS("padding-top"),10)/2)}i.css({top:`${p}px`,left:`${d}px`,width:`${h.width}px`,display:"block"})})),t.container.on("dragend",(()=>{i&&(i.remove(),i=null)})),t.container.on("drop",(o=>{const r=o;if(r.dataTransfer&&i&&(i.remove(),i=null,e&&n&&e.isBox)){if(e.get(0)===n.get(0))return;if("bottom"===s&&e.get(0)===n.next().get(0))return;r.preventDefault();const i=Yt(e),o=t.selection.range;n.isBox?"top"===s?o.selectBoxStart(n):o.selectBoxEnd(n):(o.selectNodeContents(n),"top"===s?o.collapseToStart():o.collapseToEnd()),t.insertBox(i.name,i.value),e.remove(),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||(t.command.add("undo",{execute:()=>{t.history.undo()}}),t.keystroke.setKeydown("mod+z",(e=>{t.selection.range.isInsideBox||(e.preventDefault(),t.command.execute("undo"))})))})),Fr.plugin.add((t=>{if(t.readonly)return;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)})),Fr.plugin.add((t=>{t.readonly||t.command.add("selectAll",{execute:()=>{const e=t.selection.range;e.selectNodeContents(t.container),e.shrink()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("blockQuote",{isSelected:t=>!!t.find((t=>"blockquote"===t.name)),execute:e=>{e&&pc.indexOf(e)>=0?t.selection.setBlocks(a`<blockquote type="${e}" />`):t.selection.setBlocks("<blockquote />"),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||(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&&uc(t),"bulleted"===e&&fc(t),"checklist"===e&&gc(t,i)):o?("numbered"===e&&mc(t),"bulleted"===e&&uc(t),"checklist"===e&&gc(t,i)):r?("numbered"===e&&mc(t),"bulleted"===e&&fc(t),"checklist"===e&&uc(t)):("numbered"===e&&mc(t),"bulleted"===e&&fc(t),"checklist"===e&&gc(t,i)),t.history.save()}}),t.container.on("click",(e=>{const i=e;if(!i.target)return;const n=L(i.target);"li"===n.name&&""!==n.attr("value")&&i.offsetX<=18&&(n.attr("value",("true"!==n.attr("value")).toString()),t.history.save())})))})),Fr.plugin.add((t=>{t.readonly||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?[vc[e]||e]:[]},execute:e=>{t.selection.setBlocks({"text-align":e}),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("indent",{execute:e=>{const i=t.selection.range.getBlocks();for(const t of i)F(t,e);t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||(t.command.add("bold",{isDisabled:t=>!!t.find((t=>t.node.isHeading)),isSelected:t=>!!t.find((t=>t.name===yc)),execute:()=>{t.command.isSelected("bold")?t.selection.removeMark(`<${yc} />`):t.selection.addMark(`<${yc} />`),t.history.save()}}),t.keystroke.setKeydown("mod+b",(e=>{e.preventDefault(),t.command.execute("bold")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||(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")})))})),Fr.plugin.add((t=>{t.readonly||t.command.add("subscript",{isSelected:t=>!!t.find((t=>t.name===wc)),execute:()=>{t.command.isSelected("subscript")?t.selection.removeMark(`<${wc} />`):t.selection.addMark(`<${wc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("superscript",{isSelected:t=>!!t.find((t=>t.name===xc)),execute:()=>{t.command.isSelected("superscript")?t.selection.removeMark(`<${xc} />`):t.selection.addMark(`<${xc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("code",{isSelected:t=>!!t.find((t=>t.name===bc)),execute:()=>{t.command.isSelected("code")?t.selection.removeMark(`<${bc} />`):t.selection.addMark(`<${bc} />`),t.history.save()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||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()}})})),Fr.plugin.add((t=>{t.readonly||t.command.add("removeFormat",{execute:()=>{t.selection.removeMark(),t.history.save()}})})),Fr.plugin.add((t=>{if(t.readonly)return;let e=[];t.command.add("formatPainter",{execute:()=>{t.container.addClass(kc);const i=t.selection.getAppliedItems();for(const t of i){const i=t.node.clone();i.isMark&&"a"!==i.name&&e.push(i)}}}),t.container.on("click",(()=>{if(t.container.removeClass(kc),0!==e.length){for(const i of e)t.selection.addMark(i);e=[],t.history.save()}})),t.event.on("click",(i=>{if(i.isInside&&i.closestContainer().get(0)===t.container.get(0))return;i.closest('button[name="formatPainter"]').length>0||(t.container.removeClass(kc),e=[])}))})),Fr.plugin.add((t=>{if(t.readonly)return;const e=new _c({root:t.popupContainer,locale:t.locale,onSave:e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.sync(),t.history.save()},onRemove:e=>{const i=t.selection.range;i.setStartAfter(e),i.collapseToStart(),t.selection.sync(),t.history.save()}});t.root.on("scroll",(()=>{e.updatePosition()})),t.event.on("resize",(()=>{e.updatePosition()})),t.event.on("click",(i=>{if(i.closest('button[name="link"]').length>0)return;const n=i.closest("a");0!==n.length?n.isOutside||n.closestContainer().get(0)!==t.container.get(0)||n.closest("lake-box").length>0?e.hide():e.show(n):e.hide()})),t.command.add("link",{execute:()=>{const i=t.selection.insertLink(`<a href="">${t.locale.link.newLink()}</a>`);i&&(t.history.save(),e.show(i))}})})),Fr.plugin.add((t=>{t.readonly||(t.event.on("beforepaste",(t=>{new ie(t).find("hr").each((t=>{const e=L(t),i=Yt("hr");e.replaceWith(i.node)}))})),t.command.add("hr",{execute:()=>{t.insertBox("hr"),t.history.save()}}))})),Fr.plugin.add((t=>{t.setPluginConfig("image",{requestMethod:"POST",requestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]}),t.readonly||(t.event.on("beforepaste",(t=>{new ie(t).find("img").each((t=>{const e=L(t),i=Yt("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()}}))})),Fr.plugin.add((t=>{t.setPluginConfig("file",{requestMethod:"POST",requestTypes:["application/zip","application/x-zip-compressed","application/vnd.rar","image/gif","image/jpeg","image/png","image/svg+xml","text/plain","text/html","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"]}),t.readonly||t.command.add("file",{execute:e=>{t.insertBox("file",e),t.history.save()}})})),Fr.plugin.add((t=>{window.LakeCodeMirror&&(t.setPluginConfig("codeBlock",{langList:Sc,defaultLang:"text"}),t.readonly||t.command.add("codeBlock",{execute:e=>{const i=t.insertBox("codeBlock",e);t.history.save();i.getData("codeEditor").focus()}}))})),Fr.plugin.add((t=>{t.readonly||(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 Ac){const r=e.re.exec(o);if(null!==r){const o=e.getParameters(),a=o.shift();if(!t.command.has(a))return!1;t.prepareOperation();const l=i.insertBookmark(),c=l.focus.prev(),h=c.text(),d=`${h.replace(e.re,"$1")}​`;return c.get(0).nodeValue=d,n.setStart(c,s-r[0].length),n.setEnd(c,s-(h.length-d.length)-1),t.command.execute(a,...o),i.toBookmark(l),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 Ec){const n=e.re.exec(s);if(null!==n){const s=e.getParameters(n),o=s.shift();if(!t.command.has(o))return!1;t.prepareOperation();const r=i.insertBookmark();r.focus.prev().remove();const a=r.focus.closestBlock();return Lc(a),i.range.shrinkAfter(a),t.command.execute(o,...s),i.toBookmark(r),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.getEndText()?void 0:function(t,e){const i=t.selection;let n=e.text();n=n.replace(/[\u200B\u2060]/g,"");for(const s of Tc){const o=s.re.exec(n);if(null!==o){const n=s.getParameters(o),r=n.shift();return!!t.command.has(r)&&(t.prepareOperation(),e.empty(),Lc(e),i.range.shrinkAfter(e),t.command.execute(r,...n),t.commitOperation(),!0)}}return!1}(t,n)?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0})))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("enter",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(e.preventDefault(),t.rectifyContent(),i.isBox)return Mc(t),void t.history.save();if(i.adapt(),i.isInoperative)return;if(i.isBox)return Mc(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();Ic(t,n),t.history.save()}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("shift+enter",(e=>{const i=t.selection.range;if(!i.isInsideBox){if(t.rectifyContent(),e.preventDefault(),i.isBox)return Oc(t),void t.history.save();if(i.adapt(),!i.isInoperative){if(i.isBox)return Oc(t),void t.history.save();Pc(t),t.history.save()}}}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("backspace",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxStart){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(),zc(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(),t.removeBox(n),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.getStartText()){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();zc(t,n),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("delete",(e=>{const i=t.selection.range;if(i.isInsideBox)return;if(t.rectifyContent(),i.isBoxEnd){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(),Zc(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(),t.removeBox(n),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.getEndText()){e.preventDefault();let n=i.getBlocks()[0];n||(t.selection.setBlocks("<p />"),n=i.getBlocks()[0]),Zc(t,n),t.history.save()}}))})),Fr.plugin.add((t=>{t.readonly||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()}))})),Fr.plugin.add((t=>{t.readonly||(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.isBoxStart){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.isBoxEnd?(e.preventDefault(),void i.selectBox(n)):(e.preventDefault(),void i.selectBoxStart(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.isBoxStart)return e.preventDefault(),void i.selectBox(n);if(i.isBoxEnd){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.selectBoxEnd(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()}})))})),Fr.plugin.add((t=>{t.readonly||t.keystroke.setKeydown("escape",(e=>{const i=t.selection,n=i.range;if(n.isBoxCenter||n.isInsideBox){e.preventDefault();const t=n.commonAncestor.closest("lake-box");return n.selectBoxEnd(t),void i.sync()}t.hasFocus&&(e.preventDefault(),t.blur())}))})),t.Box=Jt,t.Button=Ce,t.Dropdown=Fe,t.Editor=Fr,t.Fragment=ie,t.HTMLParser=oe,t.Nodes=T,t.Range=I,t.TextParser=re,t.Toolbar=class{constructor(t){this.placement="top",this.allMenuMap=new Map,this.buttonItemList=[],this.dropdownItemList=[],this.root=L(t.root),this.items=t.items||Yr,t.placement&&(this.placement=t.placement),this.container=L('<div class="lake-toolbar" />'),this.root.addClass("lake-custom-properties")}appendDivider(){this.container.append('<div class="lake-toolbar-divider" />')}appendButton(t,e){new Ce({root:this.container,name:e.name,icon:e.icon,tooltip:"string"==typeof e.tooltip?e.tooltip:e.tooltip(t.locale),tabIndex:-1,onClick:()=>{t.focus(),e.onClick(t,e.name)}}).render()}appendDropdown(t,e){new Fe({root:this.container,locale:t.locale,name:e.name,icon:e.icon,accentIcon:e.accentIcon,downIcon:e.downIcon,defaultValue:e.defaultValue,tooltip:e.tooltip,width:e.width,menuType:e.menuType,menuItems:e.menuItems,tabIndex:-1,placement:"top"===this.placement?"bottom":"top",onSelect:i=>{t.focus(),e.onSelect(t,i)}}).render()}appendUpload(t,e){const i=L(a`
85
85
  <div class="lake-upload" name="${e.name}">
86
86
  <input type="file" />
87
87
  </div>
88
- `),n=i.find('input[type="file"]'),s=n.get(0);e.accept&&n.attr("accept",e.accept),!0===e.multiple&&n.attr("multiple","true");new Ce({root:i,name:e.name,icon:e.icon,tooltip:"string"==typeof e.tooltip?e.tooltip:e.tooltip(t.locale),tabIndex:-1,onClick:()=>{t.focus(),s.click()}}).render(),this.container.append(i),n.on("click",(t=>t.stopPropagation())),n.on("change",(i=>{const n=i.target.files||[];for(const i of n)Yr({editor:t,name:e.name,file:i,onError:e=>t.config.onMessage("error",e)})}))}updateState(t){var e;const{appliedItems:i,disabledNameMap:n,selectedNameMap:s,selectedValuesMap:o}=t;for(const t of this.buttonItemList){const e="lake-button-selected",o=this.container.find(`button[name="${t.name}"]`);let r=n.get(t.name);if(void 0===r&&(r=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),r?(o.attr("disabled","true"),o.removeClass(e)):o.removeAttr("disabled"),!r){let n=s.get(t.name);void 0===n&&(n=!!(t.isSelected&&i.length>0)&&t.isSelected(i)),n?o.addClass(e):o.removeClass(e)}}for(const t of this.dropdownItemList){let s=o.get(t.name);void 0===s&&(s=t.selectedValues&&i.length>0?t.selectedValues(i):[]);const r=this.container.find(`div.lake-dropdown[name="${t.name}"]`);let a=n.get(t.name);if(void 0===a&&(a=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),a?r.attr("disabled","true"):r.removeAttr("disabled"),!a){Fe.setValue(r,s);const i=r.find(".lake-dropdown-text");if(i.length>0){const n=s[0]||t.defaultValue,o=this.allMenuMap.get(t.name),r=null!==(e=o&&o.get(n))&&void 0!==e?e:n;i.text(r)}}}}render(t){this.root.empty(),this.root.append(this.container),this.items.forEach((e=>{if("|"===e)return void this.appendDivider();let i;if("string"==typeof e){if(i=Qr.get(e),!i)return}else i=e;return"button"===i.type?(this.buttonItemList.push(i),void this.appendButton(t,i)):"dropdown"===i.type?(this.allMenuMap.set(i.name,Fe.getMenuMap(i.menuItems,t.locale)),this.dropdownItemList.push(i),void this.appendDropdown(t,i)):void("upload"===i.type&&this.appendUpload(t,i))}))}},t.Utils=ee,t.addMark=be,t.deleteContents=pe,t.fixList=de,t.icons=n,t.insertBookmark=le,t.insertContents=me,t.insertFragment=ue,t.insertLink=Se,t.insertNode=ae,t.removeMark=_e,t.setBlocks=fe,t.splitBlock=ge,t.splitMarks=ye,t.toBookmark=he,t}({});
88
+ `),n=i.find('input[type="file"]'),s=n.get(0);e.accept&&n.attr("accept",e.accept),!0===e.multiple&&n.attr("multiple","true");new Ce({root:i,name:e.name,icon:e.icon,tooltip:"string"==typeof e.tooltip?e.tooltip:e.tooltip(t.locale),tabIndex:-1,onClick:()=>{t.focus(),s.click()}}).render(),this.container.append(i),n.on("click",(t=>t.stopPropagation())),n.on("change",(i=>{const n=i.target.files||[];for(const i of n)Jr({editor:t,name:e.name,file:i,onError:e=>t.config.onMessage("error",e)})}))}updateState(t){var e;const{appliedItems:i,disabledNameMap:n,selectedNameMap:s,selectedValuesMap:o}=t;for(const t of this.buttonItemList){const e="lake-button-selected",o=this.container.find(`button[name="${t.name}"]`);let r=n.get(t.name);if(void 0===r&&(r=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),r?(o.attr("disabled","true"),o.removeClass(e)):o.removeAttr("disabled"),!r){let n=s.get(t.name);void 0===n&&(n=!!(t.isSelected&&i.length>0)&&t.isSelected(i)),n?o.addClass(e):o.removeClass(e)}}for(const t of this.dropdownItemList){let s=o.get(t.name);void 0===s&&(s=t.selectedValues&&i.length>0?t.selectedValues(i):[]);const r=this.container.find(`div.lake-dropdown[name="${t.name}"]`);let a=n.get(t.name);if(void 0===a&&(a=!!(t.isDisabled&&i.length>0)&&t.isDisabled(i)),a?r.attr("disabled","true"):r.removeAttr("disabled"),!a){Fe.setValue(r,s);const i=r.find(".lake-dropdown-text");if(i.length>0){const n=s[0]||t.defaultValue,o=this.allMenuMap.get(t.name),r=null!==(e=o&&o.get(n))&&void 0!==e?e:n;i.text(r)}}}}render(t){this.root.empty(),this.root.append(this.container),this.items.forEach((e=>{if("|"===e)return void this.appendDivider();let i;if("string"==typeof e){if(i=Qr.get(e),!i)return}else i=e;return"button"===i.type?(this.buttonItemList.push(i),void this.appendButton(t,i)):"dropdown"===i.type?(this.allMenuMap.set(i.name,Fe.getMenuMap(i.menuItems,t.locale)),this.dropdownItemList.push(i),void this.appendDropdown(t,i)):void("upload"===i.type&&this.appendUpload(t,i))}))}},t.Utils=ee,t.addMark=be,t.deleteContents=pe,t.fixList=de,t.icons=n,t.insertBookmark=le,t.insertContents=me,t.insertFragment=ue,t.insertLink=Se,t.insertNode=ae,t.removeMark=_e,t.setBlocks=fe,t.splitBlock=ge,t.splitMarks=we,t.toBookmark=he,t}({});
89
89
  //# sourceMappingURL=lake.min.js.map