From 0e799a38576aae3e83b10a3ef07067c245c4f876 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 10 Jan 2021 14:05:16 +0000 Subject: [PATCH] Updated version and assets for release v0.31.2 --- public/dist/app.js | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/dist/app.js b/public/dist/app.js index ae3d8ef5c..3be494c65 100644 --- a/public/dist/app.js +++ b/public/dist/app.js @@ -73,7 +73,7 @@ Expect errors in decoding.`),i=i.replace(/[^A-Za-z0-9\+\/\=]/g,"");!(h=this.KEY_ `+s;this.cm.setValue(u),this.cm.setCursor(i.line,i.ch)}),window.$events.listen("editor::prepend",n=>{const i=this.cm.getCursor("from"),s=t(n),u=s+` `+this.cm.getValue();this.cm.setValue(u);const c=s.split(` `).length;this.cm.setCursor(i.line+c,i.ch)}),window.$events.listen("editor::insert",n=>{const i=t(n);this.cm.replaceSelection(i)}),window.$events.listen("editor::focus",()=>{this.cm.focus()})}}var hv=Lx;class Ix{constructor(t){this.elem=t,this.inviteOption=t.querySelector("input[name=send_invite]"),this.inviteOption&&(this.inviteOption.addEventListener("change",this.inviteOptionChange.bind(this)),this.inviteOptionChange())}inviteOptionChange(){const t=this.inviteOption.value==="true",n=this.elem.querySelectorAll("input[type=password]");for(const s of n)s.disabled=t;const i=this.elem.querySelector("#password-input-container");i&&(i.style.display=t?"none":"block")}}var fv=Ix;class Fx{constructor(t){this.elem=t,this.type=t.getAttribute("notification"),this.textElem=t.querySelector("span"),this.autohide=this.elem.hasAttribute("data-autohide"),this.elem.style.display="grid",window.$events.listen(this.type,n=>{this.show(n)}),t.addEventListener("click",this.hide.bind(this)),t.hasAttribute("data-show")&&setTimeout(()=>this.show(this.textElem.textContent),100),this.hideCleanup=this.hideCleanup.bind(this)}show(t=""){if(this.elem.removeEventListener("transitionend",this.hideCleanup),this.textElem.textContent=t,this.elem.style.display="grid",setTimeout(()=>{this.elem.classList.add("showing")},1),this.autohide){const n=t.split(" ").length,i=Math.max(2e3,1e3+250*n);setTimeout(this.hide.bind(this),i)}}hide(){this.elem.classList.remove("showing"),this.elem.addEventListener("transitionend",this.hideCleanup)}hideCleanup(){this.elem.style.display="none",this.elem.removeEventListener("transitionend",this.hideCleanup)}}var pv=Fx;class Mx{setup(){this.removeButton=this.$refs.remove,this.showButton=this.$refs.show,this.input=this.$refs.input,this.setupListeners()}setupListeners(){ot(this.removeButton,()=>{this.input.value="",this.input.classList.add("hidden"),this.removeButton.classList.add("hidden"),this.showButton.classList.remove("hidden")}),ot(this.showButton,()=>{this.input.classList.remove("hidden"),this.removeButton.classList.remove("hidden"),this.showButton.classList.add("hidden")})}}var mv=Mx;class qx{setup(){this.elem=this.$el,this.pageId=Number(this.$opts.pageId),this.container=this.$refs.commentContainer,this.formContainer=this.$refs.formContainer,this.commentCountBar=this.$refs.commentCountBar,this.addButtonContainer=this.$refs.addButtonContainer,this.replyToRow=this.$refs.replyToRow,this.updatedText=this.$opts.updatedText,this.deletedText=this.$opts.deletedText,this.createdText=this.$opts.createdText,this.countText=this.$opts.countText,this.editingComment=null,this.parentId=null,this.formContainer&&(this.form=this.formContainer.querySelector("form"),this.formInput=this.form.querySelector("textarea"),this.form.addEventListener("submit",this.saveComment.bind(this))),this.elem.addEventListener("click",this.handleAction.bind(this)),this.elem.addEventListener("submit",this.updateComment.bind(this))}handleAction(t){let n=t.target.closest("[action]");if(t.target.matches('a[href^="#"]')){const u=t.target.href.split("#")[1];ro(document.querySelector("#"+u))}if(n===null)return;t.preventDefault();const i=n.getAttribute("action"),s=n.closest("[comment]");i==="edit"&&this.editComment(s),i==="closeUpdateForm"&&this.closeUpdateForm(),i==="delete"&&this.deleteComment(s),i==="addComment"&&this.showForm(),i==="hideForm"&&this.hideForm(),i==="reply"&&this.setReply(s),i==="remove-reply-to"&&this.removeReplyTo()}closeUpdateForm(){if(!this.editingComment)return;this.editingComment.querySelector("[comment-content]").style.display="block",this.editingComment.querySelector("[comment-edit-container]").style.display="none"}editComment(t){this.hideForm(),this.editingComment&&this.closeUpdateForm(),t.querySelector("[comment-content]").style.display="none",t.querySelector("[comment-edit-container]").style.display="block";let n=t.querySelector("[comment-edit-container] textarea"),i=n.value.split(` -`).length;n.style.height=i*20+40+"px",this.editingComment=t}updateComment(t){let n=t.target;t.preventDefault();let i=n.querySelector("textarea").value,s={text:i,parent_id:this.parentId||null};this.showLoading(n);let u=this.editingComment.getAttribute("comment");window.$http.put(`/comment/${u}`,s).then(c=>{let d=document.createElement("div");d.innerHTML=c.data,this.editingComment.innerHTML=d.children[0].innerHTML,window.$events.success(this.updatedText),window.components.init(this.editingComment),this.closeUpdateForm(),this.editingComment=null}).catch(window.$events.showValidationErrors).then(()=>{this.hideLoading(n)})}deleteComment(t){let n=t.getAttribute("comment");this.showLoading(t.querySelector("[comment-content]")),window.$http.delete(`/comment/${n}`).then(i=>{t.parentNode.removeChild(t),window.$events.success(this.deletedText),this.updateCount(),this.hideForm()})}saveComment(t){t.preventDefault(),t.stopPropagation();let n=this.formInput.value,i={text:n,parent_id:this.parentId||null};this.showLoading(this.form),window.$http.post(`/comment/${this.pageId}`,i).then(s=>{let u=document.createElement("div");u.innerHTML=s.data;let c=u.children[0];this.container.appendChild(c),window.components.init(c),window.$events.success(this.createdText),this.resetForm(),this.updateCount()}).catch(s=>{window.$events.showValidationErrors(s),this.hideLoading(this.form)})}updateCount(){let t=this.container.children.length;this.elem.querySelector("[comments-title]").textContent=window.trans_plural(this.countText,t,{count:t})}resetForm(){this.formInput.value="",this.formContainer.appendChild(this.form),this.hideForm(),this.removeReplyTo(),this.hideLoading(this.form)}showForm(){this.formContainer.style.display="block",this.formContainer.parentNode.style.display="block",this.addButtonContainer.style.display="none",this.formInput.focus(),this.formInput.scrollIntoView({behavior:"smooth"})}hideForm(){this.formContainer.style.display="none",this.formContainer.parentNode.style.display="none",this.getCommentCount()>0?this.elem.appendChild(this.addButtonContainer):this.commentCountBar.appendChild(this.addButtonContainer),this.addButtonContainer.style.display="block"}getCommentCount(){return this.elem.querySelectorAll(".comment-box[comment]").length}setReply(t){this.showForm(),this.parentId=Number(t.getAttribute("local-id")),this.replyToRow.style.display="block";const n=this.replyToRow.querySelector("a");n.textContent=`#${this.parentId}`,n.href=`#comment${this.parentId}`}removeReplyTo(){this.parentId=null,this.replyToRow.style.display="none"}showLoading(t){const n=t.querySelectorAll(".form-group");for(let i of n)i.style.display="none";t.querySelector(".form-group.loading").style.display="block"}hideLoading(t){const n=t.querySelectorAll(".form-group");for(let i of n)i.style.display="block";t.querySelector(".form-group.loading").style.display="none"}}var gv=qx;const vv=Ke(Vs());class zx{constructor(t){if(this.elem=t,this.pageId=t.getAttribute("page-display"),Nt.highlight(),this.setupPointer(),this.setupNavHighlighting(),window.location.hash){let i=window.location.hash.replace(/\%20/g," ").substr(1);this.goToText(i)}const n=document.querySelector(".sidebar-page-nav");n&&_t(n,"a","click",(i,s)=>{i.preventDefault(),window.components["tri-layout"][0].showContent();const u=s.getAttribute("href").substr(1);this.goToText(u),window.history.pushState(null,null,"#"+u)})}goToText(t){const n=document.getElementById(t);if(xa(".page-content [data-highlighted]",i=>{i.removeAttribute("data-highlighted"),i.style.backgroundColor=null}),n!==null)ro(n);else{const i=rg(".page-content > div > *",t);i&&ro(i)}}setupPointer(){let t=document.getElementById("pointer");if(!t)return;t=t.parentNode.removeChild(t);const n=t.querySelector("div.pointer");let i=!1,s=!1,u=!0,c="";_t(t,"input","click",(h,p)=>{p.select(),h.stopPropagation()}),_a(t,["click","focus"],h=>{h.stopPropagation()}),_t(t,"span.icon","click",(h,p)=>{h.stopPropagation(),u=!u,p.querySelector('[data-icon="include"]').style.display=u?"none":"inline",p.querySelector('[data-icon="link"]').style.display=u?"inline":"none",d()}),new vv.default(t.querySelector("button")),_a(document.body,["click","focus"],h=>{if(!i||s)return;t=t.parentElement.removeChild(t),i=!1});let d=h=>{let p=u?window.baseUrl(`/link/${this.pageId}#${c}`):`{{@${this.pageId}#${c}}}`;u&&!p.startsWith("http")&&(p=window.location.protocol+"//"+window.location.host+p),t.querySelector("input").value=p;const g=t.querySelector("#pointer-edit");if(g&&h){const y=g.dataset.editHref,m=h.id,b=h.textContent&&h.textContent.substring(0,50);g.href=`${y}?content-id=${m}&content-text=${encodeURIComponent(b)}`}};xa('.page-content [id^="bkmrk"]',h=>{_a(h,["mouseup","keyup"],p=>{p.stopPropagation();let g=window.getSelection();if(g.toString().length===0)return;c=h.id,d(h),h.parentNode.insertBefore(t,h),t.style.display="block",i=!0,s=!0,requestAnimationFrame(()=>{const y=h.getBoundingClientRect();let m=p.pageX-y.left-164;m<0&&(m=0);const b=m/y.width*100;n.style.left=b+"%",setTimeout(()=>{s=!1},100)})})})}setupNavHighlighting(){if(!("IntersectionObserver"in window)||!("IntersectionObserverEntry"in window)||!("intersectionRatio"in window.IntersectionObserverEntry.prototype))return;let t=document.querySelector(".sidebar-page-nav"),n=document.querySelector(".page-content").querySelectorAll("h1, h2, h3, h4, h5, h6");n.length>0&&t!==null&&i(n);function i(c){let d={rootMargin:"0px 0px 0px 0px",threshold:1},h=new IntersectionObserver(s,d);for(let p of c)h.observe(p)}function s(c,d){for(let h of c){let p=h.intersectionRatio===1;u(h.target.id,p)}}function u(c,d){xa('a[href="#'+c+'"]',h=>{h.closest("li").classList.toggle("current-heading",d)})}}}var bv=zx;function yv(t){let n=new Date(t*1e3),i=n.getHours(),s=n.getMinutes();return`${(i>9?"":"0")+i}:${(s>9?"":"0")+s}`}class Ox{setup(){this.draftsEnabled=this.$opts.draftsEnabled==="true",this.editorType=this.$opts.editorType,this.pageId=Number(this.$opts.pageId),this.isNewDraft=this.$opts.pageNewDraft==="true",this.hasDefaultTitle=this.$opts.hasDefaultTitle||!1,this.container=this.$el,this.titleElem=this.$refs.titleContainer.querySelector("input"),this.saveDraftButton=this.$refs.saveDraft,this.discardDraftButton=this.$refs.discardDraft,this.discardDraftWrap=this.$refs.discardDraftWrap,this.draftDisplay=this.$refs.draftDisplay,this.draftDisplayIcon=this.$refs.draftDisplayIcon,this.changelogInput=this.$refs.changelogInput,this.changelogDisplay=this.$refs.changelogDisplay,this.draftText=this.$opts.draftText,this.autosaveFailText=this.$opts.autosaveFailText,this.editingPageText=this.$opts.editingPageText,this.draftDiscardedText=this.$opts.draftDiscardedText,this.setChangelogText=this.$opts.setChangelogText,this.editorHTML="",this.editorMarkdown="",this.autoSave={interval:null,frequency:3e4,last:0},this.pageId!==0&&this.draftsEnabled&&window.setTimeout(()=>{this.startAutoSave()},1e3),this.draftDisplay.innerHTML=this.draftText,this.setupListeners(),this.setInitialFocus()}setupListeners(){window.$events.listen("editor-save-draft",this.saveDraft.bind(this)),window.$events.listen("editor-save-page",this.savePage.bind(this)),window.$events.listen("editor-html-change",t=>{this.editorHTML=t}),window.$events.listen("editor-markdown-change",t=>{this.editorMarkdown=t}),this.changelogInput.addEventListener("change",this.updateChangelogDisplay.bind(this)),ot(this.saveDraftButton,this.saveDraft.bind(this)),ot(this.discardDraftButton,this.discardDraft.bind(this))}setInitialFocus(){if(console.log({HAS:this.hasDefaultTitle}),this.hasDefaultTitle)return this.titleElem.select();window.setTimeout(()=>{window.$events.emit("editor::focus","")},500)}startAutoSave(){let t=this.titleElem.value.trim()+"::"+this.editorHTML;this.autoSaveInterval=window.setInterval(()=>{let n=Date.now()-this.autoSave.last{this.draftDisplayIcon.classList.remove("visible")},2e3)}async discardDraft(){let t;try{t=await window.$http.get(`/ajax/page/${this.pageId}`)}catch(n){return console.error(n)}this.autoSave.interval&&window.clearInterval(this.autoSave.interval),this.draftDisplay.innerText=this.editingPageText,this.toggleDiscardDraftVisibility(!1),window.$events.emit("editor-html-update",t.data.html||""),window.$events.emit("editor-markdown-update",t.data.markdown||t.data.html),this.titleElem.value=t.data.name,window.setTimeout(()=>{this.startAutoSave()},1e3),window.$events.emit("success",this.draftDiscardedText)}updateChangelogDisplay(){let t=this.changelogInput.value.trim();t.length===0?t=this.setChangelogText:t.length>16&&(t=t.slice(0,16)+"..."),this.changelogDisplay.innerText=t}toggleDiscardDraftVisibility(t){this.discardDraftWrap.classList.toggle("hidden",!t)}}var wv=Ox;class Rx{constructor(t){this.elem=t,this.input=t.querySelector("input"),this.resetButton=t.querySelector("[page-picker-reset]"),this.selectButton=t.querySelector("[page-picker-select]"),this.display=t.querySelector("[page-picker-display]"),this.defaultDisplay=t.querySelector("[page-picker-default]"),this.buttonSep=t.querySelector("span.sep"),this.value=this.input.value,this.setupListeners()}setupListeners(){this.selectButton.addEventListener("click",this.showPopup.bind(this)),this.display.parentElement.addEventListener("click",this.showPopup.bind(this)),this.resetButton.addEventListener("click",t=>{this.setValue("","")})}showPopup(){window.EntitySelectorPopup.show(t=>{this.setValue(t.id,t.name)})}setValue(t,n){this.value=t,this.input.value=t,this.controlView(n)}controlView(t){let n=this.value&&this.value!==0;if(Xa(this.resetButton,n),Xa(this.buttonSep,n),Xa(this.defaultDisplay,!n),Xa(this.display,n),n){let i=this.getAssetIdFromVal();this.display.textContent=`#${i}, ${t}`,this.display.href=window.baseUrl(`/link/${i}`)}}getAssetIdFromVal(){return Number(this.value)}}function Xa(t,n){let i=t.tagName==="BUTTON"||t.tagName==="SPAN"?"inline-block":"block";t.style.display=n?i:"none"}var kv=Rx;class Px{constructor(t){this.container=t;const n=t.querySelector("[permissions-table-toggle-all]");n.addEventListener("click",this.toggleAllClick.bind(this));const i=t.querySelectorAll("[permissions-table-toggle-all-in-row]");for(let u of i)u.addEventListener("click",this.toggleRowClick.bind(this));const s=t.querySelectorAll("[permissions-table-toggle-all-in-column]");for(let u of s)u.addEventListener("click",this.toggleColumnClick.bind(this))}toggleAllClick(t){t.preventDefault(),this.toggleAllInElement(this.container)}toggleRowClick(t){t.preventDefault(),this.toggleAllInElement(t.target.closest("tr"))}toggleColumnClick(t){t.preventDefault();const n=t.target.closest("th,td"),i=Array.from(n.parentElement.children).indexOf(n),s=n.closest("table").querySelectorAll("tr"),u=[];for(let c of s){const d=c.children[i];d&&u.push(...d.querySelectorAll("input[type=checkbox]"))}this.toggleAllInputs(u)}toggleAllInElement(t){const n=t.querySelectorAll("input[type=checkbox]");this.toggleAllInputs(n)}toggleAllInputs(t){const n=t.length>0?t[0].checked:!1;for(let i of t)i.checked=!n,i.dispatchEvent(new Event("change"))}}var xv=Px;class Nx{setup(){this.container=this.$el,this.hideButtons=this.$manyRefs.hide||[],this.onkeyup=null,this.onHide=null,this.setupListeners()}setupListeners(){let t=null;this.container.addEventListener("mousedown",n=>{t=n.target}),this.container.addEventListener("click",n=>{if(n.target===this.container&&t===this.container)return this.hide()}),ot(this.hideButtons,n=>this.hide())}hide(t=null){Ka(this.container,240,t),this.onkeyup&&(window.removeEventListener("keyup",this.onkeyup),this.onkeyup=null),this.onHide&&this.onHide()}show(t=null,n=null){Og(this.container,240,t),this.onkeyup=i=>{i.key==="Escape"&&this.hide()},window.addEventListener("keyup",this.onkeyup),this.onHide=n}}var _v=Nx;class Bx{constructor(t){this.elem=t,this.colorInput=t.querySelector("input[type=color]"),this.lightColorInput=t.querySelector('input[name="setting-app-color-light"]'),this.resetButton=t.querySelector("[setting-app-color-picker-reset]"),this.defaultButton=t.querySelector("[setting-app-color-picker-default]"),this.colorInput.addEventListener("change",this.updateColor.bind(this)),this.colorInput.addEventListener("input",this.updateColor.bind(this)),this.resetButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.current,this.updateColor()}),this.defaultButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.default,this.updateColor()})}updateColor(){const t=this.colorInput.value,n=this.hexToRgb(t),i="rgba("+[n.r,n.g,n.b,"0.15"].join(",")+")";this.lightColorInput.value=i;const s=document.getElementById("custom-styles"),u=s.getAttribute("data-color"),c=s.getAttribute("data-color-light");s.innerHTML=s.innerHTML.split(u).join(t),s.innerHTML=s.innerHTML.split(c).join(i),s.setAttribute("data-color",t),s.setAttribute("data-color-light",i)}hexToRgb(t){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return{r:n?parseInt(n[1],16):0,g:n?parseInt(n[2],16):0,b:n?parseInt(n[3],16):0}}}var Cv=Bx;class jx{constructor(t){this.elem=t,this.colorInput=t.querySelector("input[type=color]"),this.resetButton=t.querySelector("[setting-color-picker-reset]"),this.defaultButton=t.querySelector("[setting-color-picker-default]"),this.resetButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.current}),this.defaultButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.default})}}var Sv=jx;class Hx{constructor(t){this.elem=t,this.input=document.getElementById("books-input"),this.shelfBooksList=t.querySelector("[shelf-sort-assigned-books]"),this.initSortable(),this.setupListeners()}initSortable(){const t=this.elem.querySelectorAll(".scroll-box");for(let n of t)new hi(n,{group:"shelf-books",ghostClass:"primary-background-light",animation:150,onSort:this.onChange.bind(this)})}setupListeners(){this.elem.addEventListener("click",t=>{const n=t.target.closest(".scroll-box-item:not(.instruction)");n&&(t.preventDefault(),this.sortItemClick(n))})}sortItemClick(t){const n=this.elem.querySelectorAll(".scroll-box"),i=Array.from(n).filter(s=>t.parentElement!==s);i.length>0&&i[0].appendChild(t),this.onChange()}onChange(){const t=Array.from(this.shelfBooksList.querySelectorAll("[data-id]"));this.input.value=t.map(n=>n.getAttribute("data-id")).join(",")}}var Ev=Hx;class Ux{constructor(t){this.elem=t,this.toggleElem=t.querySelector(".sidebar-toggle"),this.toggleElem.addEventListener("click",this.toggle.bind(this))}toggle(t=!0){this.elem.classList.toggle("open")}}var Dv=Ux;class Wx{setup(){this.container=this.$el,this.handleSelector=this.$opts.handleSelector;const t=new hi(this.container,{handle:this.handleSelector,animation:150,onSort:()=>{this.$emit("sort",{ids:t.toArray()})},setData(n,i){const s=i.getAttribute("data-drag-content");if(s){const u=JSON.parse(s);for(const[c,d]of Object.entries(u))n.setData(c,d)}},revertOnSpill:!0,dropBubble:!0,dragoverBubble:!1})}}var Av=Wx;class $x{setup(){this.$el.addEventListener("change",()=>{const t=this.$el.closest("form");t&&t.submit()})}}var Tv=$x;class Gx{setup(){this.tabContentsByName={},this.tabButtonsByName={},this.allContents=[],this.allButtons=[];for(const[t,n]of Object.entries(this.$manyRefs||{})){if(t.startsWith("toggle")){const i=t.replace("toggle","").toLowerCase();ot(n,s=>this.show(i)),this.allButtons.push(...n),this.tabButtonsByName[i]=n}if(t.startsWith("content")){const i=t.replace("content","").toLowerCase();this.tabContentsByName[i]=n,this.allContents.push(...n)}}}show(t){this.allContents.forEach(s=>{s.classList.add("hidden"),s.classList.remove("selected")}),this.allButtons.forEach(s=>s.classList.remove("selected"));const n=this.tabContentsByName[t]||[],i=this.tabButtonsByName[t]||[];n.length>0&&(n.forEach(s=>{s.classList.remove("hidden"),s.classList.add("selected")}),i.forEach(s=>s.classList.add("selected")))}}var Lv=Gx;class Kx{setup(){this.addRemoveComponentEl=this.$refs.addRemove,this.container=this.$el,this.rowSelector=this.$opts.rowSelector,this.setupListeners()}setupListeners(){this.container.addEventListener("change",t=>{const n=this.addRemoveComponentEl.components["add-remove-rows"];this.hasEmptyRows()||n.add()})}hasEmptyRows(){const t=this.container.querySelectorAll(this.rowSelector),n=[...t].find(i=>[...i.querySelectorAll("input")].filter(s=>s.value).length===0);return n!==void 0}}var Iv=Kx;class Vx{constructor(t){this.elem=t,this.list=t.querySelector("[template-manager-list]"),this.searching=!1,_t(this.elem,"[template-action]","click",this.handleTemplateActionClick.bind(this)),_t(this.elem,".pagination a","click",this.handlePaginationClick.bind(this)),_t(this.elem,".template-item-content","click",this.handleTemplateItemClick.bind(this)),_t(this.elem,".template-item","dragstart",this.handleTemplateItemDragStart.bind(this)),this.setupSearchBox()}handleTemplateItemClick(t,n){const i=n.closest("[template-id]").getAttribute("template-id");this.insertTemplate(i,"replace")}handleTemplateItemDragStart(t,n){const i=n.closest("[template-id]").getAttribute("template-id");t.dataTransfer.setData("bookstack/template",i),t.dataTransfer.setData("text/plain",i)}handleTemplateActionClick(t,n){t.stopPropagation();const i=n.getAttribute("template-action"),s=n.closest("[template-id]").getAttribute("template-id");this.insertTemplate(s,i)}async insertTemplate(t,n="replace"){const i=await window.$http.get(`/templates/${t}`),s="editor::"+n;window.$events.emit(s,i.data)}async handlePaginationClick(t,n){t.preventDefault();const i=n.getAttribute("href"),s=await window.$http.get(i);this.list.innerHTML=s.data}setupSearchBox(){const t=this.elem.querySelector(".search-box");if(!t)return;const n=t.querySelector("input"),i=t.querySelector("button"),s=t.querySelector("button.search-box-cancel");async function u(){const c=n.value,d=await window.$http.get("/templates",{search:c});s.style.display=c?"block":"none",this.list.innerHTML=d.data}u=u.bind(this),t.addEventListener("keypress",c=>{c.key==="Enter"&&(c.preventDefault(),u())}),i.addEventListener("click",c=>{u()}),s.addEventListener("click",c=>{n.value="",u()})}}var Fv=Vx;class Yx{constructor(t){this.elem=t,this.input=t.querySelector("input[type=hidden]"),this.checkbox=t.querySelector("input[type=checkbox]"),this.checkbox.addEventListener("change",this.stateChange.bind(this))}stateChange(){this.input.value=this.checkbox.checked?"true":"false";const t=new Event("change");this.input.dispatchEvent(t)}}var Mv=Yx;class Xx{constructor(t){this.elem=t,this.lastLayoutType="none",this.onDestroy=null,this.scrollCache={content:0,info:0},this.lastTabShown="content",this.mobileTabClick=this.mobileTabClick.bind(this),this.updateLayout(),window.addEventListener("resize",n=>{this.updateLayout()},{passive:!0})}updateLayout(){let t="tablet";if(window.innerWidth<=1e3&&(t="mobile"),window.innerWidth>=1400&&(t="desktop"),t===this.lastLayoutType)return;this.onDestroy&&(this.onDestroy(),this.onDestroy=null),t==="desktop"?this.setupDesktop():t==="mobile"&&this.setupMobile(),this.lastLayoutType=t}setupMobile(){const t=document.querySelectorAll("[tri-layout-mobile-tab]");for(let n of t)n.addEventListener("click",this.mobileTabClick);this.onDestroy=()=>{for(let n of t)n.removeEventListener("click",this.mobileTabClick)}}setupDesktop(){}mobileTabClick(t){const n=t.target.getAttribute("tri-layout-mobile-tab");this.showTab(n)}showContent(){this.showTab("content",!1)}showTab(t,n=!0){this.scrollCache[this.lastTabShown]=document.documentElement.scrollTop;const i=document.querySelectorAll(".tri-layout-mobile-tab");for(let u of i){const c=u.getAttribute("tri-layout-mobile-tab")===t;u.classList.toggle("active",c)}const s=t==="info";if(this.elem.classList.toggle("show-info",s),n){const u=document.querySelector("header"),c=u.getBoundingClientRect().bottom;document.documentElement.scrollTop=this.scrollCache[t]||c,setTimeout(()=>{document.documentElement.scrollTop=this.scrollCache[t]||c},50)}this.lastTabShown=t}}var qv=Xx;class Zx{setup(){this.input=this.$refs.input,this.userInfoContainer=this.$refs.userInfo,this.hide=this.$el.components.dropdown.hide,_t(this.$el,"a.dropdown-search-item","click",this.selectUser.bind(this))}selectUser(t,n){const i=n.getAttribute("data-id");this.input.value=i,this.userInfoContainer.innerHTML=n.innerHTML,this.hide()}}var zv=Zx;function Ov(t,n,i){const s=new bo(t.clipboardData||t.dataTransfer);if(!s.hasItems()||s.containsTabularData())return;const u=s.getImages();for(const c of u){const d="image-"+Math.random().toString(16).slice(2),h=window.baseUrl("/loading.gif");t.preventDefault(),setTimeout(()=>{n.insertContent(`

`),Qx(c,i).then(p=>{const g=p.name.replace(/"/g,""),y=`${g}`,m=n.dom.create("a",{target:"_blank",href:p.url},y);n.dom.replace(m,d)}).catch(p=>{n.dom.remove(d),window.$events.emit("error",i.imageUploadErrorText),console.log(p)})},10)}}async function Qx(t,n){if(t===null||t.type.indexOf("image")!==0)throw new Error("Not an image file");let i="png";if(t.name){let d=t.name.match(/\.(.+)$/);d.length>1&&(i=d[1])}const s="image-"+Date.now()+"."+i,u=new FormData;u.append("file",t,s),u.append("uploaded_to",n.pageId);const c=await window.$http.post(window.baseUrl("/images/gallery"),u);return c.data}function Jx(t){for(let n=1;n<5;n++)t.shortcuts.add("meta+"+n,"",["FormatBlock",!1,"h"+(n+1)]);t.shortcuts.add("meta+5","",["FormatBlock",!1,"p"]),t.shortcuts.add("meta+d","",["FormatBlock",!1,"p"]),t.shortcuts.add("meta+6","",["FormatBlock",!1,"blockquote"]),t.shortcuts.add("meta+q","",["FormatBlock",!1,"blockquote"]),t.shortcuts.add("meta+7","",["codeeditor",!1,"pre"]),t.shortcuts.add("meta+e","",["codeeditor",!1,"pre"]),t.shortcuts.add("meta+8","",["FormatBlock",!1,"code"]),t.shortcuts.add("meta+shift+E","",["FormatBlock",!1,"code"]),t.shortcuts.add("meta+S","",()=>{window.$events.emit("editor-save-draft")}),t.shortcuts.add("meta+13","",()=>{window.$events.emit("editor-save-page")}),t.shortcuts.add("meta+9","",function(){const n=t.selection.getNode(),i=n?n.closest(".callout"):null,s=["info","success","warning","danger"],u=s.findIndex(h=>i&&i.classList.contains(h)),c=(u+1)%s.length,d=s[c];t.formatter.apply("callout"+d)})}function e_(t){window.$http.get(window.baseUrl("/custom-head-content")).then(n=>{if(!n.data)return;let i=t.getDoc().querySelector("head");i.innerHTML+=n.data})}function t_(){function t(s){return s.className==="CodeMirrorContainer"}function n(s){const u=s.selection.getNode();if(!t(u)){const h=s.selection.getNode().textContent;window.components.first("code-editor").open(h,"",(p,g)=>{const y=document.createElement("div");y.innerHTML=`
`,y.querySelector("code").innerText=p,s.formatter.toggle("pre");const m=s.selection.getNode();s.dom.setHTML(m,y.querySelector("pre").innerHTML),s.fire("SetContent"),s.focus()});return}let c=u.hasAttribute("data-lang")?u.getAttribute("data-lang"):"",d=u.querySelector("textarea").textContent;window.components.first("code-editor").open(d,c,(h,p)=>{const g=u.querySelector(".CodeMirror"),y=g.CodeMirror;y&&(Nt.setContent(y,h),Nt.setMode(y,p,h));const m=u.querySelector("textarea");m&&(m.textContent=h),u.setAttribute("data-lang",p),s.focus()})}function i(s){const u=s.querySelector("textarea"),c=u.textContent,d=s.getAttribute("data-lang");s.removeAttribute("contentEditable");const h=document.createElement("pre"),p=document.createElement("code");p.classList.add(`language-${d}`),p.textContent=c,h.appendChild(p),s.parentElement.replaceChild(h,s)}window.tinymce.PluginManager.add("codeeditor",function(s,u){const c=s.$;s.addButton("codeeditor",{text:"Code block",icon:!1,cmd:"codeeditor"}),s.addCommand("codeeditor",()=>{n(s)}),s.on("PreProcess",function(d){c("div.CodeMirrorContainer",d.node).each((h,p)=>{i(p)})}),s.on("dblclick",d=>{let h=s.selection.getNode();if(!t(h))return;n(s)}),s.on("SetContent",function(){c(".CodeMirrorContainer").filter((h,p)=>typeof p.querySelector(".CodeMirror").CodeMirror=="undefined").each((h,p)=>{i(p)});const d=c("body > pre").filter((h,p)=>p.contentEditable!=="false");if(!d.length)return;s.undoManager.transact(function(){d.each((h,p)=>{Nt.wysiwygView(p)})})})})}function n_(t,n,i,s){let u=null,c=null;function d(m){return m.hasAttribute("drawio-diagram")}function h(m,b=null){u=m,c=b,window.ImageManager.show(function(w){if(b){let D=b.querySelector("img");u.dom.setAttrib(D,"src",w.url),u.dom.setAttrib(b,"drawio-diagram",w.id)}else{let D=`
`;u.insertContent(D)}},"drawio")}function p(m,b=null){u=m,c=b,dn.show(t,y,g)}async function g(m){const b="image-"+Math.random().toString(16).slice(2),w=window.baseUrl("/loading.gif");if(c){dn.close();let D=c.querySelector("img");try{const E=await dn.upload(m,i);u.dom.setAttrib(D,"src",E.url),u.dom.setAttrib(c,"drawio-diagram",E.id)}catch(E){window.$events.emit("error",s.imageUploadErrorText),console.log(E)}return}setTimeout(async()=>{u.insertContent(`
`),dn.close();try{const D=await dn.upload(m,i);u.dom.setAttrib(b,"src",D.url),u.dom.get(b).parentNode.setAttribute("drawio-diagram",D.id)}catch(D){u.dom.remove(b),window.$events.emit("error",s.imageUploadErrorText),console.log(D)}},5)}function y(){if(!c)return Promise.resolve("");let m=c.getAttribute("drawio-diagram");return dn.load(m)}window.tinymce.PluginManager.add("drawio",function(m,b){m.addCommand("drawio",()=>{const w=m.selection.getNode();p(m,d(w)?w:null)}),m.addButton("drawio",{type:"splitbutton",tooltip:"Drawing",image:`data:image/svg+xml;base64,${btoa(` +`).length;n.style.height=i*20+40+"px",this.editingComment=t}updateComment(t){let n=t.target;t.preventDefault();let i=n.querySelector("textarea").value,s={text:i,parent_id:this.parentId||null};this.showLoading(n);let u=this.editingComment.getAttribute("comment");window.$http.put(`/comment/${u}`,s).then(c=>{let d=document.createElement("div");d.innerHTML=c.data,this.editingComment.innerHTML=d.children[0].innerHTML,window.$events.success(this.updatedText),window.components.init(this.editingComment),this.closeUpdateForm(),this.editingComment=null}).catch(window.$events.showValidationErrors).then(()=>{this.hideLoading(n)})}deleteComment(t){let n=t.getAttribute("comment");this.showLoading(t.querySelector("[comment-content]")),window.$http.delete(`/comment/${n}`).then(i=>{t.parentNode.removeChild(t),window.$events.success(this.deletedText),this.updateCount(),this.hideForm()})}saveComment(t){t.preventDefault(),t.stopPropagation();let n=this.formInput.value,i={text:n,parent_id:this.parentId||null};this.showLoading(this.form),window.$http.post(`/comment/${this.pageId}`,i).then(s=>{let u=document.createElement("div");u.innerHTML=s.data;let c=u.children[0];this.container.appendChild(c),window.components.init(c),window.$events.success(this.createdText),this.resetForm(),this.updateCount()}).catch(s=>{window.$events.showValidationErrors(s),this.hideLoading(this.form)})}updateCount(){let t=this.container.children.length;this.elem.querySelector("[comments-title]").textContent=window.trans_plural(this.countText,t,{count:t})}resetForm(){this.formInput.value="",this.formContainer.appendChild(this.form),this.hideForm(),this.removeReplyTo(),this.hideLoading(this.form)}showForm(){this.formContainer.style.display="block",this.formContainer.parentNode.style.display="block",this.addButtonContainer.style.display="none",this.formInput.focus(),this.formInput.scrollIntoView({behavior:"smooth"})}hideForm(){this.formContainer.style.display="none",this.formContainer.parentNode.style.display="none",this.getCommentCount()>0?this.elem.appendChild(this.addButtonContainer):this.commentCountBar.appendChild(this.addButtonContainer),this.addButtonContainer.style.display="block"}getCommentCount(){return this.elem.querySelectorAll(".comment-box[comment]").length}setReply(t){this.showForm(),this.parentId=Number(t.getAttribute("local-id")),this.replyToRow.style.display="block";const n=this.replyToRow.querySelector("a");n.textContent=`#${this.parentId}`,n.href=`#comment${this.parentId}`}removeReplyTo(){this.parentId=null,this.replyToRow.style.display="none"}showLoading(t){const n=t.querySelectorAll(".form-group");for(let i of n)i.style.display="none";t.querySelector(".form-group.loading").style.display="block"}hideLoading(t){const n=t.querySelectorAll(".form-group");for(let i of n)i.style.display="block";t.querySelector(".form-group.loading").style.display="none"}}var gv=qx;const vv=Ke(Vs());class zx{constructor(t){if(this.elem=t,this.pageId=t.getAttribute("page-display"),Nt.highlight(),this.setupPointer(),this.setupNavHighlighting(),window.location.hash){let i=window.location.hash.replace(/\%20/g," ").substr(1);this.goToText(i)}const n=document.querySelector(".sidebar-page-nav");n&&_t(n,"a","click",(i,s)=>{i.preventDefault(),window.components["tri-layout"][0].showContent();const u=s.getAttribute("href").substr(1);this.goToText(u),window.history.pushState(null,null,"#"+u)})}goToText(t){const n=document.getElementById(t);if(xa(".page-content [data-highlighted]",i=>{i.removeAttribute("data-highlighted"),i.style.backgroundColor=null}),n!==null)ro(n);else{const i=rg(".page-content > div > *",t);i&&ro(i)}}setupPointer(){let t=document.getElementById("pointer");if(!t)return;t=t.parentNode.removeChild(t);const n=t.querySelector("div.pointer");let i=!1,s=!1,u=!0,c="";_t(t,"input","click",(h,p)=>{p.select(),h.stopPropagation()}),_a(t,["click","focus"],h=>{h.stopPropagation()}),_t(t,"span.icon","click",(h,p)=>{h.stopPropagation(),u=!u,p.querySelector('[data-icon="include"]').style.display=u?"none":"inline",p.querySelector('[data-icon="link"]').style.display=u?"inline":"none",d()}),new vv.default(t.querySelector("button")),_a(document.body,["click","focus"],h=>{if(!i||s)return;t=t.parentElement.removeChild(t),i=!1});let d=h=>{let p=u?window.baseUrl(`/link/${this.pageId}#${c}`):`{{@${this.pageId}#${c}}}`;u&&!p.startsWith("http")&&(p=window.location.protocol+"//"+window.location.host+p),t.querySelector("input").value=p;const g=t.querySelector("#pointer-edit");if(g&&h){const y=g.dataset.editHref,m=h.id,b=h.textContent&&h.textContent.substring(0,50);g.href=`${y}?content-id=${m}&content-text=${encodeURIComponent(b)}`}};xa('.page-content [id^="bkmrk"]',h=>{_a(h,["mouseup","keyup"],p=>{p.stopPropagation();let g=window.getSelection();if(g.toString().length===0)return;c=h.id,d(h),h.parentNode.insertBefore(t,h),t.style.display="block",i=!0,s=!0,requestAnimationFrame(()=>{const y=h.getBoundingClientRect();let m=p.pageX-y.left-164;m<0&&(m=0);const b=m/y.width*100;n.style.left=b+"%",setTimeout(()=>{s=!1},100)})})})}setupNavHighlighting(){if(!("IntersectionObserver"in window)||!("IntersectionObserverEntry"in window)||!("intersectionRatio"in window.IntersectionObserverEntry.prototype))return;let t=document.querySelector(".sidebar-page-nav"),n=document.querySelector(".page-content").querySelectorAll("h1, h2, h3, h4, h5, h6");n.length>0&&t!==null&&i(n);function i(c){let d={rootMargin:"0px 0px 0px 0px",threshold:1},h=new IntersectionObserver(s,d);for(let p of c)h.observe(p)}function s(c,d){for(let h of c){let p=h.intersectionRatio===1;u(h.target.id,p)}}function u(c,d){xa('a[href="#'+c+'"]',h=>{h.closest("li").classList.toggle("current-heading",d)})}}}var bv=zx;function yv(t){let n=new Date(t*1e3),i=n.getHours(),s=n.getMinutes();return`${(i>9?"":"0")+i}:${(s>9?"":"0")+s}`}class Ox{setup(){this.draftsEnabled=this.$opts.draftsEnabled==="true",this.editorType=this.$opts.editorType,this.pageId=Number(this.$opts.pageId),this.isNewDraft=this.$opts.pageNewDraft==="true",this.hasDefaultTitle=this.$opts.hasDefaultTitle||!1,this.container=this.$el,this.titleElem=this.$refs.titleContainer.querySelector("input"),this.saveDraftButton=this.$refs.saveDraft,this.discardDraftButton=this.$refs.discardDraft,this.discardDraftWrap=this.$refs.discardDraftWrap,this.draftDisplay=this.$refs.draftDisplay,this.draftDisplayIcon=this.$refs.draftDisplayIcon,this.changelogInput=this.$refs.changelogInput,this.changelogDisplay=this.$refs.changelogDisplay,this.draftText=this.$opts.draftText,this.autosaveFailText=this.$opts.autosaveFailText,this.editingPageText=this.$opts.editingPageText,this.draftDiscardedText=this.$opts.draftDiscardedText,this.setChangelogText=this.$opts.setChangelogText,this.editorHTML="",this.editorMarkdown="",this.autoSave={interval:null,frequency:3e4,last:0},this.pageId!==0&&this.draftsEnabled&&window.setTimeout(()=>{this.startAutoSave()},1e3),this.draftDisplay.innerHTML=this.draftText,this.setupListeners(),this.setInitialFocus()}setupListeners(){window.$events.listen("editor-save-draft",this.saveDraft.bind(this)),window.$events.listen("editor-save-page",this.savePage.bind(this)),window.$events.listen("editor-html-change",t=>{this.editorHTML=t}),window.$events.listen("editor-markdown-change",t=>{this.editorMarkdown=t}),this.changelogInput.addEventListener("change",this.updateChangelogDisplay.bind(this)),ot(this.saveDraftButton,this.saveDraft.bind(this)),ot(this.discardDraftButton,this.discardDraft.bind(this))}setInitialFocus(){if(this.hasDefaultTitle)return this.titleElem.select();window.setTimeout(()=>{window.$events.emit("editor::focus","")},500)}startAutoSave(){let t=this.titleElem.value.trim()+"::"+this.editorHTML;this.autoSaveInterval=window.setInterval(()=>{let n=Date.now()-this.autoSave.last{this.draftDisplayIcon.classList.remove("visible")},2e3)}async discardDraft(){let t;try{t=await window.$http.get(`/ajax/page/${this.pageId}`)}catch(n){return console.error(n)}this.autoSave.interval&&window.clearInterval(this.autoSave.interval),this.draftDisplay.innerText=this.editingPageText,this.toggleDiscardDraftVisibility(!1),window.$events.emit("editor-html-update",t.data.html||""),window.$events.emit("editor-markdown-update",t.data.markdown||t.data.html),this.titleElem.value=t.data.name,window.setTimeout(()=>{this.startAutoSave()},1e3),window.$events.emit("success",this.draftDiscardedText)}updateChangelogDisplay(){let t=this.changelogInput.value.trim();t.length===0?t=this.setChangelogText:t.length>16&&(t=t.slice(0,16)+"..."),this.changelogDisplay.innerText=t}toggleDiscardDraftVisibility(t){this.discardDraftWrap.classList.toggle("hidden",!t)}}var wv=Ox;class Rx{constructor(t){this.elem=t,this.input=t.querySelector("input"),this.resetButton=t.querySelector("[page-picker-reset]"),this.selectButton=t.querySelector("[page-picker-select]"),this.display=t.querySelector("[page-picker-display]"),this.defaultDisplay=t.querySelector("[page-picker-default]"),this.buttonSep=t.querySelector("span.sep"),this.value=this.input.value,this.setupListeners()}setupListeners(){this.selectButton.addEventListener("click",this.showPopup.bind(this)),this.display.parentElement.addEventListener("click",this.showPopup.bind(this)),this.resetButton.addEventListener("click",t=>{this.setValue("","")})}showPopup(){window.EntitySelectorPopup.show(t=>{this.setValue(t.id,t.name)})}setValue(t,n){this.value=t,this.input.value=t,this.controlView(n)}controlView(t){let n=this.value&&this.value!==0;if(Xa(this.resetButton,n),Xa(this.buttonSep,n),Xa(this.defaultDisplay,!n),Xa(this.display,n),n){let i=this.getAssetIdFromVal();this.display.textContent=`#${i}, ${t}`,this.display.href=window.baseUrl(`/link/${i}`)}}getAssetIdFromVal(){return Number(this.value)}}function Xa(t,n){let i=t.tagName==="BUTTON"||t.tagName==="SPAN"?"inline-block":"block";t.style.display=n?i:"none"}var kv=Rx;class Px{constructor(t){this.container=t;const n=t.querySelector("[permissions-table-toggle-all]");n.addEventListener("click",this.toggleAllClick.bind(this));const i=t.querySelectorAll("[permissions-table-toggle-all-in-row]");for(let u of i)u.addEventListener("click",this.toggleRowClick.bind(this));const s=t.querySelectorAll("[permissions-table-toggle-all-in-column]");for(let u of s)u.addEventListener("click",this.toggleColumnClick.bind(this))}toggleAllClick(t){t.preventDefault(),this.toggleAllInElement(this.container)}toggleRowClick(t){t.preventDefault(),this.toggleAllInElement(t.target.closest("tr"))}toggleColumnClick(t){t.preventDefault();const n=t.target.closest("th,td"),i=Array.from(n.parentElement.children).indexOf(n),s=n.closest("table").querySelectorAll("tr"),u=[];for(let c of s){const d=c.children[i];d&&u.push(...d.querySelectorAll("input[type=checkbox]"))}this.toggleAllInputs(u)}toggleAllInElement(t){const n=t.querySelectorAll("input[type=checkbox]");this.toggleAllInputs(n)}toggleAllInputs(t){const n=t.length>0?t[0].checked:!1;for(let i of t)i.checked=!n,i.dispatchEvent(new Event("change"))}}var xv=Px;class Nx{setup(){this.container=this.$el,this.hideButtons=this.$manyRefs.hide||[],this.onkeyup=null,this.onHide=null,this.setupListeners()}setupListeners(){let t=null;this.container.addEventListener("mousedown",n=>{t=n.target}),this.container.addEventListener("click",n=>{if(n.target===this.container&&t===this.container)return this.hide()}),ot(this.hideButtons,n=>this.hide())}hide(t=null){Ka(this.container,240,t),this.onkeyup&&(window.removeEventListener("keyup",this.onkeyup),this.onkeyup=null),this.onHide&&this.onHide()}show(t=null,n=null){Og(this.container,240,t),this.onkeyup=i=>{i.key==="Escape"&&this.hide()},window.addEventListener("keyup",this.onkeyup),this.onHide=n}}var _v=Nx;class Bx{constructor(t){this.elem=t,this.colorInput=t.querySelector("input[type=color]"),this.lightColorInput=t.querySelector('input[name="setting-app-color-light"]'),this.resetButton=t.querySelector("[setting-app-color-picker-reset]"),this.defaultButton=t.querySelector("[setting-app-color-picker-default]"),this.colorInput.addEventListener("change",this.updateColor.bind(this)),this.colorInput.addEventListener("input",this.updateColor.bind(this)),this.resetButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.current,this.updateColor()}),this.defaultButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.default,this.updateColor()})}updateColor(){const t=this.colorInput.value,n=this.hexToRgb(t),i="rgba("+[n.r,n.g,n.b,"0.15"].join(",")+")";this.lightColorInput.value=i;const s=document.getElementById("custom-styles"),u=s.getAttribute("data-color"),c=s.getAttribute("data-color-light");s.innerHTML=s.innerHTML.split(u).join(t),s.innerHTML=s.innerHTML.split(c).join(i),s.setAttribute("data-color",t),s.setAttribute("data-color-light",i)}hexToRgb(t){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return{r:n?parseInt(n[1],16):0,g:n?parseInt(n[2],16):0,b:n?parseInt(n[3],16):0}}}var Cv=Bx;class jx{constructor(t){this.elem=t,this.colorInput=t.querySelector("input[type=color]"),this.resetButton=t.querySelector("[setting-color-picker-reset]"),this.defaultButton=t.querySelector("[setting-color-picker-default]"),this.resetButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.current}),this.defaultButton.addEventListener("click",n=>{this.colorInput.value=this.colorInput.dataset.default})}}var Sv=jx;class Hx{constructor(t){this.elem=t,this.input=document.getElementById("books-input"),this.shelfBooksList=t.querySelector("[shelf-sort-assigned-books]"),this.initSortable(),this.setupListeners()}initSortable(){const t=this.elem.querySelectorAll(".scroll-box");for(let n of t)new hi(n,{group:"shelf-books",ghostClass:"primary-background-light",animation:150,onSort:this.onChange.bind(this)})}setupListeners(){this.elem.addEventListener("click",t=>{const n=t.target.closest(".scroll-box-item:not(.instruction)");n&&(t.preventDefault(),this.sortItemClick(n))})}sortItemClick(t){const n=this.elem.querySelectorAll(".scroll-box"),i=Array.from(n).filter(s=>t.parentElement!==s);i.length>0&&i[0].appendChild(t),this.onChange()}onChange(){const t=Array.from(this.shelfBooksList.querySelectorAll("[data-id]"));this.input.value=t.map(n=>n.getAttribute("data-id")).join(",")}}var Ev=Hx;class Ux{constructor(t){this.elem=t,this.toggleElem=t.querySelector(".sidebar-toggle"),this.toggleElem.addEventListener("click",this.toggle.bind(this))}toggle(t=!0){this.elem.classList.toggle("open")}}var Dv=Ux;class Wx{setup(){this.container=this.$el,this.handleSelector=this.$opts.handleSelector;const t=new hi(this.container,{handle:this.handleSelector,animation:150,onSort:()=>{this.$emit("sort",{ids:t.toArray()})},setData(n,i){const s=i.getAttribute("data-drag-content");if(s){const u=JSON.parse(s);for(const[c,d]of Object.entries(u))n.setData(c,d)}},revertOnSpill:!0,dropBubble:!0,dragoverBubble:!1})}}var Av=Wx;class $x{setup(){this.$el.addEventListener("change",()=>{const t=this.$el.closest("form");t&&t.submit()})}}var Tv=$x;class Gx{setup(){this.tabContentsByName={},this.tabButtonsByName={},this.allContents=[],this.allButtons=[];for(const[t,n]of Object.entries(this.$manyRefs||{})){if(t.startsWith("toggle")){const i=t.replace("toggle","").toLowerCase();ot(n,s=>this.show(i)),this.allButtons.push(...n),this.tabButtonsByName[i]=n}if(t.startsWith("content")){const i=t.replace("content","").toLowerCase();this.tabContentsByName[i]=n,this.allContents.push(...n)}}}show(t){this.allContents.forEach(s=>{s.classList.add("hidden"),s.classList.remove("selected")}),this.allButtons.forEach(s=>s.classList.remove("selected"));const n=this.tabContentsByName[t]||[],i=this.tabButtonsByName[t]||[];n.length>0&&(n.forEach(s=>{s.classList.remove("hidden"),s.classList.add("selected")}),i.forEach(s=>s.classList.add("selected")))}}var Lv=Gx;class Kx{setup(){this.addRemoveComponentEl=this.$refs.addRemove,this.container=this.$el,this.rowSelector=this.$opts.rowSelector,this.setupListeners()}setupListeners(){this.container.addEventListener("change",t=>{const n=this.addRemoveComponentEl.components["add-remove-rows"];this.hasEmptyRows()||n.add()})}hasEmptyRows(){const t=this.container.querySelectorAll(this.rowSelector),n=[...t].find(i=>[...i.querySelectorAll("input")].filter(s=>s.value).length===0);return n!==void 0}}var Iv=Kx;class Vx{constructor(t){this.elem=t,this.list=t.querySelector("[template-manager-list]"),this.searching=!1,_t(this.elem,"[template-action]","click",this.handleTemplateActionClick.bind(this)),_t(this.elem,".pagination a","click",this.handlePaginationClick.bind(this)),_t(this.elem,".template-item-content","click",this.handleTemplateItemClick.bind(this)),_t(this.elem,".template-item","dragstart",this.handleTemplateItemDragStart.bind(this)),this.setupSearchBox()}handleTemplateItemClick(t,n){const i=n.closest("[template-id]").getAttribute("template-id");this.insertTemplate(i,"replace")}handleTemplateItemDragStart(t,n){const i=n.closest("[template-id]").getAttribute("template-id");t.dataTransfer.setData("bookstack/template",i),t.dataTransfer.setData("text/plain",i)}handleTemplateActionClick(t,n){t.stopPropagation();const i=n.getAttribute("template-action"),s=n.closest("[template-id]").getAttribute("template-id");this.insertTemplate(s,i)}async insertTemplate(t,n="replace"){const i=await window.$http.get(`/templates/${t}`),s="editor::"+n;window.$events.emit(s,i.data)}async handlePaginationClick(t,n){t.preventDefault();const i=n.getAttribute("href"),s=await window.$http.get(i);this.list.innerHTML=s.data}setupSearchBox(){const t=this.elem.querySelector(".search-box");if(!t)return;const n=t.querySelector("input"),i=t.querySelector("button"),s=t.querySelector("button.search-box-cancel");async function u(){const c=n.value,d=await window.$http.get("/templates",{search:c});s.style.display=c?"block":"none",this.list.innerHTML=d.data}u=u.bind(this),t.addEventListener("keypress",c=>{c.key==="Enter"&&(c.preventDefault(),u())}),i.addEventListener("click",c=>{u()}),s.addEventListener("click",c=>{n.value="",u()})}}var Fv=Vx;class Yx{constructor(t){this.elem=t,this.input=t.querySelector("input[type=hidden]"),this.checkbox=t.querySelector("input[type=checkbox]"),this.checkbox.addEventListener("change",this.stateChange.bind(this))}stateChange(){this.input.value=this.checkbox.checked?"true":"false";const t=new Event("change");this.input.dispatchEvent(t)}}var Mv=Yx;class Xx{constructor(t){this.elem=t,this.lastLayoutType="none",this.onDestroy=null,this.scrollCache={content:0,info:0},this.lastTabShown="content",this.mobileTabClick=this.mobileTabClick.bind(this),this.updateLayout(),window.addEventListener("resize",n=>{this.updateLayout()},{passive:!0})}updateLayout(){let t="tablet";if(window.innerWidth<=1e3&&(t="mobile"),window.innerWidth>=1400&&(t="desktop"),t===this.lastLayoutType)return;this.onDestroy&&(this.onDestroy(),this.onDestroy=null),t==="desktop"?this.setupDesktop():t==="mobile"&&this.setupMobile(),this.lastLayoutType=t}setupMobile(){const t=document.querySelectorAll("[tri-layout-mobile-tab]");for(let n of t)n.addEventListener("click",this.mobileTabClick);this.onDestroy=()=>{for(let n of t)n.removeEventListener("click",this.mobileTabClick)}}setupDesktop(){}mobileTabClick(t){const n=t.target.getAttribute("tri-layout-mobile-tab");this.showTab(n)}showContent(){this.showTab("content",!1)}showTab(t,n=!0){this.scrollCache[this.lastTabShown]=document.documentElement.scrollTop;const i=document.querySelectorAll(".tri-layout-mobile-tab");for(let u of i){const c=u.getAttribute("tri-layout-mobile-tab")===t;u.classList.toggle("active",c)}const s=t==="info";if(this.elem.classList.toggle("show-info",s),n){const u=document.querySelector("header"),c=u.getBoundingClientRect().bottom;document.documentElement.scrollTop=this.scrollCache[t]||c,setTimeout(()=>{document.documentElement.scrollTop=this.scrollCache[t]||c},50)}this.lastTabShown=t}}var qv=Xx;class Zx{setup(){this.input=this.$refs.input,this.userInfoContainer=this.$refs.userInfo,this.hide=this.$el.components.dropdown.hide,_t(this.$el,"a.dropdown-search-item","click",this.selectUser.bind(this))}selectUser(t,n){const i=n.getAttribute("data-id");this.input.value=i,this.userInfoContainer.innerHTML=n.innerHTML,this.hide()}}var zv=Zx;function Ov(t,n,i){const s=new bo(t.clipboardData||t.dataTransfer);if(!s.hasItems()||s.containsTabularData())return;const u=s.getImages();for(const c of u){const d="image-"+Math.random().toString(16).slice(2),h=window.baseUrl("/loading.gif");t.preventDefault(),setTimeout(()=>{n.insertContent(`

`),Qx(c,i).then(p=>{const g=p.name.replace(/"/g,""),y=`${g}`,m=n.dom.create("a",{target:"_blank",href:p.url},y);n.dom.replace(m,d)}).catch(p=>{n.dom.remove(d),window.$events.emit("error",i.imageUploadErrorText),console.log(p)})},10)}}async function Qx(t,n){if(t===null||t.type.indexOf("image")!==0)throw new Error("Not an image file");let i="png";if(t.name){let d=t.name.match(/\.(.+)$/);d.length>1&&(i=d[1])}const s="image-"+Date.now()+"."+i,u=new FormData;u.append("file",t,s),u.append("uploaded_to",n.pageId);const c=await window.$http.post(window.baseUrl("/images/gallery"),u);return c.data}function Jx(t){for(let n=1;n<5;n++)t.shortcuts.add("meta+"+n,"",["FormatBlock",!1,"h"+(n+1)]);t.shortcuts.add("meta+5","",["FormatBlock",!1,"p"]),t.shortcuts.add("meta+d","",["FormatBlock",!1,"p"]),t.shortcuts.add("meta+6","",["FormatBlock",!1,"blockquote"]),t.shortcuts.add("meta+q","",["FormatBlock",!1,"blockquote"]),t.shortcuts.add("meta+7","",["codeeditor",!1,"pre"]),t.shortcuts.add("meta+e","",["codeeditor",!1,"pre"]),t.shortcuts.add("meta+8","",["FormatBlock",!1,"code"]),t.shortcuts.add("meta+shift+E","",["FormatBlock",!1,"code"]),t.shortcuts.add("meta+S","",()=>{window.$events.emit("editor-save-draft")}),t.shortcuts.add("meta+13","",()=>{window.$events.emit("editor-save-page")}),t.shortcuts.add("meta+9","",function(){const n=t.selection.getNode(),i=n?n.closest(".callout"):null,s=["info","success","warning","danger"],u=s.findIndex(h=>i&&i.classList.contains(h)),c=(u+1)%s.length,d=s[c];t.formatter.apply("callout"+d)})}function e_(t){window.$http.get(window.baseUrl("/custom-head-content")).then(n=>{if(!n.data)return;let i=t.getDoc().querySelector("head");i.innerHTML+=n.data})}function t_(){function t(s){return s.className==="CodeMirrorContainer"}function n(s){const u=s.selection.getNode();if(!t(u)){const h=s.selection.getNode().textContent;window.components.first("code-editor").open(h,"",(p,g)=>{const y=document.createElement("div");y.innerHTML=`
`,y.querySelector("code").innerText=p,s.formatter.toggle("pre");const m=s.selection.getNode();s.dom.setHTML(m,y.querySelector("pre").innerHTML),s.fire("SetContent"),s.focus()});return}let c=u.hasAttribute("data-lang")?u.getAttribute("data-lang"):"",d=u.querySelector("textarea").textContent;window.components.first("code-editor").open(d,c,(h,p)=>{const g=u.querySelector(".CodeMirror"),y=g.CodeMirror;y&&(Nt.setContent(y,h),Nt.setMode(y,p,h));const m=u.querySelector("textarea");m&&(m.textContent=h),u.setAttribute("data-lang",p),s.focus()})}function i(s){const u=s.querySelector("textarea"),c=u.textContent,d=s.getAttribute("data-lang");s.removeAttribute("contentEditable");const h=document.createElement("pre"),p=document.createElement("code");p.classList.add(`language-${d}`),p.textContent=c,h.appendChild(p),s.parentElement.replaceChild(h,s)}window.tinymce.PluginManager.add("codeeditor",function(s,u){const c=s.$;s.addButton("codeeditor",{text:"Code block",icon:!1,cmd:"codeeditor"}),s.addCommand("codeeditor",()=>{n(s)}),s.on("PreProcess",function(d){c("div.CodeMirrorContainer",d.node).each((h,p)=>{i(p)})}),s.on("dblclick",d=>{let h=s.selection.getNode();if(!t(h))return;n(s)}),s.on("SetContent",function(){c(".CodeMirrorContainer").filter((h,p)=>typeof p.querySelector(".CodeMirror").CodeMirror=="undefined").each((h,p)=>{i(p)});const d=c("body > pre").filter((h,p)=>p.contentEditable!=="false");if(!d.length)return;s.undoManager.transact(function(){d.each((h,p)=>{Nt.wysiwygView(p)})})})})}function n_(t,n,i,s){let u=null,c=null;function d(m){return m.hasAttribute("drawio-diagram")}function h(m,b=null){u=m,c=b,window.ImageManager.show(function(w){if(b){let D=b.querySelector("img");u.dom.setAttrib(D,"src",w.url),u.dom.setAttrib(b,"drawio-diagram",w.id)}else{let D=`
`;u.insertContent(D)}},"drawio")}function p(m,b=null){u=m,c=b,dn.show(t,y,g)}async function g(m){const b="image-"+Math.random().toString(16).slice(2),w=window.baseUrl("/loading.gif");if(c){dn.close();let D=c.querySelector("img");try{const E=await dn.upload(m,i);u.dom.setAttrib(D,"src",E.url),u.dom.setAttrib(c,"drawio-diagram",E.id)}catch(E){window.$events.emit("error",s.imageUploadErrorText),console.log(E)}return}setTimeout(async()=>{u.insertContent(`
`),dn.close();try{const D=await dn.upload(m,i);u.dom.setAttrib(b,"src",D.url),u.dom.get(b).parentNode.setAttribute("drawio-diagram",D.id)}catch(D){u.dom.remove(b),window.$events.emit("error",s.imageUploadErrorText),console.log(D)}},5)}function y(){if(!c)return Promise.resolve("");let m=c.getAttribute("drawio-diagram");return dn.load(m)}window.tinymce.PluginManager.add("drawio",function(m,b){m.addCommand("drawio",()=>{const w=m.selection.getNode();p(m,d(w)?w:null)}),m.addButton("drawio",{type:"splitbutton",tooltip:"Drawing",image:`data:image/svg+xml;base64,${btoa(` `)}`,cmd:"drawio",menu:[{text:"Drawing Manager",onclick(){let w=m.selection.getNode();h(m,d(w)?w:null)}}]}),m.on("dblclick",w=>{let D=m.selection.getNode();if(!d(D))return;p(m,D)}),m.on("SetContent",function(){const w=m.$("body > div[drawio-diagram]");if(!w.length)return;m.undoManager.transact(function(){w.each((D,E)=>{E.setAttribute("contenteditable","false")})})})})}function r_(){window.tinymce.PluginManager.add("customhr",function(t){t.addCommand("InsertHorizontalRule",function(){let n=document.createElement("hr"),i=t.selection.getNode(),s=i.parentNode;s.insertBefore(n,i)}),t.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),t.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})})}function i_(t){window.$events.listen("editor::replace",({html:n})=>{t.setContent(n)}),window.$events.listen("editor::append",({html:n})=>{const i=t.getContent()+n;t.setContent(i)}),window.$events.listen("editor::prepend",({html:n})=>{const i=n+t.getContent();t.setContent(i)}),window.$events.listen("editor::insert",({html:n})=>{t.insertContent(n)}),window.$events.listen("editor::focus",()=>{t.focus()})}class o_{setup(){this.elem=this.$el,this.pageId=this.$opts.pageId,this.textDirection=this.$opts.textDirection,this.imageUploadErrorText=this.$opts.imageUploadErrorText,this.isDarkMode=document.documentElement.classList.contains("dark-mode"),this.plugins="image table textcolor paste link autolink fullscreen code customhr autosave lists codeeditor media",this.loadPlugins(),this.tinyMceConfig=this.getTinyMceConfig(),window.$events.emitPublic(this.elem,"editor-tinymce::pre-init",{config:this.tinyMceConfig}),window.tinymce.init(this.tinyMceConfig)}loadPlugins(){t_(),r_();const t=document.querySelector("[drawio-url]");if(t){const n=t.getAttribute("drawio-url");n_(n,this.isDarkMode,this.pageId,this),this.plugins+=" drawio"}this.textDirection==="rtl"&&(this.plugins+=" directionality")}getToolBar(){const t=this.textDirection==="rtl"?"ltr rtl":"";return`undo redo | styleselect | bold italic underline strikethrough superscript subscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image-insert link hr drawio media | removeformat code ${t} fullscreen`}getTinyMceConfig(){const t=this;return{selector:"#html-editor",content_css:[window.baseUrl("/dist/styles.css")],branding:!1,skin:this.isDarkMode?"dark":"lightgray",body_class:"page-content",browser_spellcheck:!0,relative_urls:!1,directionality:this.textDirection,remove_script_host:!1,document_base_url:window.baseUrl("/"),end_container_on_empty_block:!0,statusbar:!1,menubar:!1,paste_data_images:!1,extended_valid_elements:"pre[*],svg[*],div[drawio-diagram]",automatic_uploads:!1,valid_children:"-div[p|h1|h2|h3|h4|h5|h6|blockquote],+div[pre],+div[img]",plugins:this.plugins,imagetools_toolbar:"imageoptions",toolbar:this.getToolBar(),content_style:`html, body, html.dark-mode {background: ${this.isDarkMode?"#222":"#fff"};} body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}`,style_formats:[{title:"Header Large",format:"h2"},{title:"Header Medium",format:"h3"},{title:"Header Small",format:"h4"},{title:"Header Tiny",format:"h5"},{title:"Paragraph",format:"p",exact:!0,classes:""},{title:"Blockquote",format:"blockquote"},{title:"Code Block",icon:"code",cmd:"codeeditor",format:"codeeditor"},{title:"Inline Code",icon:"code",inline:"code"},{title:"Callouts",items:[{title:"Info",format:"calloutinfo"},{title:"Success",format:"calloutsuccess"},{title:"Warning",format:"calloutwarning"},{title:"Danger",format:"calloutdanger"}]}],style_formats_merge:!1,media_alt_source:!1,media_poster:!1,formats:{codeeditor:{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div"},alignleft:{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",classes:"align-left"},aligncenter:{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",classes:"align-center"},alignright:{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",classes:"align-right"},calloutsuccess:{block:"p",exact:!0,attributes:{class:"callout success"}},calloutinfo:{block:"p",exact:!0,attributes:{class:"callout info"}},calloutwarning:{block:"p",exact:!0,attributes:{class:"callout warning"}},calloutdanger:{block:"p",exact:!0,attributes:{class:"callout danger"}}},file_browser_callback:function(n,i,s,u){s==="file"&&window.EntitySelectorPopup.show(function(c){const d=u.document.getElementById(n);d.value=c.link;const h=d.closest(".mce-form"),p=h.querySelectorAll("input");p[1].value||(p[1].value=c.name),p[2].value=c.name}),s==="image"&&window.ImageManager.show(function(c){if(u.document.getElementById(n).value=c.url,"createEvent"in document){let h=document.createEvent("HTMLEvents");h.initEvent("change",!1,!0),u.document.getElementById(n).dispatchEvent(h)}else u.document.getElementById(n).fireEvent("onchange");let d=``;d+=`${c.name}`,d+="",u.tinyMCE.activeEditor.execCommand("mceInsertContent",!1,d)},"gallery")},paste_preprocess:function(n,i){let s=i.content;s.indexOf('{i();const h=new URL(window.location).searchParams,p=h.get("content-id");p&&s(p);const g=n.getContainer(),y=g.querySelectorAll(".mce-btn");for(let m of y)m.addEventListener("touchstart",b=>{b.stopPropagation()});window.editor=n});function i(){const h=n.getContent();t.isDarkMode&&n.contentDocument.documentElement.classList.add("dark-mode"),window.$events.emit("editor-html-change",h)}function s(h){const p=n.dom.get(encodeURIComponent(h).replace(/!/g,"%21"));if(!p)return;p.scrollIntoView(),n.selection.select(p,!0),n.selection.collapse(!1),n.focus()}i_(n),window.$events.listen("editor-html-update",h=>{n.setContent(h),n.selection.select(n.getBody(),!0),n.selection.collapse(!1),i(h)}),Jx(n);let u,c;function d(h){return h&&!!(h.textContent||h.innerText)}n.on("dragstart",function(){let h=n.selection.getNode();h.nodeName==="IMG"&&(u=n.dom.getParent(h,".mceTemp"),!u&&h.parentNode.nodeName==="A"&&!d(h.parentNode)&&(u=h.parentNode)),h.hasAttribute("contenteditable")&&h.getAttribute("contenteditable")==="false"&&(c=h)}),n.on("drop",function(h){let p=n.dom,g=tinymce.dom.RangeUtils.getCaretRangeFromPoint(h.clientX,h.clientY,n.getDoc());const y=h.dataTransfer&&h.dataTransfer.getData("bookstack/template");y&&(h.preventDefault(),window.$http.get(`/templates/${y}`).then(m=>{n.selection.setRng(g),n.undoManager.transact(function(){n.execCommand("mceInsertContent",!1,m.data.html)})})),p.getParent(g.startContainer,".mceTemp")?h.preventDefault():u&&(h.preventDefault(),n.undoManager.transact(function(){n.selection.setRng(g),n.selection.setNode(u),p.remove(u)})),!h.isDefaultPrevented()&&c&&(h.preventDefault(),n.undoManager.transact(function(){const m=n.selection.getNode(),b=n.selection.getRng(),w=m.closest("body > *");b.startOffset>b.startContainer.length/2?n.$(w).after(c):n.$(w).before(c)})),h.isDefaultPrevented()||Ov(h,n,t),u=null}),n.addButton("image-insert",{title:"My title",icon:"image",tooltip:"Insert an image",onclick:function(){window.ImageManager.show(function(h){let p=``;p+=`${h.name}`,p+="",n.execCommand("mceInsertContent",!1,p)},"gallery")}}),n.on("paste",h=>Ov(h,n,t)),window.$events.emitPublic(t.elem,"editor-tinymce::setup",{editor:n})}}}}var Rv=o_;const Pv=Ke(Ph()),Nv={"add-remove-rows":sg,"ajax-delete-row":lg,"ajax-form":ug,attachments:cg,"auto-suggest":dg,"back-to-top":hg,"book-sort":zg,"chapter-toggle":Rg,"code-editor":jg,"code-highlighter":Hg,collapsible:Ug,"custom-checkbox":Wg,"details-highlighter":$g,dropdown:Gg,"dropdown-search":Kg,dropzone:Yg,"editor-toolbox":Xg,"entity-permissions-editor":Zg,"entity-search":Qg,"entity-selector":Jg,"entity-selector-popup":ev,"event-emit-select":tv,"expand-toggle":nv,"header-mobile-toggle":Pv.default,"homepage-control":rv,"image-manager":iv,"image-picker":ov,index:Za,"list-sort-control":av,"markdown-editor":hv,"new-user-password":fv,notification:pv,"optional-input":mv,"page-comments":gv,"page-display":bv,"page-editor":wv,"page-picker":kv,"permissions-table":xv,popup:_v,"setting-app-color-picker":Cv,"setting-color-picker":Sv,"shelf-sort":Ev,sidebar:Dv,"sortable-list":Av,"submit-on-change":Tv,tabs:Lv,"tag-manager":Iv,"template-manager":Fv,"toggle-switch":Mv,"tri-layout":qv,"user-select":zv,"wysiwyg-editor":Rv};window.components={};function a_(t,n){const i=n.querySelectorAll(`[${t}]`);for(let s=0,u=i.length;s{d.from=s;const h=new CustomEvent(`${t}-${c}`,{bubbles:!0,detail:d});s.$el.dispatchEvent(h)},typeof s.setup=="function"&&s.setup()}catch(u){console.error("Failed to create component",u,t,n)}typeof window.components[t]=="undefined"&&(window.components[t]=[]),window.components[t].push(s),typeof n.components=="undefined"&&(n.components={}),n.components[t]=s}function s_(t,n){const i={},s={},u=`${t}@`,c=`[refs*="${u}"]`,d=[...n.querySelectorAll(c)];n.matches(c)&&d.push(n);for(const h of d){const p=h.getAttribute("refs").split(" ").filter(g=>g.startsWith(u)).map(g=>g.replace(u,"")).map(jv);for(const g of p)i[g]=h,typeof s[g]=="undefined"&&(s[g]=[]),s[g].push(h)}return{refs:i,manyRefs:s}}function l_(t,n){const i={},s=`option:${t}:`;for(const{name:u,value:c}of n.attributes)if(u.startsWith(s)){const d=u.replace(s,"");i[jv(d)]=c||""}return i}function jv(t){const n=s=>s.slice(0,1).toUpperCase()+s.slice(1),i=t.split("-");return i[0]+i.slice(1).map(n).join("")}function Hv(t){typeof t=="undefined"&&(t=document);for(const i of Object.keys(Nv))a_(i,t);const n=t.querySelectorAll("[component],[components]");for(const i of n){const s=`${i.getAttribute("component")||""} ${i.getAttribute("components")}`.toLowerCase().split(" ").filter(Boolean);for(const u of s)Bv(u,i)}}window.components.init=Hv;window.components.first=t=>(window.components[t]||[null])[0];var Za=Hv;window.baseUrl=function(t){let n=document.querySelector('meta[name="base-url"]').getAttribute("content");return n[n.length-1]==="/"&&(n=n.slice(0,n.length-1)),t[0]==="/"&&(t=t.slice(1)),n+"/"+t};window.$http=tg;window.$events=Jm;const mi=new ng;window.trans=mi.get.bind(mi);window.trans_choice=mi.getPlural.bind(mi);window.trans_plural=mi.parsePlural.bind(mi);Za();})(); diff --git a/version b/version index 5affb131c..c11797e18 100644 --- a/version +++ b/version @@ -1 +1 @@ -v0.31.1 +v0.31.2