9 lines
100 KiB
JavaScript
9 lines
100 KiB
JavaScript
(()=>{function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};const n="POST",r="json",a="x-www-form-urlencoded",i="/api/v1/status",o="/api/v1/settings/publish",s="/api/v1/mailer",l="/api/v1/login",u="writeSettings",d="publishSite",c="createNewPage",g="editPage",p="deletePage",h="getSiteSettings",m="getMemberInfo";class f{constructor(e=null){this.percentComplete=0,this.baseURL=null,this.status=!1,e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+i:i).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}login(e){return new Promise(((t,a)=>{this.baseURL?e.remote=!0:e.remote=!1,this.key?e.key=this.key:e.key=null,this._request(this.baseURL?this.baseURL+l:l,"getAuthStatus",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}sync(e,t){return new Promise(((a,i)=>{let o="";switch(e){case"syncSite":o="/api/v1/settings/sync";break;case"syncNav":o="/api/v1/settings/nav-sync"}this._request(this.baseURL?this.baseURL+o:o,u,n,r,t).then((e=>{a(e)})).catch((e=>{i(e)}))}))}publish(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+o:o,d,n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}pageActions(e,t){let i,o,s;switch(e){case c:i="/api/v1/page/create",o=c,s=a;break;case g:i="/api/v1/page/write",o=g,s=a;break;case p:i="/api/v1/page/delete",o=p,s=r}return this.baseURL?t.remote=!0:t.remote=!1,new Promise(((e,r)=>{this._request(this.baseURL?this.baseURL+i:i,o,n,s,t).then((t=>{e(t)})).catch((e=>{r(e)}))}))}sendMail(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+s:s,"sendMail",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}getInfo(e){let t,n;return"site"==e?(t="/api/v1/settings/site",n=h):(t="/api/v1/settings/member",n=m),new Promise(((e,r)=>{this._request(this.baseURL?this.baseURL+t:t,n).then((t=>{e(t)})).catch((e=>{r(e)}))}))}_request(e,t,i="GET",o="json",s=null){var l=this;return new Promise((function(f,v){var b=new XMLHttpRequest;if(b.upload.onprogress=l.handleLoadProgress,b.open(i,e,!0),b.onload=()=>{if(200==b.status){let e=JSON.parse(b.response);f(e)}else{let e=JSON.parse(b.response);v(e)}},"PUT"==i||i==n)switch(t!==u&&t!==g&&t!==c&&t!==p&&t!==d&&"reIndexPages"!==t||b.setRequestHeader("fipamo-access-token",l.token),o){case r:b.setRequestHeader("Content-type","application/"+o),b.send(JSON.stringify(s));break;case a:b.send(s)}else t!==h&&t!==m||b.setRequestHeader("fipamo-access-token",l.token),b.send()}))}handleLoadProgress(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}const v="POST",b="json",y="x-www-form-urlencoded",E="/api/v1/status",w="uploadFiles";class k{constructor(e=null,t=null){this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,t&&(this.key=t),e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+E+"?key="+this.key:"/api/v1/status?key="+this.key).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}create(e){return new Promise(((t,n)=>{this._request("/api/v1/init","blogInit",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}restore(e){return new Promise(((t,n)=>{var r;r=new FormData(e),this._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",r).then((e=>{t(e)})).catch((e=>{n(e)}))}))}backup(){return new Promise(((e,t)=>{var n;n={task:"create_backup"},this._request("/api/v1/backup","createBackup","POST","json",n).then((t=>{e(t)})).catch((e=>{t(e)}))}))}secret(e){return new Promise(((t,n)=>{this._request("/api/v1/get-secret","retrieveSecret",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}newPass(e){return new Promise(((t,n)=>{this._request("/api/v1/reset-password","resetPassword",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}imageUpload(e,t){return new Promise(((n,r)=>{let a="";switch(e){case"avatar-upload":a="/api/v1/settings/add-avatar";break;case"background-upload":a="/api/v1/settings/add-feature-background";break;default:a="/api/v1/page/add-entry-image"}var i=new FormData;this.baseURL?(i.append("key",this.key),i.append("remote",!0)):i.append("remote",!1);for(var o=0;o<t.length;o++){var s=t[o];s.type.match("image.*")&&("avatar-upload"===e?i.append("avatar_upload",s,s.name):"background-upload"===e?i.append("background_upload",s,s.name):i.append("post_image",s,s.name))}this._request(a,w,v,y,i).then((e=>{n(e)})).catch((e=>{r(e)}))}))}_request(e,t,n="GET",r="json",a=null){var i=this;return new Promise((function(o,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=()=>{if(200==l.status){let e=JSON.parse(l.response);o(e)}else{let e=JSON.parse(l.response);s(e)}},"PUT"==n||n==v)switch(t===w&&l.setRequestHeader("fipamo-access-token",i.token),r){case b:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(a));break;case y:l.send(a)}else l.send()}))}handleLoadProgress(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}const I="requestLame",S="postUpdated";new class{};var x=class{constructor(){}cleanString(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}decodeHTML(e,t){var n=0,r=0,a=!1;void 0===t&&(t=2),e=e.toString().replace(/</g,"<").replace(/>/g,">");var i={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(a=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r<t.length;r++)0===i[t[r]]?a=!0:i[t[r]]&&(n|=i[t[r]]);t=n}return t&i.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/�*39;/g,"'")),a||(e=e.replace(/"/g,'"')),e=e.replace(/&/g,"&")}};class P{constructor(){}collectInfo(e){return new Promise(((t,n)=>{let r=new FormData,a=document.createElement("textarea");a.innerHTML=document.getElementById("highlight-content").innerHTML;let i=a.value;if(i=i.replace(/<\/?span[^>]*>/g,""),i=i.replace(/<\/?br[^>]*>/g,"\n"),r.append("id",document.getElementById("post-edit-index").getAttribute("data-index")),r.append("uuid",document.getElementById("post-edit-index").getAttribute("data-uuid")),r.append("layout",document.getElementById("post-edit-index").getAttribute("data-layout")),r.append("current_title",document.getElementById("post-edit-index").getAttribute("data-slug")),r.append("content",i),r.append("title",document.getElementById("post_title").value),r.append("created",document.getElementById("post-date").getAttribute("data-raw")),r.append("slug",(new x).cleanString(document.getElementById("post_title").value)),r.append("tags",document.getElementById("post_tags").value),r.append("menu",document.getElementById("option-menu-pin").getAttribute("data-active")),r.append("featured",document.getElementById("option-feature").getAttribute("data-active")),r.append("published",document.getElementById("option-published").getAttribute("data-active")),r.append("layout",document.getElementById("page-templates").value),r.append("form_token",document.getElementById("form_token").value),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else if(document.getElementById("featured-image")){var o=document.getElementById("featured-image").src;null!=o||null!=o?r.append("feature_image",o):r.append("feature_image",null)}t(r)}))}}const T="editorDelete",_="editorUploadImage",A="editorSave",D="editorUpdate";new class{};var B=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],L=function(e,t){var n,r,a,i=document.createElement("div");return n=t,r={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===e.tagName&&B.push("width"),B.forEach((function(t){r[t]=getComputedStyle(e)[t]})),a=r,Object.keys(a).forEach((function(e){i.style[e]=a[e]})),i.innerHTML=n,e.parentNode.insertBefore(i,e.nextSibling),{rect:function(){var e=i.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return i.parentNode.removeChild(i),t}}};function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.customPos,n=e.iframe,r=e.noShadowCaret;return n?{iframe:n,window:n.contentWindow,document:n.contentDocument||n.contentWindow.document,noShadowCaret:r,customPos:t}:{window:window,document:document,noShadowCaret:r,customPos:t}},M=function(e){return"object"===C(e)&&null!==e},N=function(e,t){var n=function(){return e.selectionStart},r=function(r){var a=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,o=e.value.slice(0,i),s=e.value.slice(i),l='<span style="position: relative; display: inline;">'.concat(a(o),"</span>");l+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',l+='<span style="position: relative; display: inline;">'.concat(a(s),"</span>");var u=L(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var a=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,a=e.getBoundingClientRect(),i=r.documentElement,o=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:a.top+s,left:a.left+o}}(e),i=r(n);return{top:a.top+i.top+t.document.body.scrollTop,left:a.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},R=function(e,t){return function(e){return!!(e.contentEditable?"true"===e.contentEditable:"true"===e.getAttribute("contenteditable"))}(e)?function(e,t){var n=function(){var n=r(),a={height:0,left:0,right:0};if(!n)return a;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var o=n.cloneRange(),s=i?t.customPos:n.endOffset;o.setStart(n.endContainer,s-1<0?0:s-1),o.setEnd(n.endContainer,s);var l=o.getBoundingClientRect();a={height:l.height,left:l.left+l.width,top:l.top},o.detach()}if((!a||a&&0===a.height)&&!t.noShadowCaret){var u=n.cloneRange(),d=t.document.createTextNode("|");u.insertNode(d),u.selectNode(d);var c=u.getBoundingClientRect();a={height:c.height,left:c.left,top:c.top},d.parentNode.removeChild(d),u.detach()}if(a){var g=t.document.documentElement;a.top+=t.window.pageYOffset-(g.clientTop||0),a.left+=t.window.pageXOffset-(g.clientLeft||0)}return a},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},a=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var a=n.toString().length;return n.detach(),a};return{getPos:a,setPos:function(n){var r=t.window.getSelection();if(r){var a=0,i=!1;!function e(o,s){for(var l=0;l<s.childNodes.length;l++){var u=s.childNodes[l];if(i)break;if(3===u.nodeType){if(a+u.length>=o){i=!0;var d=t.document.createRange();d.setStart(u,o-a),r.removeAllRanges(),r.addRange(d);break}a+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=a(),o=e.getBoundingClientRect(),s=o.top+t.document.body.scrollTop,l=o.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):N(e,t)};var U=class{constructor(){this.listeners=new Map}addListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeListener(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce(((e,n,r)=>"function"==typeof n&&n===t?e=r:e),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}emitEvent(e,...t){var n=this.listeners.get(e);return!(!n||!n.length)&&(n.forEach((e=>{e(...t)})),!0)}},H={},F=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,i;switch(n=n||{},a.util.type(t)){case"Object":if(i=a.util.objId(t),n[i])return n[i];for(var o in r={},n[i]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case"Array":return i=a.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach((function(t,a){r[a]=e(t,n)})),r);default:return t}},getLanguage:function(e){for(;e&&!t.test(e.className);)e=e.parentElement;return e?(e.className.match(t)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=a.util.clone(a.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var i=(r=r||a.languages)[e],o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in n)n.hasOwnProperty(l)&&(o[l]=n[l]);n.hasOwnProperty(s)||(o[s]=i[s])}var u=r[e];return r[e]=o,a.languages.DFS(a.languages,(function(t,n){n===u&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,r,i){i=i||{};var o=a.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var l=t[s],u=a.util.type(l);"Object"!==u||i[o(l)]?"Array"!==u||i[o(l)]||(i[o(l)]=!0,e(l,n,s,i)):(i[o(l)]=!0,e(l,n,null,i))}}},plugins:{},highlightAll:function(e,t){a.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,o=0;i=r.elements[o++];)a.highlightElement(i,!0===t,r.callback)},highlightElement:function(n,r,i){var o=a.util.getLanguage(n),s=a.languages[o];n.className=n.className.replace(t,"").replace(/\s+/g," ")+" language-"+o;var l=n.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&(l.className=l.className.replace(t,"").replace(/\s+/g," ")+" language-"+o);var u={element:n,language:o,grammar:s,code:n.textContent};function d(e){u.highlightedCode=e,a.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,a.hooks.run("after-highlight",u),a.hooks.run("complete",u),i&&i.call(u.element)}if(a.hooks.run("before-sanity-check",u),(l=u.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!u.code)return a.hooks.run("complete",u),void(i&&i.call(u.element));if(a.hooks.run("before-highlight",u),u.grammar)if(r&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){d(e.data)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else d(a.highlight(u.code,u.grammar,u.language));else d(a.util.encode(u.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};return a.hooks.run("before-tokenize",r),r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new l;return u(a,a.head,e),s(e,a,t,a.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(a)},hooks:{all:{},add:function(e,t){var n=a.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=a.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function s(e,t,n,r,l,c){for(var g in n)if(n.hasOwnProperty(g)&&n[g]){var p=n[g];p=Array.isArray(p)?p:[p];for(var h=0;h<p.length;++h){if(c&&c.cause==g+","+h)return;var m=p[h],f=m.inside,v=!!m.lookbehind,b=!!m.greedy,y=m.alias;if(b&&!m.pattern.global){var E=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,E+"g")}for(var w=m.pattern||m,k=r.next,I=l;k!==t.tail&&!(c&&I>=c.reach);I+=k.value.length,k=k.next){var S=k.value;if(t.length>e.length)return;if(!(S instanceof i)){var x,P=1;if(b){if(!(x=o(w,I,e,v)))break;var T=x.index,_=x.index+x[0].length,A=I;for(A+=k.value.length;T>=A;)A+=(k=k.next).value.length;if(I=A-=k.value.length,k.value instanceof i)continue;for(var D=k;D!==t.tail&&(A<_||"string"==typeof D.value);D=D.next)P++,A+=D.value.length;P--,S=e.slice(I,A),x.index-=I}else if(!(x=o(w,0,S,v)))continue;T=x.index;var B=x[0],L=S.slice(0,T),C=S.slice(T+B.length),O=I+S.length;c&&O>c.reach&&(c.reach=O);var M=k.prev;if(L&&(M=u(t,M,L),I+=L.length),d(t,M,P),k=u(t,M,new i(g,f?a.tokenize(B,f):B,y,B)),C&&u(t,k,C),P>1){var N={cause:g+","+h,reach:O};s(e,t,n,k.prev,I,N),c&&N.reach>c.reach&&(c.reach=N.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function u(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function d(e,t,n){for(var r=t.next,a=0;a<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}if(e.Prism=a,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,n)})),r}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(i.classes,o):i.classes.push(o)),a.hooks.run("wrap",i);var s="";for(var l in i.attributes)s+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+s+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,o=n.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),o&&e.close()}),!1),a):a;var c=a.util.currentScript();function g(){a.manual||a.highlightAll()}if(c&&(a.filename=c.src,c.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var p=document.readyState;"loading"===p||"interactive"===p&&c&&c.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return a}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});H&&(H=F),void 0!==t&&(t.Prism=F),Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"font-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+i+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+i+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var a=t[n];if("code"===a.type){var i=a.content[1],o=a.content[3];if(i&&o&&"code-language"===i.type&&"code-block"===o.type&&"string"==typeof i.content){var s=i.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(s=(/[a-z][\w-]*/i.exec(s)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,l]:o.alias.push(l):o.alias=[l]}}else e(a.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,a=t.classes.length;r<a;r++){var i=t.classes[r],u=/language-(.+)/.exec(i);if(u){n=u[1];break}}var d,c=e.languages[n];if(c)t.content=e.highlight((d=t.content,d.replace(o,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(n);var r=s[t];return r||e}))),c,n);else if(n&&"none"!==n&&e.plugins.autoloader){var g="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=g,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(g);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var o=RegExp(e.languages.markup.tag.pattern.source,"gi"),s={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism);var q=class extends U{constructor(t,n){super(),document.getElementById("edit").addEventListener("input",(n=>{let r=document.querySelector("#highlight-content");this.textEditor=t;let a=n.target.value;r.innerHTML=a.replace(new RegExp("&","g"),"&").replace(new RegExp("<","g"),"<");let i=document.getElementById("highlight").offsetHeight;document.getElementById("edit-post-wrapper").style.height=i+"px",n.target.style.height=i+"px",e(H).highlightElement(r)})),document.getElementById("edit").addEventListener("scroll",(e=>{let t=document.querySelector("#highlight");t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft})),document.getElementById("edit").dispatchEvent(new Event("input")),this.setInputs(),window.addEventListener("scroll",(()=>{}))}setInputs(){for(var e=document.querySelectorAll(".editor-button"),t=0,n=e.length;t<n;t++)e[t].addEventListener("click",(e=>this.handleEditorOption(e)),!1)}notify(e,t){switch(e){case S:document.getElementById("submit-update").classList.add("icon-hide"),document.getElementById("submit-good").classList.remove("icon-hide"),document.getElementById("edit-update").classList.remove("submit-start"),document.getElementById("edit-update").classList.add("submit-cool"),setTimeout((()=>{document.getElementById("submit-update").classList.remove("icon-hide"),document.getElementById("submit-good").classList.add("icon-hide"),document.getElementById("edit-update").classList.add("submit-start"),document.getElementById("edit-update").classList.remove("submit-cool")}),2e3);break;case"postAdded":break;case _:let e=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a="![image alt text]("+t+" 'image title')";this.textEditor.value=this.textEditor.value.substring(0,n)+a+this.textEditor.value.substring(r,e),document.getElementById("edit").dispatchEvent(new Event("input"))}}handleEditorOption(e){e.preventDefault();let t=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a=this.textEditor.value.substring(n,r),i="";switch(e.target.id){case"edit-bold":i="**"+a+"**",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-italic":i="*"+a+"*",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-strikethrough":i="~~"+a+"~~",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header1":i="# "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header2":i="## "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header3":i="### "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-link":i="["+a+"]("+prompt("Let's get that url, boss").toLowerCase()+")",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-image":this.caretPos=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};M(t)&&(n=t,t=null);var r=O(n),a=R(e,r);return t||0===t?a.setPos(t):a.getPosition()}(this.textEditor).pos,this.emitEvent(_);break;case"submit-save":case"edit-save":this.emitEvent(A);break;case"submit-update":case"edit-update":this.emitEvent(D);break;case"edit-delete":this.emitEvent(T)}document.getElementById("edit").dispatchEvent(new Event("input"))}},X={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},j={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Y=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],W={CSS:{},springs:{}};function $(e,t,n){return Math.min(Math.max(e,t),n)}function z(e,t){return e.indexOf(t)>-1}function G(e,t){return e.apply(null,t)}var Q={arr:function(e){return Array.isArray(e)},obj:function(e){return z(Object.prototype.toString.call(e),"Object")},pth:function(e){return Q.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||Q.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},nil:function(e){return Q.und(e)||null===e},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return Q.hex(e)||Q.rgb(e)||Q.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!j.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function V(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function J(e,t){var n=V(e),r=$(Q.und(n[0])?1:n[0],.1,100),a=$(Q.und(n[1])?100:n[1],.1,100),i=$(Q.und(n[2])?10:n[2],.1,100),o=$(Q.und(n[3])?0:n[3],.1,100),s=Math.sqrt(a/r),l=i/(2*Math.sqrt(a*r)),u=l<1?s*Math.sqrt(1-l*l):0,d=l<1?(l*s-o)/u:-o+s;function c(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+d*Math.sin(u*n)):(1+d*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?c:function(){var t=W.springs[e];if(t)return t;for(var n=1/6,r=0,a=0;;)if(1===c(r+=n)){if(++a>=16)break}else a=0;var i=r*n*1e3;return W.springs[e]=i,i}}function Z(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var K,ee,te=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function r(e){return 3*e}function a(e,a,i){return((t(a,i)*e+n(a,i))*e+r(a))*e}function i(e,a,i){return 3*t(a,i)*e*e+2*n(a,i)*e+r(a)}return function(t,n,r,o){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==o)for(var l=0;l<11;++l)s[l]=a(l*e,t,r);return function(e){return t===n&&r===o||0===e||1===e?e:a(u(e),n,o)}}function u(n){for(var o=0,l=1;10!==l&&s[l]<=n;++l)o+=e;--l;var u=o+(n-s[l])/(s[l+1]-s[l])*e,d=i(u,t,r);return d>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var s=i(t,n,r);if(0===s)return t;t-=(a(t,n,r)-e)/s}return t}(n,u,t,r):0===d?u:function(e,t,n,r,i){var o,s,l=0;do{(o=a(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(o)>1e-7&&++l<10);return s}(n,o,o+e,t,r)}}}(),ne=(K={linear:function(){return function(e){return e}}},ee={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,n=4;e<((t=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=$(e,1,10),r=$(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,t){ee[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ee).forEach((function(e){var t=ee[e];K["easeIn"+e]=t,K["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},K["easeInOut"+e]=function(e,n){return function(r){return r<.5?t(e,n)(2*r)/2:1-t(e,n)(-2*r+2)/2}},K["easeOutIn"+e]=function(e,n){return function(r){return r<.5?(1-t(e,n)(1-2*r))/2:(t(e,n)(2*r-1)+1)/2}}})),K);function re(e,t){if(Q.fnc(e))return e;var n=e.split("(")[0],r=ne[n],a=V(e);switch(n){case"spring":return J(e,t);case"cubicBezier":return G(te,a);case"steps":return G(Z,a);default:return G(r,a)}}function ae(e){try{return document.querySelectorAll(e)}catch(e){return}}function ie(e,t){for(var n=e.length,r=arguments.length>=2?arguments[1]:void 0,a=[],i=0;i<n;i++)if(i in e){var o=e[i];t.call(r,o,i,e)&&a.push(o)}return a}function oe(e){return e.reduce((function(e,t){return e.concat(Q.arr(t)?oe(t):t)}),[])}function se(e){return Q.arr(e)?e:(Q.str(e)&&(e=ae(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function le(e,t){return e.some((function(e){return e===t}))}function ue(e){var t={};for(var n in e)t[n]=e[n];return t}function de(e,t){var n=ue(e);for(var r in e)n[r]=t.hasOwnProperty(r)?t[r]:e[r];return n}function ce(e,t){var n=ue(e);for(var r in t)n[r]=Q.und(e[r])?t[r]:e[r];return n}function ge(e){return Q.rgb(e)?(n=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t=e))?"rgba("+n[1]+",1)":t:Q.hex(e)?function(e){var t=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,r){return t+t+n+n+r+r})),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(e):Q.hsl(e)?function(e){var t,n,r,a=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),i=parseInt(a[1],10)/360,o=parseInt(a[2],10)/100,s=parseInt(a[3],10)/100,l=a[4]||1;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==o)t=n=r=s;else{var d=s<.5?s*(1+o):s+o-s*o,c=2*s-d;t=u(c,d,i+1/3),n=u(c,d,i),r=u(c,d,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function pe(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function he(e,t){return Q.fnc(e)?e(t.target,t.id,t.total):e}function me(e,t){return e.getAttribute(t)}function fe(e,t,n){if(le([n,"deg","rad","turn"],pe(t)))return t;var r=W.CSS[t+n];if(!Q.und(r))return r;var a=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(a),a.style.position="absolute",a.style.width=100+n;var o=100/a.offsetWidth;i.removeChild(a);var s=o*parseFloat(t);return W.CSS[t+n]=s,s}function ve(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?fe(e,a,n):a}}function be(e,t){return Q.dom(e)&&!Q.inp(e)&&(!Q.nil(me(e,t))||Q.svg(e)&&e[t])?"attribute":Q.dom(e)&&le(Y,t)?"transform":Q.dom(e)&&"transform"!==t&&ve(e,t)?"css":null!=e[t]?"object":void 0}function ye(e){if(Q.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,a=new Map;t=r.exec(n);)a.set(t[1],t[2]);return a}}function Ee(e,t,n,r){var a=z(t,"scale")?1:0+function(e){return z(e,"translate")||"perspective"===e?"px":z(e,"rotate")||z(e,"skew")?"deg":void 0}(t),i=ye(e).get(t)||a;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?fe(e,i,r):i}function we(e,t,n,r){switch(be(e,t)){case"transform":return Ee(e,t,r,n);case"css":return ve(e,t,n);case"attribute":return me(e,t);default:return e[t]||0}}function ke(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=pe(e)||0,a=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return a+i+r;case"-":return a-i+r;case"*":return a*i+r}}function Ie(e,t){if(Q.col(e))return ge(e);if(/\s/g.test(e))return e;var n=pe(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Se(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function xe(e){for(var t,n=e.points,r=0,a=0;a<n.numberOfItems;a++){var i=n.getItem(a);a>0&&(r+=Se(t,i)),t=i}return r}function Pe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*me(e,"r")}(e);case"rect":return function(e){return 2*me(e,"width")+2*me(e,"height")}(e);case"line":return function(e){return Se({x:me(e,"x1"),y:me(e,"y1")},{x:me(e,"x2"),y:me(e,"y2")})}(e);case"polyline":return xe(e);case"polygon":return function(e){var t=e.points;return xe(e)+Se(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Te(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Q.svg(t)&&Q.svg(t.parentNode);)t=t.parentNode;return t}(e),a=r.getBoundingClientRect(),i=me(r,"viewBox"),o=a.width,s=a.height,l=n.viewBox||(i?i.split(" "):[0,0,o,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o,h:s,vW:l[2],vH:l[3]}}function _e(e,t,n){function r(n){void 0===n&&(n=0);var r=t+n>=1?t+n:0;return e.el.getPointAtLength(r)}var a=Te(e.el,e.svg),i=r(),o=r(-1),s=r(1),l=n?1:a.w/a.vW,u=n?1:a.h/a.vH;switch(e.property){case"x":return(i.x-a.x)*l;case"y":return(i.y-a.y)*u;case"angle":return 180*Math.atan2(s.y-o.y,s.x-o.x)/Math.PI}}function Ae(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ie(Q.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Q.str(e)||t?r.split(n):[]}}function De(e){return ie(e?oe(Q.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Be(e){var t=De(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ye(e)}}}))}function Le(e,t){var n=ue(t);if(/^spring/.test(n.easing)&&(n.duration=J(n.easing)),Q.arr(e)){var r=e.length;2===r&&!Q.obj(e[0])?e={value:e}:Q.fnc(t.duration)||(n.duration=t.duration/r)}var a=Q.arr(e)?e:[e];return a.map((function(e,n){var r=Q.obj(e)&&!Q.pth(e)?e:{value:e};return Q.und(r.delay)&&(r.delay=n?0:t.delay),Q.und(r.endDelay)&&(r.endDelay=n===a.length-1?t.endDelay:0),r})).map((function(e){return ce(e,n)}))}function Ce(e,t){var n=[],r=t.keyframes;for(var a in r&&(t=ce(function(e){for(var t=ie(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return Q.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var a=t[r];n[a]=e.map((function(e){var t={};for(var n in e)Q.key(n)?n==a&&(t.value=e[n]):t[n]=e[n];return t}))},a=0;a<t.length;a++)r(a);return n}(r),t)),t)Q.key(a)&&n.push({name:a,tweens:Le(t[a],e)});return n}function Oe(e,t){var n;return e.tweens.map((function(r){var a=function(e,t){var n={};for(var r in e){var a=he(e[r],t);Q.arr(a)&&1===(a=a.map((function(e){return he(e,t)}))).length&&(a=a[0]),n[r]=a}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(r,t),i=a.value,o=Q.arr(i)?i[1]:i,s=pe(o),l=we(t.target,e.name,s,t),u=n?n.to.original:l,d=Q.arr(i)?i[0]:u,c=pe(d)||pe(l),g=s||c;return Q.und(o)&&(o=u),a.from=Ae(d,g),a.to=Ae(ke(o,d),g),a.start=n?n.end:0,a.end=a.start+a.delay+a.duration+a.endDelay,a.easing=re(a.easing,a.duration),a.isPath=Q.pth(i),a.isPathTargetInsideSVG=a.isPath&&Q.svg(t.target),a.isColor=Q.col(a.from.original),a.isColor&&(a.round=1),n=a,a}))}var Me={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,r,a){if(r.list.set(t,n),t===r.last||a){var i="";r.list.forEach((function(e,t){i+=t+"("+e+") "})),e.style.transform=i}}};function Ne(e,t){Be(e).forEach((function(e){for(var n in t){var r=he(t[n],e),a=e.target,i=pe(r),o=we(a,n,i,e),s=ke(Ie(r,i||pe(o)),o),l=be(a,n);Me[l](a,n,s,e.transforms,!0)}}))}function Re(e,t){return ie(oe(e.map((function(e){return t.map((function(t){return function(e,t){var n=be(e.target,t.name);if(n){var r=Oe(t,e),a=r[r.length-1];return{type:n,property:t.name,animatable:e,tweens:r,duration:a.end,delay:r[0].delay,endDelay:a.endDelay}}}(e,t)}))}))),(function(e){return!Q.und(e)}))}function Ue(e,t){var n=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},a={};return a.duration=n?Math.max.apply(Math,e.map((function(e){return r(e)+e.duration}))):t.duration,a.delay=n?Math.min.apply(Math,e.map((function(e){return r(e)+e.delay}))):t.delay,a.endDelay=n?a.duration-Math.max.apply(Math,e.map((function(e){return r(e)+e.duration-e.endDelay}))):t.endDelay,a}var He=0;var Fe=[],qe=function(){var e;function t(n){for(var r=Fe.length,a=0;a<r;){var i=Fe[a];i.paused?(Fe.splice(a,1),r--):(i.tick(n),a++)}e=a>0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){je.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(Fe.forEach((function(e){return e._onDocumentVisibility()})),qe()))})),function(){e||Xe()&&je.suspendWhenDocumentHidden||!(Fe.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function je(e){void 0===e&&(e={});var t,n=0,r=0,a=0,i=0,o=null;function s(e){var t=window.Promise&&new Promise((function(e){return o=e}));return e.finished=t,t}var l=function(e){var t=de(X,e),n=de(j,e),r=Ce(n,e),a=Be(e.targets),i=Re(a,r),o=Ue(i,n),s=He;return He++,ce(t,{id:s,children:[],animatables:a,animations:i,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(e);s(l);function u(){var e=l.direction;"alternate"!==e&&(l.direction="normal"!==e?"normal":"reverse"),l.reversed=!l.reversed,t.forEach((function(e){return e.reversed=l.reversed}))}function d(e){return l.reversed?l.duration-e:e}function c(){n=0,r=d(l.currentTime)*(1/je.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t<r;){var a=n[t],i=a.animatable,o=a.tweens,s=o.length-1,u=o[s];s&&(u=ie(o,(function(t){return e<t.end}))[0]||u);for(var d=$(e-u.start-u.delay,0,u.duration)/u.duration,c=isNaN(d)?1:u.easing(d),g=u.to.strings,p=u.round,h=[],m=u.to.numbers.length,f=void 0,v=0;v<m;v++){var b=void 0,y=u.to.numbers[v],E=u.from.numbers[v]||0;b=u.isPath?_e(u.value,c*y,u.isPathTargetInsideSVG):E+c*(y-E),p&&(u.isColor&&v>2||(b=Math.round(b*p)/p)),h.push(b)}var w=g.length;if(w){f=g[0];for(var k=0;k<w;k++){g[k];var I=g[k+1],S=h[k];isNaN(S)||(f+=I?S+I:S+" ")}}else f=h[0];Me[a.type](i.target,a.property,f,i.transforms),a.currentValue=f,t++}}function h(e){l[e]&&!l.passThrough&&l[e](l)}function m(e){var c=l.duration,m=l.delay,f=c-l.endDelay,v=d(e);l.progress=$(v/c*100,0,100),l.reversePlayback=v<l.currentTime,t&&function(e){if(l.reversePlayback)for(var n=i;n--;)g(e,t[n]);else for(var r=0;r<i;r++)g(e,t[r])}(v),!l.began&&l.currentTime>0&&(l.began=!0,h("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=m&&0!==l.currentTime&&p(0),(v>=f&&l.currentTime!==c||!c)&&p(c),v>m&&v<f?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,h("changeBegin")),h("change"),p(v)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,h("changeComplete")),l.currentTime=$(v,0,c),l.began&&h("update"),e>=c&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=a,h("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,h("loopComplete"),h("complete"),!l.passThrough&&"Promise"in window&&(o(),s(l)))))}return l.reset=function(){var e=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===e,l.remaining=l.loop,t=l.children;for(var n=i=t.length;n--;)l.children[n].reset();(l.reversed&&!0!==l.loop||"alternate"===e&&1===l.loop)&&l.remaining++,p(l.reversed?l.duration:0)},l._onDocumentVisibility=c,l.set=function(e,t){return Ne(e,t),l},l.tick=function(e){a=e,n||(n=a),m((a+(r-n))*je.speed)},l.seek=function(e){m(d(e))},l.pause=function(){l.paused=!0,c()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Fe.push(l),c(),qe())},l.reverse=function(){u(),l.completed=!l.reversed,c()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){We(De(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ye(e,t){for(var n=t.length;n--;)le(e,t[n].animatable.target)&&t.splice(n,1)}function We(e,t){var n=t.animations,r=t.children;Ye(e,n);for(var a=r.length;a--;){var i=r[a],o=i.animations;Ye(e,o),o.length||i.children.length||r.splice(a,1)}n.length||r.length||t.pause()}je.version="3.2.1",je.speed=1,je.suspendWhenDocumentHidden=!0,je.running=Fe,je.remove=function(e){for(var t=De(e),n=Fe.length;n--;){We(t,Fe[n])}},je.get=we,je.set=Ne,je.convertPx=fe,je.path=function(e,t){var n=Q.str(e)?ae(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Te(n),totalLength:Pe(n)*(r/100)}}},je.setDashoffset=function(e){var t=Pe(e);return e.setAttribute("stroke-dasharray",t),t},je.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?re(t.easing):null,a=t.grid,i=t.axis,o=t.from||0,s="first"===o,l="center"===o,u="last"===o,d=Q.arr(e),c=d?parseFloat(e[0]):parseFloat(e),g=d?parseFloat(e[1]):0,p=pe(d?e[1]:e)||0,h=t.start||0+(d?c:0),m=[],f=0;return function(e,t,v){if(s&&(o=0),l&&(o=(v-1)/2),u&&(o=v-1),!m.length){for(var b=0;b<v;b++){if(a){var y=l?(a[0]-1)/2:o%a[0],E=l?(a[1]-1)/2:Math.floor(o/a[0]),w=y-b%a[0],k=E-Math.floor(b/a[0]),I=Math.sqrt(w*w+k*k);"x"===i&&(I=-w),"y"===i&&(I=-k),m.push(I)}else m.push(Math.abs(o-b));f=Math.max.apply(Math,m)}r&&(m=m.map((function(e){return r(e/f)*f}))),"reverse"===n&&(m=m.map((function(e){return i?e<0?-1*e:-e:Math.abs(f-e)})))}return h+(d?(g-c)/f:c)*(Math.round(100*m[t])/100)+p}},je.timeline=function(e){void 0===e&&(e={});var t=je(e);return t.duration=0,t.add=function(n,r){var a=Fe.indexOf(t),i=t.children;function o(e){e.passThrough=!0}a>-1&&Fe.splice(a,1);for(var s=0;s<i.length;s++)o(i[s]);var l=ce(n,de(j,e));l.targets=l.targets||e.targets;var u=t.duration;l.autoplay=!1,l.direction=t.direction,l.timelineOffset=Q.und(r)?u:ke(r,u),o(t),t.seek(l.timelineOffset);var d=je(l);o(d),i.push(d);var c=Ue(i,e);return t.delay=c.delay,t.endDelay=c.endDelay,t.duration=c.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},je.easing=re,je.penner=ne,je.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var $e=je;const ze=document.getElementById("notifications"),Ge=document.getElementById("notifyMessage"),Qe=document.getElementById("message-text"),Ve=document.getElementById("notify-good"),Je=document.getElementById("notify-lame"),Ze=document.getElementById("notify-working");class Ke{constructor(){}alert(e,t){Ze.style.display="none",Ve.style.display="none",Je.style.display="none";var n="";null!==t?t?(n="#32cd32",Ze.style.display="none",Ve.style.display="block"):(n="#F64747",Ze.style.display="none",Je.style.display="block"):(n="#200317",Ze.style.display="block"),Qe.innerHTML=e,$e({targets:ze,marginTop:"-10",easing:"easeInOutQuint",duration:10,complete:()=>{$e({targets:Ge,rotateX:"0",easing:"easeInOutQuint",duration:700}),$e({targets:Qe,backgroundColor:n,easing:"easeInOutQuint",duration:700,complete:()=>{setTimeout((()=>{null!==t&&$e({targets:Ge,rotateX:"-120",easing:"easeInOutQuint",duration:700,complete:()=>{$e({targets:ze,marginTop:"-55",easing:"easeInOutQuint",delay:700,duration:50})}})}),1e3)}})}})}}const et=new Ke;class tt{constructor(){this.processing=!1;let e=this;this.admin=new f(null),this.mm=new k,this.urlPieces=document.URL.split("/"),this.post=[],this.postID=null,this.postUUID=null,this.postLayout=null,document.getElementById("post-edit-index").getAttribute("data-index")&&(this.postID=document.getElementById("post-edit-index").getAttribute("data-index"),this.postUUID=document.getElementById("post-edit-index").getAttribute("data-uuid"),this.postLayout=document.getElementById("post-edit-index").getAttribute("data-layout")),document.getElementById("edit")&&(this.editor=new q(document.getElementById("edit"),document.getElementById("header").offsetHeight+document.getElementById("post-header").offsetHeight+document.getElementById("post-feature").offsetHeight),this.editor.addListener(T,(()=>this.handleEditorOptions(T)),!1),this.editor.addListener(_,(()=>this.handleEditorOptions(_)),!1),this.editor.addListener(D,(()=>this.handleEditorOptions(D)),!1),this.editor.addListener(A,(()=>this.handleEditorOptions(A)),!1),document.getElementById("post-image-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),this.start())}start(){if(document.getElementById("featured-image-drop")){document.getElementById("featured-image-drop").addEventListener("dragover",this.handleImageActions,!1),document.getElementById("featured-image-drop").addEventListener("drop",this.handleImageActions,!1),document.getElementById("featured-image-upload").addEventListener("change",(e=>this.handleImageActions(e)),!1),document.getElementById("new-feature-upload")&&document.getElementById("new-feature-upload").addEventListener("click",(()=>{document.getElementById("featured-image-upload").click()}));for(var e=document.querySelectorAll(".post-option-btn"),t=0,n=e.length;t<n;t++)e[t].addEventListener("click",(e=>this.handlePostOptions(e)),!1)}}handlePostOptions(e){let t;switch(e.target.id){case"option-page-icon":case"option-menu-pin":t=document.getElementById("option-menu-pin");break;case"option-feature-icon":case"option-feature":t=document.getElementById("option-feature");break;case"option-published-icon":case"option-published":t=document.getElementById("option-published")}"false"==t.getAttribute("data-active")?t.setAttribute("data-active","true"):t.setAttribute("data-active","false")}handleEditorOptions(e){if(this.processing)return;let t=this;switch(e){case A:case D:var n="";n=e===A?c:g,(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,et.alert("Writing down changes",null),t.admin.pageActions(n,e).then((e=>{t.processing=!1,"postError"===e.type||"apiUseNotAuthorized"===e.type?et.alert(e.message,!1):e.type===S?et.alert(e.message,!0):(et.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((e=>{t.processing=!1,et.alert(e,!1)}))}));break;case T:if("index"===this.postLayout)return void et.alert("Index cannot be deleted",!1);if(confirm("AYE! You know you're deleting this post, right?")){let e={id:this.postUUID};t.processing=!0,this.admin.pageActions(p,e).then((()=>{t.processing=!1,window.location="/dashboard/pages"})).catch((e=>{t.processing=!1,et.alert(e,!1)}))}break;case _:document.getElementById("post-image-upload").click()}}handleImageActions(e){switch(e.stopPropagation(),e.preventDefault(),e.type){case"dragover":e.dataTransfer.dropEffect="copy";break;case"change":case"drop":"drop"==e.type?tt.uploadFiles=e.dataTransfer.files:tt.uploadFiles=e.target.files;for(var t,n=0;t=tt.uploadFiles[n];n++)if(t.type.match("image.*")){var r=new FileReader;r.onload=function(e){return function(t){var n=document.createElement("img");n.src=t.target.result,n.title=escape(e.name),document.createElement("div").innerHTML=['<img src="',t.target.result,'" title="',escape(e.name),'"/>'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(t),r.readAsDataURL(t)}}}handleImageUpload(e,t){let n=this;et.alert("Uploading Image",null),n.mm.imageUpload(e,t).then((e=>{"postImageAdded"==e.type?(n.editor.notify(_,e.url),et.alert("Image Added to Entry",!0)):et.alert("Uh oh. Image not added",!1)})).catch((()=>{et.alert("Uh oh. Image not added",!1)}))}}tt.uploadFiles=[];class nt{constructor(e){this.currentPage=null,this.choosePage(e),this.start()}start(){}choosePage(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new tt}}}class rt{constructor(){}getInfo(){let e=document.getElementById("settings-handle").value,t=document.getElementById("settings-email").value,n=document.getElementById("settings-url").value,r=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,i=document.getElementById("render-toggle").getAttribute("data-render"),o=document.getElementById("background").src,s="",l=document.querySelectorAll(".theme-select"),u=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,c=document.getElementById("smtp-pass").value,g=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,h="",m=document.querySelectorAll(".mail-option"),f=document.getElementById("api-access-toggle").getAttribute("data-enabled"),v=document.getElementById("dynamic-render-toggle").getAttribute("data-enabled");var b,y;for(b=0,y=l.length;b<y;b++)"true"==l[b].getAttribute("data-enabled")&&(s=l[b].id);for(b=0,y=m.length;b<y;b++)"true"==m[b].getAttribute("data-enabled")&&(h=m[b].id);let E={global:{base_url:n,title:r,descriptions:a,background:o,private:!1,renderOnSave:i,theme:s,externalAPI:f,dynamicRender:v},member:{handle:e,email:t},email:{active:h,smtp:{domain:u,email:d,password:c},mailgun:{domain:g,key:p}}};return new Promise((function(e){e(E)}))}}const at=new Ke;class it{constructor(){}sendMail(){(new f).sendMail({content:"This is a test email"}).then((e=>{at.alert(e.message,!0)})).catch((e=>{at.alert(e.message,!1)}))}testMail(){(new f).sendMail({content:"This is a test email",mail_task:"TESTING"}).then((e=>{at.alert(e.message,!0)})).catch((e=>{at.alert(e.message,!1)}))}}const ot=new Ke;class st{constructor(){this.processing=!1,this.start(),this.admin=new f(null),this.mm=new k(null,null)}start(){let e=this;document.getElementById("save-toggle").addEventListener("click",(()=>(new rt).getInfo().then((t=>{ot.alert("Saving Settings",null),e.admin.sync("syncSite",t).then((e=>{e.type,ot.alert(e.message,!0)}))})).catch((()=>{})))),document.getElementById("avatar").addEventListener("click",(()=>{document.getElementById("avatar-upload").click()})),document.getElementById("background").addEventListener("click",(()=>{document.getElementById("background-upload").click()})),document.getElementById("avatar-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),document.getElementById("background-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1);var t=document.getElementById("api-access-toggle"),n=document.getElementById("api-status");t.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==t.getAttribute("data-enabled")?(t.setAttribute("data-enabled","true"),n.innerHTML="EXTERNAL API ACCESS IS ENABLED"):(t.setAttribute("data-enabled","false"),n.innerHTML="EXTERNAL API ACCESS IS NOT ENABLED")}));var r=document.getElementById("dynamic-render-toggle"),a=document.getElementById("dynamic-render-status");r.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==r.getAttribute("data-enabled")?(r.setAttribute("data-enabled","true"),a.innerHTML="DYNAMIC PAGE RENDERING"):(r.setAttribute("data-enabled","false"),a.innerHTML="STATIC PAGE RENDERING")})),document.getElementById("send-mail").addEventListener("click",(e=>this.handleMailer(e))),document.getElementById("publish-pages").addEventListener("click",(e=>this.handlePublished(e))),document.getElementById("render-toggle").addEventListener("click",(e=>this.toggleRender(e))),document.getElementById("render-toggle-icon").addEventListener("click",(e=>this.toggleRender(e)));let i=document.querySelectorAll(".theme-select");for(var o=0,s=i.length;o<s;o++)i[o].addEventListener("click",(e=>this.handleThemes(e)));let l=document.querySelectorAll(".mail-option");for(o=0,s=l.length;o<s;o++)l[o].addEventListener("click",(e=>this.handleMailOptions(e)));document.getElementById("create-backup").addEventListener("click",(e=>this.handleBackup(e)))}togglePrivacy(e){e.stopPropagation(),e.preventDefault(),"false"==e.target.getAttribute("data-private")?(e.target.setAttribute("data-private","true"),e.target.innerHTML="SITE IS PUBLIC"):(e.target.setAttribute("data-private","false"),e.target.innerHTML="SITE IS PRIVATE")}toggleRender(e){e.stopPropagation(),e.preventDefault();let t=document.getElementById("render-toggle");"false"==t.getAttribute("data-render")?t.setAttribute("data-render","true"):t.setAttribute("data-render","false")}handleMailer(){(new it).testMail()}handleThemes(e){e.stopPropagation(),e.preventDefault();let t=document.querySelectorAll(".theme-select");for(var n=0,r=t.length;n<r;n++)e.target.id==t[n].id?t[n].setAttribute("data-enabled","true"):t[n].setAttribute("data-enabled","false")}handleMailOptions(e){e.preventDefault(),e.stopPropagation();let t=document.getElementById("mail-smtp"),n=document.getElementById("mail-mg"),r=document.querySelectorAll(".mail-option");for(var a=0,i=r.length;a<i;a++)e.target.id==r[a].id?(r[a].setAttribute("data-enabled","true"),"option-smtp"==e.target.id?(t.setAttribute("data-enabled","true"),n.setAttribute("data-enabled","false")):"option-none"==e.target.id?(t.setAttribute("data-enabled","false"),n.setAttribute("data-enabled","false")):(t.setAttribute("data-enabled","false"),n.setAttribute("data-enabled","true"))):r[a].setAttribute("data-enabled","false")}handleImageUpload(e,t){ot.alert("Uploading Image... ",null),this.mm.imageUpload(e,t).then((e=>{"avatarUploaded"==e.type?(ot.alert(e.message,!0),document.getElementById("avatar").src=e.url):(ot.alert(e.message,!0),document.getElementById("background").src=e.url)})).catch((()=>{}))}handlePublished(e){if(this.processing)return;e.preventDefault(),e.stopPropagation();let t=this;this.processing=!0,ot.alert("Publishing site...",null),this.admin.publish({task:"PUBLISH_ALL"}).then((e=>{t.processing=!1,ot.alert(e.message,!0)})).catch((e=>{t.processing=!1,ot.alert(e,!1)}))}handleBackup(e){e.preventDefault(),e.stopPropagation(),ot.alert("Creating backup",null),this.mm.backup().then((e=>{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e,!1)}))}handleReindex(e){if(this.processing)return;let t=this;e.preventDefault(),e.stopPropagation();this.processing=!0,ot.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((e=>{t.processing=!1,ot.alert(e.message,!0)})).catch((e=>{t.processing=!1,ot.alert(e,!1)}))}}class lt{constructor(){}syncMenu(){let e=[],t=document.getElementById("nav-pages").children;for(let n=0;n<t.length;n++)e.push({title:t[n].getElementsByTagName("label")[0].innerHTML,id:t[n].id,slug:t[n].getAttribute("data-slug"),uuid:t[n].getAttribute("data-uuid"),path:t[n].getAttribute("data-path")});let n={menu:e,remove:null};return new Promise((function(e){e(n)}))}removeItem(e){document.getElementById("nav-pages").removeChild(document.getElementById(e))}}
|
|
/**!
|
|
* Sortable 1.14.0
|
|
* @author RubaXa <trash@rubaxa.org>
|
|
* @author owenm <owen23355@gmail.com>
|
|
* @license MIT
|
|
*/function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){gt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ct(e){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pt(){return pt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pt.apply(this,arguments)}function ht(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var ft=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),vt=mt(/Edge/i),bt=mt(/firefox/i),yt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),wt=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function It(e,t,n){e.addEventListener(t,n,!ft&&kt)}function St(e,t,n){e.removeEventListener(t,n,!ft&&kt)}function xt(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function Pt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Tt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&xt(e,t):xt(e,t))||r&&e===n)return e;if(e===n)break}while(e=Pt(e))}return null}var _t,At=/\s+/g;function Dt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(At," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(At," ")}}function Bt(e,t,n){var r=e&&e.style;if(r){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in r||-1!==t.indexOf("webkit")||(t="-webkit-"+t),r[t]=n+("string"==typeof n?"":"px")}}function Lt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Bt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(n)}function Ct(e,t,n){if(e){var r=e.getElementsByTagName(t),a=0,i=r.length;if(n)for(;a<i;a++)n(r[a],a);return r}return[]}function Ot(){var e=document.scrollingElement;return e||document.documentElement}function Mt(e,t,n,r,a){if(e.getBoundingClientRect||e===window){var i,o,s,l,u,d,c;if(e!==window&&e.parentNode&&e!==Ot()?(o=(i=e.getBoundingClientRect()).top,s=i.left,l=i.bottom,u=i.right,d=i.height,c=i.width):(o=0,s=0,l=window.innerHeight,u=window.innerWidth,d=window.innerHeight,c=window.innerWidth),(t||n)&&e!==window&&(a=a||e.parentNode,!ft))do{if(a&&a.getBoundingClientRect&&("none"!==Bt(a,"transform")||n&&"static"!==Bt(a,"position"))){var g=a.getBoundingClientRect();o-=g.top+parseInt(Bt(a,"border-top-width")),s-=g.left+parseInt(Bt(a,"border-left-width")),l=o+i.height,u=s+i.width;break}}while(a=a.parentNode);if(r&&e!==window){var p=Lt(a||e),h=p&&p.a,m=p&&p.d;p&&(l=(o/=m)+(d/=m),u=(s/=h)+(c/=h))}return{top:o,left:s,bottom:l,right:u,width:c,height:d}}}function Nt(e,t,n){for(var r=qt(e,!0),a=Mt(e)[t];r;){var i=Mt(r)[n];if(!("top"===n||"left"===n?a>=i:a<=i))return r;if(r===Ot())break;r=qt(r,!1)}return!1}function Rt(e,t,n,r){for(var a=0,i=0,o=e.children;i<o.length;){if("none"!==o[i].style.display&&o[i]!==$n.ghost&&(r||o[i]!==$n.dragged)&&Tt(o[i],n.draggable,e,!1)){if(a===t)return o[i];a++}i++}return null}function Ut(e,t){for(var n=e.lastElementChild;n&&(n===$n.ghost||"none"===Bt(n,"display")||t&&!xt(n,t));)n=n.previousElementSibling;return n||null}function Ht(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===$n.clone||t&&!xt(e,t)||n++;return n}function Ft(e){var t=0,n=0,r=Ot();if(e)do{var a=Lt(e),i=a.a,o=a.d;t+=e.scrollLeft*i,n+=e.scrollTop*o}while(e!==r&&(e=e.parentNode));return[t,n]}function qt(e,t){if(!e||!e.getBoundingClientRect)return Ot();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var a=Bt(n);if(n.clientWidth<n.scrollWidth&&("auto"==a.overflowX||"scroll"==a.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==a.overflowY||"scroll"==a.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Ot();if(r||t)return n;r=!0}}}while(n=n.parentNode);return Ot()}function Xt(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function jt(e,t){return function(){if(!_t){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),_t=setTimeout((function(){_t=void 0}),t)}}}function Yt(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Wt(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var $t="Sortable"+(new Date).getTime();function zt(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==Bt(e,"display")&&e!==$n.ghost){t.push({target:e,rect:Mt(e)});var n=dt({},t[t.length-1].rect);if(e.thisAnimationDuration){var r=Lt(e,!0);r&&(n.top-=r.f,n.left-=r.e)}e.fromRect=n}}))},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n);return-1}(t,{target:e}),1)},animateAll:function(n){var r=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof n&&n());var a=!1,i=0;t.forEach((function(e){var t=0,n=e.target,o=n.fromRect,s=Mt(n),l=n.prevFromRect,u=n.prevToRect,d=e.rect,c=Lt(n,!0);c&&(s.top-=c.f,s.left-=c.e),n.toRect=s,n.thisAnimationDuration&&Xt(l,s)&&!Xt(o,s)&&(d.top-s.top)/(d.left-s.left)==(o.top-s.top)/(o.left-s.left)&&(t=function(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}(d,l,u,r.options)),Xt(s,o)||(n.prevFromRect=o,n.prevToRect=s,t||(t=r.options.animation),r.animate(n,d,s,t)),t&&(a=!0,i=Math.max(i,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),t),n.thisAnimationDuration=t)})),clearTimeout(e),a?e=setTimeout((function(){"function"==typeof n&&n()}),i):"function"==typeof n&&n(),t=[]},animate:function(e,t,n,r){if(r){Bt(e,"transition",""),Bt(e,"transform","");var a=Lt(this.el),i=a&&a.a,o=a&&a.d,s=(t.left-n.left)/(i||1),l=(t.top-n.top)/(o||1);e.animatingX=!!s,e.animatingY=!!l,Bt(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),Bt(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),Bt(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){Bt(e,"transition",""),Bt(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}}var Gt=[],Qt={initializeByDefault:!0},Vt={mount:function(e){for(var t in Qt)Qt.hasOwnProperty(t)&&!(t in e)&&(e[t]=Qt[t]);Gt.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),Gt.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var a=e+"Global";Gt.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][a]&&t[r.pluginName][a](dt({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](dt({sortable:t},n)))}))},initializePlugins:function(e,t,n,r){for(var a in Gt.forEach((function(r){var a=r.pluginName;if(e.options[a]||r.initializeByDefault){var i=new r(e,t,e.options);i.sortable=e,i.options=e.options,e[a]=i,pt(n,i.defaults)}})),e.options)if(e.options.hasOwnProperty(a)){var i=this.modifyOption(e,a,e.options[a]);void 0!==i&&(e.options[a]=i)}},getEventProperties:function(e,t){var n={};return Gt.forEach((function(r){"function"==typeof r.eventProperties&&pt(n,r.eventProperties.call(t[r.pluginName],e))})),n},modifyOption:function(e,t,n){var r;return Gt.forEach((function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(r=a.optionListeners[t].call(e[a.pluginName],n))})),r}};function Jt(e){var t=e.sortable,n=e.rootEl,r=e.name,a=e.targetEl,i=e.cloneEl,o=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,d=e.oldDraggableIndex,c=e.newDraggableIndex,g=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[$t]){var m,f=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||ft||vt?(m=document.createEvent("Event")).initEvent(r,!0,!0):m=new CustomEvent(r,{bubbles:!0,cancelable:!0}),m.to=o||n,m.from=s||n,m.item=a||n,m.clone=i,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=d,m.newDraggableIndex=c,m.originalEvent=g,m.pullMode=p?p.lastPutMode:void 0;var b=dt(dt({},h),Vt.getEventProperties(r,t));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}var Zt=["evt"],Kt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=ht(n,Zt);Vt.pluginEvent.bind($n)(e,t,dt({dragEl:tn,parentEl:nn,ghostEl:rn,rootEl:an,nextEl:on,lastDownEl:sn,cloneEl:ln,cloneHidden:un,dragStarted:kn,putSortable:mn,activeSortable:$n.active,originalEvent:r,oldIndex:dn,oldDraggableIndex:gn,newIndex:cn,newDraggableIndex:pn,hideGhostForTarget:Xn,unhideGhostForTarget:jn,cloneNowHidden:function(){un=!0},cloneNowShown:function(){un=!1},dispatchSortableEvent:function(e){en({sortable:t,name:e,originalEvent:r})}},a))};function en(e){Jt(dt({putSortable:mn,cloneEl:ln,targetEl:tn,rootEl:an,oldIndex:dn,oldDraggableIndex:gn,newIndex:cn,newDraggableIndex:pn},e))}var tn,nn,rn,an,on,sn,ln,un,dn,cn,gn,pn,hn,mn,fn,vn,bn,yn,En,wn,kn,In,Sn,xn,Pn,Tn=!1,_n=!1,An=[],Dn=!1,Bn=!1,Ln=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Rn=vt||ft?"cssFloat":"float",Un=Mn&&!wt&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(ft)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Bt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),a=Rt(e,0,t),i=Rt(e,1,t),o=a&&Bt(a),s=i&&Bt(i),l=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+Mt(a).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Mt(i).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&o.float&&"none"!==o.float){var d="left"===o.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==d?"horizontal":"vertical"}return a&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||l>=r&&"none"===n[Rn]||i&&"none"===n[Rn]&&l+u>r)?"vertical":"horizontal"},qn=function(e){function t(e,n){return function(r,a,i,o){var s=r.options.group.name&&a.options.group.name&&r.options.group.name===a.options.group.name;if(null==e&&(n||s))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(r,a,i,o),n)(r,a,i,o);var l=(n?r:a).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==ct(r)||(r={name:r}),n.name=r.name,n.checkPull=t(r.pull,!0),n.checkPut=t(r.put),n.revertClone=r.revertClone,e.group=n},Xn=function(){!Hn&&rn&&Bt(rn,"display","none")},jn=function(){!Hn&&rn&&Bt(rn,"display","")};Mn&&document.addEventListener("click",(function(e){if(_n)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),_n=!1,!1}),!0);var Yn=function(e){if(tn){e=e.touches?e.touches[0]:e;var t=(a=e.clientX,i=e.clientY,An.some((function(e){var t=e[$t].options.emptyInsertThreshold;if(t&&!Ut(e)){var n=Mt(e),r=a>=n.left-t&&a<=n.right+t,s=i>=n.top-t&&i<=n.bottom+t;return r&&s?o=e:void 0}})),o);if(t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[$t]._onDragOver(n)}}var a,i,o},Wn=function(e){tn&&tn.parentNode[$t]._isOutsideThisEl(e.target)};function $n(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=pt({},t),e[$t]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fn(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==$n.supportPointer&&"PointerEvent"in window&&!yt,emptyInsertThreshold:5};for(var r in Vt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var a in qn(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&Un,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?It(e,"pointerdown",this._onTapStart):(It(e,"mousedown",this._onTapStart),It(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(It(e,"dragover",this),It(e,"dragenter",this)),An.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),pt(this,zt())}function zn(e,t,n,r,a,i,o,s){var l,u,d=e[$t],c=d.options.onMove;return!window.CustomEvent||ft||vt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=a||t,l.relatedRect=i||Mt(t),l.willInsertAfter=s,l.originalEvent=o,e.dispatchEvent(l),c&&(u=c.call(d,l,o)),u}function Gn(e){e.draggable=!1}function Qn(){Cn=!1}function Vn(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function Jn(e){return setTimeout(e,0)}function Zn(e){return clearTimeout(e)}$n.prototype={constructor:$n,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(In=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,tn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,a=r.preventOnFilter,i=e.type,o=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(o||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){On.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&On.push(r)}}(n),!tn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!yt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Tt(s,r.draggable,n,!1))&&s.animated||sn===s)){if(dn=Ht(s),gn=Ht(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return en({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Kt("filter",t,{evt:e}),void(a&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Tt(l,r.trim(),n,!1))return en({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Kt("filter",t,{evt:e}),!0}))))return void(a&&e.cancelable&&e.preventDefault());r.handle&&!Tt(l,r.handle,n,!1)||this._prepareDragStart(e,o,s)}}},_prepareDragStart:function(e,t,n){var r,a=this,i=a.el,o=a.options,s=i.ownerDocument;if(n&&!tn&&n.parentNode===i){var l=Mt(n);if(an=i,nn=(tn=n).parentNode,on=tn.nextSibling,sn=n,hn=o.group,$n.dragged=tn,fn={target:tn,clientX:(t||e).clientX,clientY:(t||e).clientY},En=fn.clientX-l.left,wn=fn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,tn.style["will-change"]="all",r=function(){Kt("delayEnded",a,{evt:e}),$n.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!bt&&a.nativeDraggable&&(tn.draggable=!0),a._triggerDragStart(e,t),en({sortable:a,name:"choose",originalEvent:e}),Dt(tn,o.chosenClass,!0))},o.ignore.split(",").forEach((function(e){Ct(tn,e.trim(),Gn)})),It(s,"dragover",Yn),It(s,"mousemove",Yn),It(s,"touchmove",Yn),It(s,"mouseup",a._onDrop),It(s,"touchend",a._onDrop),It(s,"touchcancel",a._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,tn.draggable=!0),Kt("delayStart",this,{evt:e}),!o.delay||o.delayOnTouchOnly&&!t||this.nativeDraggable&&(vt||ft))r();else{if($n.eventCanceled)return void this._onDrop();It(s,"mouseup",a._disableDelayedDrag),It(s,"touchend",a._disableDelayedDrag),It(s,"touchcancel",a._disableDelayedDrag),It(s,"mousemove",a._delayedDragTouchMoveHandler),It(s,"touchmove",a._delayedDragTouchMoveHandler),o.supportPointer&&It(s,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(r,o.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){tn&&Gn(tn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;St(e,"mouseup",this._disableDelayedDrag),St(e,"touchend",this._disableDelayedDrag),St(e,"touchcancel",this._disableDelayedDrag),St(e,"mousemove",this._delayedDragTouchMoveHandler),St(e,"touchmove",this._delayedDragTouchMoveHandler),St(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?It(document,"pointermove",this._onTouchMove):It(document,t?"touchmove":"mousemove",this._onTouchMove):(It(tn,"dragend",this),It(an,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Tn=!1,an&&tn){Kt("dragStarted",this,{evt:t}),this.nativeDraggable&&It(document,"dragover",Wn);var n=this.options;!e&&Dt(tn,n.dragClass,!1),Dt(tn,n.ghostClass,!0),$n.active=this,e&&this._appendGhost(),en({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(vn){this._lastX=vn.clientX,this._lastY=vn.clientY,Xn();for(var e=document.elementFromPoint(vn.clientX,vn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(vn.clientX,vn.clientY))!==t;)t=e;if(tn.parentNode[$t]._isOutsideThisEl(e),t)do{if(t[$t]){if(t[$t]._onDragOver({clientX:vn.clientX,clientY:vn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);jn()}},_onTouchMove:function(e){if(fn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,a=e.touches?e.touches[0]:e,i=rn&&Lt(rn,!0),o=rn&&i&&i.a,s=rn&&i&&i.d,l=Nn&&Pn&&Ft(Pn),u=(a.clientX-fn.clientX+r.x)/(o||1)+(l?l[0]-Ln[0]:0)/(o||1),d=(a.clientY-fn.clientY+r.y)/(s||1)+(l?l[1]-Ln[1]:0)/(s||1);if(!$n.active&&!Tn){if(n&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(rn){i?(i.e+=u-(bn||0),i.f+=d-(yn||0)):i={a:1,b:0,c:0,d:1,e:u,f:d};var c="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");Bt(rn,"webkitTransform",c),Bt(rn,"mozTransform",c),Bt(rn,"msTransform",c),Bt(rn,"transform",c),bn=u,yn=d,vn=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!rn){var e=this.options.fallbackOnBody?document.body:an,t=Mt(tn,!0,Nn,!0,e),n=this.options;if(Nn){for(Pn=e;"static"===Bt(Pn,"position")&&"none"===Bt(Pn,"transform")&&Pn!==document;)Pn=Pn.parentNode;Pn!==document.body&&Pn!==document.documentElement?(Pn===document&&(Pn=Ot()),t.top+=Pn.scrollTop,t.left+=Pn.scrollLeft):Pn=Ot(),Ln=Ft(Pn)}Dt(rn=tn.cloneNode(!0),n.ghostClass,!1),Dt(rn,n.fallbackClass,!0),Dt(rn,n.dragClass,!0),Bt(rn,"transition",""),Bt(rn,"transform",""),Bt(rn,"box-sizing","border-box"),Bt(rn,"margin",0),Bt(rn,"top",t.top),Bt(rn,"left",t.left),Bt(rn,"width",t.width),Bt(rn,"height",t.height),Bt(rn,"opacity","0.8"),Bt(rn,"position",Nn?"absolute":"fixed"),Bt(rn,"zIndex","100000"),Bt(rn,"pointerEvents","none"),$n.ghost=rn,e.appendChild(rn),Bt(rn,"transform-origin",En/parseInt(rn.style.width)*100+"% "+wn/parseInt(rn.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,a=n.options;Kt("dragStart",this,{evt:e}),$n.eventCanceled?this._onDrop():(Kt("setupClone",this),$n.eventCanceled||((ln=Wt(tn)).draggable=!1,ln.style["will-change"]="",this._hideClone(),Dt(ln,this.options.chosenClass,!1),$n.clone=ln),n.cloneId=Jn((function(){Kt("clone",n),$n.eventCanceled||(n.options.removeCloneOnHide||an.insertBefore(ln,tn),n._hideClone(),en({sortable:n,name:"clone"}))})),!t&&Dt(tn,a.dragClass,!0),t?(_n=!0,n._loopId=setInterval(n._emulateDragOver,50)):(St(document,"mouseup",n._onDrop),St(document,"touchend",n._onDrop),St(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",a.setData&&a.setData.call(n,r,tn)),It(document,"drop",n),Bt(tn,"transform","translateZ(0)")),Tn=!0,n._dragStartId=Jn(n._dragStarted.bind(n,t,e)),It(document,"selectstart",n),kn=!0,yt&&Bt(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,a,i=this.el,o=e.target,s=this.options,l=s.group,u=$n.active,d=hn===l,c=s.sort,g=mn||u,p=this,h=!1;if(!Cn){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),o=Tt(o,s.draggable,i,!0),A("dragOver"),$n.eventCanceled)return h;if(tn.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o)return B(!1);if(_n=!1,u&&!s.disabled&&(d?c||(r=nn!==an):mn===this||(this.lastPutMode=hn.checkPull(this,u,tn,e))&&l.checkPut(this,u,tn,e))){if(a="vertical"===this._getDirection(e,o),t=Mt(tn),A("dragOverValid"),$n.eventCanceled)return h;if(r)return nn=an,D(),this._hideClone(),A("revert"),$n.eventCanceled||(on?an.insertBefore(tn,on):an.appendChild(tn)),B(!0);var m=Ut(i,s.draggable);if(!m||function(e,t,n){var r=Mt(Ut(n.el,n.options.draggable)),a=10;return t?e.clientX>r.right+a||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+a}(e,a,this)&&!m.animated){if(m===tn)return B(!1);if(m&&i===e.target&&(o=m),o&&(n=Mt(o)),!1!==zn(an,i,tn,t,o,n,e,!!o))return D(),i.appendChild(tn),nn=i,L(),B(!0)}else if(m&&function(e,t,n){var r=Mt(Rt(n.el,0,n.options,!0)),a=10;return t?e.clientX<r.left-a||e.clientY<r.top&&e.clientX<r.right:e.clientY<r.top-a||e.clientY<r.bottom&&e.clientX<r.left}(e,a,this)){var f=Rt(i,0,s,!0);if(f===tn)return B(!1);if(n=Mt(o=f),!1!==zn(an,i,tn,t,o,n,e,!1))return D(),i.insertBefore(tn,f),nn=i,L(),B(!0)}else if(o.parentNode===i){n=Mt(o);var v,b,y,E=tn.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,a=n?e.right:e.bottom,i=n?e.width:e.height,o=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===o||a===s||r+i/2===o+l/2}(tn.animated&&tn.toRect||t,o.animated&&o.toRect||n,a),k=a?"top":"left",I=Nt(o,"top","top")||Nt(tn,"top","top"),S=I?I.scrollTop:void 0;if(In!==o&&(b=n[k],Dn=!1,Bn=!w&&s.invertSwap||E),v=function(e,t,n,r,a,i,o,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,d=r?n.top:n.left,c=r?n.bottom:n.right,g=!1;if(!o)if(s&&xn<u*a){if(!Dn&&(1===Sn?l>d+u*i/2:l<c-u*i/2)&&(Dn=!0),Dn)g=!0;else if(1===Sn?l<d+xn:l>c-xn)return-Sn}else if(l>d+u*(1-a)/2&&l<c-u*(1-a)/2)return function(e){return Ht(tn)<Ht(e)?1:-1}(t);if((g=g||o)&&(l<d+u*i/2||l>c-u*i/2))return l>d+u/2?1:-1;return 0}(e,o,n,a,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===o),0!==v){var x=Ht(tn);do{x-=v,y=nn.children[x]}while(y&&("none"===Bt(y,"display")||y===rn))}if(0===v||y===o)return B(!1);In=o,Sn=v;var P=o.nextElementSibling,T=!1,_=zn(an,i,tn,t,o,n,e,T=1===v);if(!1!==_)return 1!==_&&-1!==_||(T=1===_),Cn=!0,setTimeout(Qn,30),D(),T&&!P?i.appendChild(tn):o.parentNode.insertBefore(tn,T?P:o),I&&Yt(I,0,S-I.scrollTop),nn=tn.parentNode,void 0===b||Bn||(xn=Math.abs(b-Mt(o)[k])),L(),B(!0)}if(i.contains(tn))return B(!1)}return!1}function A(s,l){Kt(s,p,dt({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:c,fromSortable:g,target:o,completed:B,onMove:function(n,r){return zn(an,i,tn,t,n,Mt(n),e,r)},changed:L},l))}function D(){A("dragOverAnimationCapture"),p.captureAnimationState(),p!==g&&g.captureAnimationState()}function B(t){return A("dragOverCompleted",{insertion:t}),t&&(d?u._hideClone():u._showClone(p),p!==g&&(Dt(tn,mn?mn.options.ghostClass:u.options.ghostClass,!1),Dt(tn,s.ghostClass,!0)),mn!==p&&p!==$n.active?mn=p:p===$n.active&&mn&&(mn=null),g===p&&(p._ignoreWhileAnimating=o),p.animateAll((function(){A("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(o===tn&&!tn.animated||o===i&&!o.animated)&&(In=null),s.dragoverBubble||e.rootEl||o===document||(tn.parentNode[$t]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function L(){cn=Ht(tn),pn=Ht(tn,s.draggable),en({sortable:p,name:"change",toEl:i,newIndex:cn,newDraggableIndex:pn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){St(document,"mousemove",this._onTouchMove),St(document,"touchmove",this._onTouchMove),St(document,"pointermove",this._onTouchMove),St(document,"dragover",Yn),St(document,"mousemove",Yn),St(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;St(e,"mouseup",this._onDrop),St(e,"touchend",this._onDrop),St(e,"pointerup",this._onDrop),St(e,"touchcancel",this._onDrop),St(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Ht(tn),pn=Ht(tn,n.draggable),Kt("drop",this,{evt:e}),nn=tn&&tn.parentNode,cn=Ht(tn),pn=Ht(tn,n.draggable),$n.eventCanceled||(Tn=!1,Bn=!1,Dn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Zn(this.cloneId),Zn(this._dragStartId),this.nativeDraggable&&(St(document,"drop",this),St(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),yt&&Bt(document.body,"user-select",""),Bt(tn,"transform",""),e&&(kn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),rn&&rn.parentNode&&rn.parentNode.removeChild(rn),(an===nn||mn&&"clone"!==mn.lastPutMode)&&ln&&ln.parentNode&&ln.parentNode.removeChild(ln),tn&&(this.nativeDraggable&&St(tn,"dragend",this),Gn(tn),tn.style["will-change"]="",kn&&!Tn&&Dt(tn,mn?mn.options.ghostClass:this.options.ghostClass,!1),Dt(tn,this.options.chosenClass,!1),en({sortable:this,name:"unchoose",toEl:nn,newIndex:null,newDraggableIndex:null,originalEvent:e}),an!==nn?(cn>=0&&(en({rootEl:nn,name:"add",toEl:nn,fromEl:an,originalEvent:e}),en({sortable:this,name:"remove",toEl:nn,originalEvent:e}),en({rootEl:nn,name:"sort",toEl:nn,fromEl:an,originalEvent:e}),en({sortable:this,name:"sort",toEl:nn,originalEvent:e})),mn&&mn.save()):cn!==dn&&cn>=0&&(en({sortable:this,name:"update",toEl:nn,originalEvent:e}),en({sortable:this,name:"sort",toEl:nn,originalEvent:e})),$n.active&&(null!=cn&&-1!==cn||(cn=dn,pn=gn),en({sortable:this,name:"end",toEl:nn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Kt("nulling",this),an=tn=nn=rn=on=ln=sn=un=fn=vn=kn=cn=pn=dn=gn=In=Sn=mn=hn=$n.dragged=$n.ghost=$n.clone=$n.active=null,On.forEach((function(e){e.checked=!0})),On.length=bn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":tn&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,r=0,a=n.length,i=this.options;r<a;r++)Tt(e=n[r],i.draggable,this.el,!1)&&t.push(e.getAttribute(i.dataIdAttr)||Vn(e));return t},sort:function(e,t){var n={},r=this.el;this.toArray().forEach((function(e,t){var a=r.children[t];Tt(a,this.options.draggable,r,!1)&&(n[e]=a)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(r.removeChild(n[e]),r.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return Tt(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var r=Vt.modifyOption(this,e,t);n[e]=void 0!==r?r:t,"group"===e&&qn(n)},destroy:function(){Kt("destroy",this);var e=this.el;e[$t]=null,St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart),St(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),An.splice(An.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!un){if(Kt("hideClone",this),$n.eventCanceled)return;Bt(ln,"display","none"),this.options.removeCloneOnHide&&ln.parentNode&&ln.parentNode.removeChild(ln),un=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(un){if(Kt("showClone",this),$n.eventCanceled)return;tn.parentNode!=an||this.options.group.revertClone?on?an.insertBefore(ln,on):an.appendChild(ln):an.insertBefore(ln,tn),this.options.group.revertClone&&this.animate(tn,ln),Bt(ln,"display",""),un=!1}}else this._hideClone()}},Mn&&It(document,"touchmove",(function(e){($n.active||Tn)&&e.cancelable&&e.preventDefault()})),$n.utils={on:It,off:St,css:Bt,find:Ct,is:function(e,t){return!!Tt(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:jt,closest:Tt,toggleClass:Dt,clone:Wt,index:Ht,nextTick:Jn,cancelNextTick:Zn,detectDirection:Fn,getChild:Rt},$n.get=function(e){return e[$t]},$n.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&($n.utils=dt(dt({},$n.utils),e.utils)),Vt.mount(e)}))},$n.create=function(e,t){return new $n(e,t)},$n.version="1.14.0";var Kn,er,tr,nr,rr,ar,ir=[],or=!1;function sr(){ir.forEach((function(e){clearInterval(e.pid)})),ir=[]}function lr(){clearInterval(ar)}var ur=jt((function(e,t,n,r){if(t.scroll){var a,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,u=Ot(),d=!1;er!==n&&(er=n,sr(),Kn=t.scroll,a=t.scrollFn,!0===Kn&&(Kn=qt(n,!0)));var c=0,g=Kn;do{var p=g,h=Mt(p),m=h.top,f=h.bottom,v=h.left,b=h.right,y=h.width,E=h.height,w=void 0,k=void 0,I=p.scrollWidth,S=p.scrollHeight,x=Bt(p),P=p.scrollLeft,T=p.scrollTop;p===u?(w=y<I&&("auto"===x.overflowX||"scroll"===x.overflowX||"visible"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY||"visible"===x.overflowY)):(w=y<I&&("auto"===x.overflowX||"scroll"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY));var _=w&&(Math.abs(b-i)<=s&&P+y<I)-(Math.abs(v-i)<=s&&!!P),A=k&&(Math.abs(f-o)<=s&&T+E<S)-(Math.abs(m-o)<=s&&!!T);if(!ir[c])for(var D=0;D<=c;D++)ir[D]||(ir[D]={});ir[c].vx==_&&ir[c].vy==A&&ir[c].el===p||(ir[c].el=p,ir[c].vx=_,ir[c].vy=A,clearInterval(ir[c].pid),0==_&&0==A||(d=!0,ir[c].pid=setInterval(function(){r&&0===this.layer&&$n.active._onTouchMove(rr);var t=ir[this.layer].vy?ir[this.layer].vy*l:0,n=ir[this.layer].vx?ir[this.layer].vx*l:0;"function"==typeof a&&"continue"!==a.call($n.dragged.parentNode[$t],n,t,e,rr,ir[this.layer].el)||Yt(ir[this.layer].el,n,t)}.bind({layer:c}),24))),c++}while(t.bubbleScroll&&g!==u&&(g=qt(g,!1)));or=d}}),30),dr=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,a=e.activeSortable,i=e.dispatchSortableEvent,o=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||a;o();var u=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(u.clientX,u.clientY);s(),l&&!l.el.contains(d)&&(i("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function cr(){}function gr(){}cr.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Rt(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:dr},pt(cr,{pluginName:"revertOnSpill"}),gr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:dr},pt(gr,{pluginName:"removeOnSpill"});$n.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?It(document,"dragover",this._handleAutoScroll):this.options.supportPointer?It(document,"pointermove",this._handleFallbackAutoScroll):t.touches?It(document,"touchmove",this._handleFallbackAutoScroll):It(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?St(document,"dragover",this._handleAutoScroll):(St(document,"pointermove",this._handleFallbackAutoScroll),St(document,"touchmove",this._handleFallbackAutoScroll),St(document,"mousemove",this._handleFallbackAutoScroll)),lr(),sr(),clearTimeout(_t),_t=void 0},nulling:function(){rr=er=Kn=or=ar=tr=nr=null,ir.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,i=document.elementFromPoint(r,a);if(rr=e,t||this.options.forceAutoScrollFallback||vt||ft||yt){ur(e,this.options,i,t);var o=qt(i,!0);!or||ar&&r===tr&&a===nr||(ar&&lr(),ar=setInterval((function(){var i=qt(document.elementFromPoint(r,a),!0);i!==o&&(o=i,sr()),ur(e,n.options,i,t)}),10),tr=r,nr=a)}else{if(!this.options.bubbleScroll||qt(i,!0)===Ot())return void sr();ur(e,this.options,qt(i,!1),!1)}}},pt(e,{pluginName:"scroll",initializeByDefault:!0})}),$n.mount(gr,cr);var pr=$n;const hr=new Ke;class mr{constructor(){this.processing=!1,this.admin=new f(null),this.start()}start(){let e=this;pr.create(document.getElementById("nav-pages"),{onUpdate:()=>{(new lt).syncMenu().then((t=>{hr.alert("Updating Menu",null),e.admin.sync("syncNav",t).then((e=>{e.type,hr.alert(e.message,!0)}))}))}});for(var t=document.querySelectorAll(".nav-btn"),n=0,r=t.length;n<r;n++)t[n].addEventListener("click",(e=>this.handleNavButton(e)),!1)}handleNavButton(e){if(this.processing)return;let t="",n=this;switch(e.target.id){case"remove-item":t=e.target.getAttribute("data-id"),(new lt).removeItem(t),(new lt).syncMenu().then((t=>{t.remove=e.target.getAttribute("data-uuid"),hr.alert("Editing Menu",null),n.processing=!0,n.admin.syncNav(t).then((e=>{n.processing=!1,e.type,hr.alert(e.message,!0)}))}));break;case"edit-item":n.processing=!1,window.location="/dashboard/page/edit/"+e.target.getAttribute("data-id")}}}class fr{constructor(){this.currentDisplay="",this.urlPieces=document.URL.split("/"),this.chooseDisplay(this.urlPieces[4],this.urlPieces[5])}start(){}chooseDisplay(e,t){switch(this.currentDisplay="",e){case"page":this.currentDisplay=new nt(t);break;case"settings":this.currentDisplay=new st;break;case"navigation":this.currentDisplay=new mr}this.start()}}const vr=new class{constructor(){}imgLoad(e){return new Promise((function(t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){200===r.status?t(r.response):n(new Error("Image didn't load successfully; error code:"+r.statusText))},r.onerror=function(){n(new Error("There was a network error."))},r.send()}))}loadImage(e){let t=this;return new Promise((function(n,r){(new Image).crossOrigin="",t.imgLoad(e).then((function(e){var t=window.URL.createObjectURL(e);n(t)}),(function(e){r(e)}))}))}formDataToJSON(e){let t={};return new FormData(e).forEach(((e,n)=>{t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}},br=new Ke;class yr{constructor(){this.processing=!1,this.start()}start(){if(document.getElementById("dash-form")||document.getElementById("dash-init")){var e=document.getElementsByClassName("init-option");for(let t=0;t<e.length;t++)e[t].addEventListener("click",(e=>this.handleOptions(e)));document.getElementById("dash-form")?document.getElementById("login-btn").addEventListener("click",(e=>this.handleLogin(e))):(document.getElementById("init-blog").addEventListener("click",(e=>this.handleSetup(e))),document.getElementById("blog-restore").addEventListener("click",(e=>this.handleRestore(e))))}else document.getElementById("dash-reset")?(document.getElementById("get-secret-btn").addEventListener("click",(e=>this.handleReset(e))),document.getElementById("reset-btn").addEventListener("click",(e=>this.handleReset(e)))):new fr}handleLogin(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=vr.formDataToJSON(document.getElementById("login"));br.alert("Looking, hold up",null);let r=new f;this.processing=!0,r.login(n).then((n=>{t.processing=!1,n.type===I?br.alert(n.message,!1):(br.alert(n.message,!0),e.target.innerHTML=n.message,setTimeout((()=>{window.location="/dashboard"}),500))})).catch((e=>{t.processing=!1,br.alert(e,!1)}))}handleSetup(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=vr.formDataToJSON(document.getElementById("init-form")),r=new k;this.processing=!0,r.create(n).then((e=>{"blogInitLame"===e.type?(t.processing=!1,br.alert(e.message,!1)):(t.processing=!1,br.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),700))})).catch((e=>{t.processing=!1,br.alert(e,!1)}))}handleRestore(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=new k;var r=document.getElementById("init-restore");this.processing=!0,n.restore(r).then((e=>{e.type===I?(t.processing=!1,br.alert(e.message,!1)):(t.processing=!1,br.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1500))})).catch((e=>{t.processing=!1,br.alert(e,!1)}))}handleReset(e){e.stopPropagation(),e.preventDefault();let t=this,n=new k;if("get-secret-btn"==e.target.id){let e={email:document.getElementById("email").value,task:"retrieveSecret"};this.processing=!0,n.secret(e).then((e=>{t.processing=!1,e.secret?(document.getElementById("secret").value=e.secret,br.alert(e.message,!0)):"mailSent"==e.type?br.alert(e.message,!0):br.alert(e.message,!1)})).catch((e=>{t.processing=!1,br.alert(e,!1)}))}else{let e={newPass:document.getElementById("new_password").value,newPassConfirm:document.getElementById("new_password2").value,secret:document.getElementById("secret").value};n.newPass(e).then((e=>{t.processing=!1,"passNotCreated"==e.type?br.alert(e.message,!1):(br.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1e3))})).catch((e=>{t.processing=!1,br.alert(e,!1)}))}}handleOptions(e){e.stopPropagation(),e.preventDefault();let t=document.getElementById("dash-init"),n=document.getElementById("dash-restore");"init-switch-restore"===e.target.id?(t.style.display="none",t.style.visibility="hidden",n.style.display="flex",n.style.visibility="visible"):(t.style.display="flex",t.style.visibility="visible",n.style.display="none",n.style.visibility="hidden")}}document.addEventListener("DOMContentLoaded",(function(){new yr}),!1)})();
|
|
//# sourceMappingURL=Start.js.map
|