From 45fd8be25f9a50d00388cfe4e7cc6e5a4d8f7229 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 17 Jun 2021 13:26:04 -0700 Subject: [PATCH 1/8] reorganized API methods into new files --- public/assets/scripts/dash.min.js | 8 +- src/com/Base.js | 12 +- src/libraries/FipamoAdminAPI.js | 105 ++----- .../{FipamoAPI.js => FipamoContentAPI.js} | 185 +++++-------- src/libraries/FipamoUtilityAPI.js | 258 ++++++++++++++++++ 5 files changed, 363 insertions(+), 205 deletions(-) rename src/libraries/{FipamoAPI.js => FipamoContentAPI.js} (65%) create mode 100644 src/libraries/FipamoUtilityAPI.js diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 9cef926..44a7e5b 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;e(this,t),this.baseURL=null,n&&(this.baseURL=n)}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+d:d,"getAuthStatus",s,u,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"init",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",s,u,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"handleInitRestore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"getSecret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",s,u,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"setNewPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",s,u,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"getPages",value:function(e,t){var n=this;return new Promise((function(e,r){n._request(n.baseURL?n.baseURL+f+"?key="+t:f,p,l).then((function(t){e(t)})).catch((function(e){r(e)}))}))}},{key:"getPage",value:function(e,t){var n=this;return new Promise((function(r,o){n._request(n.baseURL?n.baseURL+h+"/"+e+"?key="+t:h,p,l).then((function(e){r(e)})).catch((function(e){o(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:u,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);t(e)}else{var n=JSON.parse(l.response);a(n)}},"PUT"==n||n==s)switch(r){case u:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case c:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),m=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),v="requestLame",y="postUpdated",b="writingItDown",w="erasingPage",E="savingSettings",I="createBackup",k="downloadBackup",S="uploadProfileImages",T="renderPages",P="reindexPages";new function t(){e(this,t)};var D="POST",x="createNewPage",_="editPage",B="deletePage",A="json",C="x-www-form-urlencoded",O=function(){function t(){var n=this;e(this,t),this.percentComplete=0,this.token=null,this._request("/api/v1/status").then((function(e){"apiUseAuthorized"===e.type&&(n.token=e.token)}))}return n(t,[{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/sync",E,D,A,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:A,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==D)switch(t!==b&&t!==S&&t!==E&&t!==w&&t!==T&&t!==I&&t!==k&&t!==P||l.setRequestHeader("fipamo-access-token",i.token),r){case A:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case C:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),M=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 M).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),L="editorDelete",R="editorUploadImage",H="editorSave",U="editorUpdate";new function t(){e(this,t)};var F=["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"],X=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&F.push("width"),F.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function q(e){return(q="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 Y=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}},j=function(e){return"object"===q(e)&&null!==e},W=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=X(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},z=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):W(e,t)},G=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;j(t)&&(r=t,t=null);var o=Y(r),i=z(e,o);return t||0===t?i.setPos(t):i.getPosition()},Q=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=G(e.textEditor).pos;t.refresh(),G(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case y: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((function(){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 R:var n,r;G(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=G(this.textEditor).pos,this.emitEvent(R);break;case"submit-save":case"edit-save":this.emitEvent(H);break;case"submit-update":case"edit-update":this.emitEvent(U);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(L)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function te(e,t){return e.apply(null,t)}var ne={arr:function(e){return Array.isArray(e)},obj:function(e){return ee(Object.prototype.toString.call(e),"Object")},pth:function(e){return ne.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||ne.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 ne.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 ne.hex(e)||ne.rgb(e)||ne.hsl(e)},key:function(e){return!V.hasOwnProperty(e)&&!J.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function re(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function oe(e,t){var n=re(e),r=K(ne.und(n[0])?1:n[0],.1,100),o=K(ne.und(n[1])?100:n[1],.1,100),i=K(ne.und(n[2])?10:n[2],.1,100),a=K(ne.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Z.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Z.springs[e]=i,i}}function ie(e){return void 0===e&&(e=10),function(t){return Math.ceil(K(t,1e-6,1)*e)*(1/e)}}var ae,se,le=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ue=(ae={linear:function(){return function(e){return e}}},se={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=K(e,1,10),r=K(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){se[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(se).forEach((function(e){var t=se[e];ae["easeIn"+e]=t,ae["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ae["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}},ae["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}}})),ae);function ce(e,t){if(ne.fnc(e))return e;var n=e.split("(")[0],r=ue[n],o=re(e);switch(n){case"spring":return oe(e,t);case"cubicBezier":return te(le,o);case"steps":return te(ie,o);default:return te(r,o)}}function de(e){try{return document.querySelectorAll(e)}catch(e){return}}function fe(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function we(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 Ee(e,t){return ne.fnc(e)?e(t.target,t.id,t.total):e}function Ie(e,t){return e.getAttribute(t)}function ke(e,t,n){if(ge([n,"deg","rad","turn"],we(t)))return t;var r=Z.CSS[t+n];if(!ne.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Z.CSS[t+n]=s,s}function Se(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?ke(e,o,n):o}}function Te(e,t){return ne.dom(e)&&!ne.inp(e)&&(!ne.nil(Ie(e,t))||ne.svg(e)&&e[t])?"attribute":ne.dom(e)&&ge($,t)?"transform":ne.dom(e)&&"transform"!==t&&Se(e,t)?"css":null!=e[t]?"object":void 0}function Pe(e){if(ne.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function De(e,t,n,r){var o=ee(t,"scale")?1:0+function(e){return ee(e,"translate")||"perspective"===e?"px":ee(e,"rotate")||ee(e,"skew")?"deg":void 0}(t),i=Pe(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?ke(e,i,r):i}function xe(e,t,n,r){switch(Te(e,t)){case"transform":return De(e,t,r,n);case"css":return Se(e,t,n);case"attribute":return Ie(e,t);default:return e[t]||0}}function _e(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=we(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Be(e,t){if(ne.col(e))return be(e);if(/\s/g.test(e))return e;var n=we(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Ae(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Ce(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Ae(t,i)),t=i}return r}function Oe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*Ie(e,"r")}(e);case"rect":return function(e){return 2*Ie(e,"width")+2*Ie(e,"height")}(e);case"line":return function(e){return Ae({x:Ie(e,"x1"),y:Ie(e,"y1")},{x:Ie(e,"x2"),y:Ie(e,"y2")})}(e);case"polyline":return Ce(e);case"polygon":return function(e){var t=e.points;return Ce(e)+Ae(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Me(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;ne.svg(t)&&ne.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=Ie(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ne(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 o=Me(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Le(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Be(ne.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:ne.str(e)||t?r.split(n):[]}}function Re(e){return fe(e?he(ne.arr(e)?e.map(pe):pe(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function He(e){var t=Re(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Pe(e)}}}))}function Ue(e,t){var n=me(t);if(/^spring/.test(n.easing)&&(n.duration=oe(n.easing)),ne.arr(e)){var r=e.length;2===r&&!ne.obj(e[0])?e={value:e}:ne.fnc(t.duration)||(n.duration=t.duration/r)}var o=ne.arr(e)?e:[e];return o.map((function(e,n){var r=ne.obj(e)&&!ne.pth(e)?e:{value:e};return ne.und(r.delay)&&(r.delay=n?0:t.delay),ne.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ye(e,n)}))}function Fe(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ye(function(e){for(var t=fe(he(e.map((function(e){return Object.keys(e)}))),(function(e){return ne.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)ne.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Je.suspendWhenDocumentHidden&&(Ve()?e=cancelAnimationFrame(e):(Ge.forEach((function(e){return e._onDocumentVisibility()})),Qe()))})),function(){e||Ve()&&Je.suspendWhenDocumentHidden||!(Ge.length>0)||(e=requestAnimationFrame(t))}}();function Ve(){return!!document&&document.hidden}function Je(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ve(V,e),n=ve(J,e),r=Fe(n,e),o=He(e.targets),i=je(o,r),a=We(i,n),s=ze;return ze++,ye(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Je.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Ye(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Je.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ge.push(l),d(),Qe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ze(Re(e),l)},l.reset(),l.autoplay&&l.play(),l}function $e(e,t){for(var n=t.length;n--;)ge(e,t[n].animatable.target)&&t.splice(n,1)}function Ze(e,t){var n=t.animations,r=t.children;$e(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;$e(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Je.version="3.2.1",Je.speed=1,Je.suspendWhenDocumentHidden=!0,Je.running=Ge,Je.remove=function(e){for(var t=Re(e),n=Ge.length;n--;){Ze(t,Ge[n])}},Je.get=xe,Je.set=Ye,Je.convertPx=ke,Je.path=function(e,t){var n=ne.str(e)?de(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Me(n),totalLength:Oe(n)*(r/100)}}},Je.setDashoffset=function(e){var t=Oe(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?ce(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=ne.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=we(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ge.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;at.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(R,e.url),at.alert("Image Added to Entry",!0)})).catch((function(){at.alert("Uh oh. Image not added",!1)}))}}]),t}();st.uploadFiles=[];var lt=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new st}}}]),t}(),ut=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==h&&t!==d&&t!==c&&t!==g&&t!==f&&t!==p&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"initNew",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"initRestore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(e,t){var n=this;return new Promise((function(r,o){var i,a,s,l,u;if("create-backup"===e)i="/api/v1/backup",a=f,s=T,l=D,u={task:"create_backup"};else{i="/api/v1/backup/restore",a=p,s=T,l=x,u=new FormData;for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return he(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=he(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=pe(W,e),n=pe(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,he(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*p)/p)),h.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,h("begin")), +!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=g&&0!==l.currentTime&&p(0),(v>=m&&l.currentTime!==d||!d)&&p(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,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&&(a(),s(l)))))}return s(l),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=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*ze.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ye.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Qe(Oe(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ge(e,t){for(var n=t.length;n--;)de(e,t[n].animatable.target)&&t.splice(n,1)}function Qe(e,t){var n=t.animations,r=t.children;Ge(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ge(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}ze.version="3.2.1",ze.speed=1,ze.suspendWhenDocumentHidden=!0,ze.running=Ye,ze.remove=function(e){for(var t=Oe(e),n=Ye.length;n--;){Qe(t,Ye[n])}},ze.get=Se,ze.set=Fe,ze.convertPx=be,ze.path=function(e,t){var n=Z.str(e)?se(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Be(n),totalLength:_e(n)*(r/100)}}},ze.setDashoffset=function(e){var t=_e(e);return e.setAttribute("stroke-dasharray",t),t},ze.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=Z.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,p=me(c?e[1]:e)||0,h=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;nt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(O,e.url),nt.alert("Image Added to Entry",!0)})).catch((function(){nt.alert("Uh oh. Image not added",!1)}))}}]),t}();rt.uploadFiles=[];var ot=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}]),t}(),it=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,p=document.getElementById("mg-domain").value,h=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function gt(e){return(gt="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 mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vt(){return(vt=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function wt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Et=wt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),It=wt(/Edge/i),kt=wt(/firefox/i),St=wt(/safari/i)&&!wt(/chrome/i)&&!wt(/android/i),Tt=wt(/iP(ad|od|hone)/i),Pt=wt(/chrome/i)&&wt(/android/i),Dt={capture:!1,passive:!1};function xt(e,t,n){e.addEventListener(t,n,!Et&&Dt)}function _t(e,t,n){e.removeEventListener(t,n,!Et&&Dt)}function Bt(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 At(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Ct(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Bt(e,t):Bt(e,t))||r&&e===n)return e;if(e===n)break}while(e=At(e))}return null}var Ot,Mt=/\s+/g;function Nt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Mt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Mt," ")}}function Lt(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 Rt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Lt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Ht(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Ut())break;r=zt(r,!1)}return!1}function qt(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=bt(n,["evt"]);tn.pluginEvent.bind(Vn)(e,t,yt({dragEl:on,parentEl:an,ghostEl:sn,rootEl:ln,nextEl:un,lastDownEl:cn,cloneEl:dn,cloneHidden:fn,dragStarted:Tn,putSortable:yn,activeSortable:Vn.active,originalEvent:r,oldIndex:hn,oldDraggableIndex:gn,newIndex:pn,newDraggableIndex:mn,hideGhostForTarget:Wn,unhideGhostForTarget:zn,cloneNowHidden:function(){fn=!0},cloneNowShown:function(){fn=!1},dispatchSortableEvent:function(e){rn({sortable:t,name:e,originalEvent:r})}},o))};function rn(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[$t]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||Et||It?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=yt({},p,tn.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(yt({putSortable:yn,cloneEl:dn,targetEl:on,rootEl:ln,oldIndex:hn,oldDraggableIndex:gn,newIndex:pn,newDraggableIndex:mn},e))}var on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Pn,Dn,xn,_n,Bn=!1,An=!1,Cn=[],On=!1,Mn=!1,Nn=[],Ln=!1,Rn=[],Hn="undefined"!=typeof document,Un=Tt,Fn=It||Et?"cssFloat":"float",Xn=Hn&&!Pt&&!Tt&&"draggable"in document.createElement("div"),qn=function(){if(Hn){if(Et)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Yn=function(e,t){var n=Lt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=qt(e,0,t),i=qt(e,1,t),a=o&&Lt(o),s=i&&Lt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ft(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ft(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Fn]||i&&"none"===n[Fn]&&l+u>r)?"vertical":"horizontal"},jn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==gt(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},Wn=function(){!qn&&sn&&Lt(sn,"display","none")},zn=function(){!qn&&sn&&Lt(sn,"display","")};Hn&&document.addEventListener("click",(function(e){if(An)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),An=!1,!1}),!0);var Gn=function(e){if(on){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Cn.some((function(e){if(!Yt(e)){var t=Ft(e),n=e[$t].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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 o,i,a},Qn=function(e){on&&on.parentNode[$t]._isOutsideThisEl(e.target)};function Vn(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=vt({},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 Yn(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!==Vn.supportPointer&&"PointerEvent"in window&&!St,emptyInsertThreshold:5};for(var r in tn.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in jn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Xn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?xt(e,"pointerdown",this._onTapStart):(xt(e,"mousedown",this._onTapStart),xt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(e,"dragover",this),xt(e,"dragenter",this)),Cn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),vt(this,Zt())}function Jn(e,t,n,r,o,i,a,s){var l,u,c=e[$t],d=c.options.onMove;return!window.CustomEvent||Et||It?(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=o||t,l.relatedRect=i||Ft(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function $n(e){e.draggable=!1}function Zn(){Ln=!1}function Kn(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 er(e){return setTimeout(e,0)}function tr(e){return clearTimeout(e)}Vn.prototype={constructor:Vn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Pn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,on):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Rn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Rn.push(r)}}(n),!on&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!St||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Ct(s,r.draggable,n,!1))&&s.animated||cn===s)){if(hn=jt(s),gn=jt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return rn({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),nn("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Ct(l,r.trim(),n,!1))return rn({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),nn("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Ct(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!on&&n.parentNode===i){var l=Ft(n);if(ln=i,an=(on=n).parentNode,un=on.nextSibling,cn=n,vn=a.group,Vn.dragged=on,bn={target:on,clientX:(t||e).clientX,clientY:(t||e).clientY},kn=bn.clientX-l.left,Sn=bn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,on.style["will-change"]="all",r=function(){nn("delayEnded",o,{evt:e}),Vn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!kt&&o.nativeDraggable&&(on.draggable=!0),o._triggerDragStart(e,t),rn({sortable:o,name:"choose",originalEvent:e}),Nt(on,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Ht(on,e.trim(),$n)})),xt(s,"dragover",Gn),xt(s,"mousemove",Gn),xt(s,"touchmove",Gn),xt(s,"mouseup",o._onDrop),xt(s,"touchend",o._onDrop),xt(s,"touchcancel",o._onDrop),kt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,on.draggable=!0),nn("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(It||Et))r();else{if(Vn.eventCanceled)return void this._onDrop();xt(s,"mouseup",o._disableDelayedDrag),xt(s,"touchend",o._disableDelayedDrag),xt(s,"touchcancel",o._disableDelayedDrag),xt(s,"mousemove",o._delayedDragTouchMoveHandler),xt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&xt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){on&&$n(on),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;_t(e,"mouseup",this._disableDelayedDrag),_t(e,"touchend",this._disableDelayedDrag),_t(e,"touchcancel",this._disableDelayedDrag),_t(e,"mousemove",this._delayedDragTouchMoveHandler),_t(e,"touchmove",this._delayedDragTouchMoveHandler),_t(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,t?"touchmove":"mousemove",this._onTouchMove):(xt(on,"dragend",this),xt(ln,"dragstart",this._onDragStart));try{document.selection?er((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Bn=!1,ln&&on){nn("dragStarted",this,{evt:t}),this.nativeDraggable&&xt(document,"dragover",Qn);var n=this.options;!e&&Nt(on,n.dragClass,!1),Nt(on,n.ghostClass,!0),Vn.active=this,e&&this._appendGhost(),rn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(wn){this._lastX=wn.clientX,this._lastY=wn.clientY,Wn();for(var e=document.elementFromPoint(wn.clientX,wn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(wn.clientX,wn.clientY))!==t;)t=e;if(on.parentNode[$t]._isOutsideThisEl(e),t)do{if(t[$t]){if(t[$t]._onDragOver({clientX:wn.clientX,clientY:wn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);zn()}},_onTouchMove:function(e){if(bn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=sn&&Rt(sn,!0),a=sn&&i&&i.a,s=sn&&i&&i.d,l=Un&&_n&&Wt(_n),u=(o.clientX-bn.clientX+r.x)/(a||1)+(l?l[0]-Nn[0]:0)/(a||1),c=(o.clientY-bn.clientY+r.y)/(s||1)+(l?l[1]-Nn[1]:0)/(s||1);if(!Vn.active&&!Bn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===on)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ft(a)),!1!==Jn(ln,i,on,t,a,n,e,!!a))return _(),i.appendChild(on),an=i,A(),B(!0)}else if(a.parentNode===i){n=Ft(a);var m,v,y,b=on.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(on.animated&&on.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Xt(a,"top","top")||Xt(on,"top","top"),k=I?I.scrollTop:void 0;if(Pn!==a&&(v=n[E],On=!1,Mn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&xnc+u*i/2:ld-xn)return-Dn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Mn,Pn===a))){var S=jt(on);do{S-=m,y=an.children[S]}while(y&&("none"===Lt(y,"display")||y===sn))}if(0===m||y===a)return B(!1);Pn=a,Dn=m;var T=a.nextElementSibling,P=!1,D=Jn(ln,i,on,t,a,n,e,P=1===m);if(!1!==D)return 1!==D&&-1!==D||(P=1===D),Ln=!0,setTimeout(Zn,30),_(),P&&!T?i.appendChild(on):a.parentNode.insertBefore(on,P?T:a),I&&Vt(I,0,k-I.scrollTop),an=on.parentNode,void 0===v||Mn||(xn=Math.abs(v-Ft(a)[E])),A(),B(!0)}if(i.contains(on))return B(!1)}return!1}function x(s,l){nn(s,h,yt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Jn(ln,i,on,t,n,Ft(n),e,r)},changed:A},l))}function _(){x("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return x("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Nt(on,yn?yn.options.ghostClass:u.options.ghostClass,!1),Nt(on,s.ghostClass,!0)),yn!==h&&h!==Vn.active?yn=h:h===Vn.active&&yn&&(yn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){x("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===on&&!on.animated||a===i&&!a.animated)&&(Pn=null),s.dragoverBubble||e.rootEl||a===document||(on.parentNode[$t]._isOutsideThisEl(e.target),!t&&Gn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){pn=jt(on),mn=jt(on,s.draggable),rn({sortable:h,name:"change",toEl:i,newIndex:pn,newDraggableIndex:mn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){_t(document,"mousemove",this._onTouchMove),_t(document,"touchmove",this._onTouchMove),_t(document,"pointermove",this._onTouchMove),_t(document,"dragover",Gn),_t(document,"mousemove",Gn),_t(document,"touchmove",Gn)},_offUpEvents:function(){var e=this.el.ownerDocument;_t(e,"mouseup",this._onDrop),_t(e,"touchend",this._onDrop),_t(e,"pointerup",this._onDrop),_t(e,"touchcancel",this._onDrop),_t(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;pn=jt(on),mn=jt(on,n.draggable),nn("drop",this,{evt:e}),an=on&&on.parentNode,pn=jt(on),mn=jt(on,n.draggable),Vn.eventCanceled||(Bn=!1,Mn=!1,On=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),tr(this.cloneId),tr(this._dragStartId),this.nativeDraggable&&(_t(document,"drop",this),_t(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),St&&Lt(document.body,"user-select",""),Lt(on,"transform",""),e&&(Tn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),sn&&sn.parentNode&&sn.parentNode.removeChild(sn),(ln===an||yn&&"clone"!==yn.lastPutMode)&&dn&&dn.parentNode&&dn.parentNode.removeChild(dn),on&&(this.nativeDraggable&&_t(on,"dragend",this),$n(on),on.style["will-change"]="",Tn&&!Bn&&Nt(on,yn?yn.options.ghostClass:this.options.ghostClass,!1),Nt(on,this.options.chosenClass,!1),rn({sortable:this,name:"unchoose",toEl:an,newIndex:null,newDraggableIndex:null,originalEvent:e}),ln!==an?(pn>=0&&(rn({rootEl:an,name:"add",toEl:an,fromEl:ln,originalEvent:e}),rn({sortable:this,name:"remove",toEl:an,originalEvent:e}),rn({rootEl:an,name:"sort",toEl:an,fromEl:ln,originalEvent:e}),rn({sortable:this,name:"sort",toEl:an,originalEvent:e})),yn&&yn.save()):pn!==hn&&pn>=0&&(rn({sortable:this,name:"update",toEl:an,originalEvent:e}),rn({sortable:this,name:"sort",toEl:an,originalEvent:e})),Vn.active&&(null!=pn&&-1!==pn||(pn=hn,mn=gn),rn({sortable:this,name:"end",toEl:an,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){nn("nulling",this),ln=on=an=sn=un=dn=cn=fn=bn=wn=Tn=pn=mn=hn=gn=Pn=Dn=yn=vn=Vn.dragged=Vn.ghost=Vn.clone=Vn.active=null,Rn.forEach((function(e){e.checked=!0})),Rn.length=En=In=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":on&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var vt=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=mt(/Edge/i),bt=mt(/firefox/i),wt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),It=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function St(e,t,n){e.addEventListener(t,n,!vt&&kt)}function Tt(e,t,n){e.removeEventListener(t,n,!vt&&kt)}function Dt(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 xt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Pt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Dt(e,t):Dt(e,t))||r&&e===n)return e;if(e===n)break}while(e=xt(e))}return null}var _t,Bt=/\s+/g;function At(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Bt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Bt," ")}}function Ct(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 Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=qt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=gt(n,["evt"]);$t.pluginEvent.bind(Wn)(e,t,ht({dragEl:en,parentEl:tn,ghostEl:nn,rootEl:rn,nextEl:on,lastDownEl:an,cloneEl:sn,cloneHidden:ln,dragStarted:En,putSortable:hn,activeSortable:Wn.active,originalEvent:r,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn,hideGhostForTarget:Un,unhideGhostForTarget:qn,cloneNowHidden:function(){ln=!0},cloneNowShown:function(){ln=!1},dispatchSortableEvent:function(e){Kt({sortable:t,name:e,originalEvent:r})}},o))};function Kt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[Gt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||vt||yt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=p?p.lastPutMode:void 0;var y=ht({},h,$t.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ht({putSortable:hn,cloneEl:sn,targetEl:en,rootEl:rn,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn},e))}var en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,pn,hn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn=!1,xn=!1,Pn=[],_n=!1,Bn=!1,An=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Ln=yt||vt?"cssFloat":"float",Rn=Mn&&!It&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(vt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ct(o),s=i&&Ct(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Lt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Lt(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Xn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==dt(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},Un=function(){!Hn&&nn&&Ct(nn,"display","none")},qn=function(){!Hn&&nn&&Ct(nn,"display","")};Mn&&document.addEventListener("click",(function(e){if(xn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xn=!1,!1}),!0);var Yn=function(e){if(en){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Pn.some((function(e){if(!Ft(e)){var t=Lt(e),n=e[Gt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Gt]._onDragOver(n)}}var o,i,a},jn=function(e){en&&en.parentNode[Gt]._isOutsideThisEl(e.target)};function Wn(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[Gt]=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!==Wn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in $t.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Rn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?St(e,"pointerdown",this._onTapStart):(St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Pn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),pt(this,Qt())}function zn(e,t,n,r,o,i,a,s){var l,u,c=e[Gt],d=c.options.onMove;return!window.CustomEvent||vt||yt?(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=o||t,l.relatedRect=i||Lt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),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 $n(e){return clearTimeout(e)}Wn.prototype={constructor:Wn,_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,en):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||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),!en&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Pt(s,r.draggable,n,!1))&&s.animated||an===s)){if(un=Xt(s),dn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Kt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Zt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Pt(l,r.trim(),n,!1))return Kt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Zt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Pt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!en&&n.parentNode===i){var l=Lt(n);if(rn=i,tn=(en=n).parentNode,on=en.nextSibling,an=n,pn=a.group,Wn.dragged=en,gn={target:en,clientX:(t||e).clientX,clientY:(t||e).clientY},bn=gn.clientX-l.left,wn=gn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,en.style["will-change"]="all",r=function(){Zt("delayEnded",o,{evt:e}),Wn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!bt&&o.nativeDraggable&&(en.draggable=!0),o._triggerDragStart(e,t),Kt({sortable:o,name:"choose",originalEvent:e}),At(en,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(en,e.trim(),Gn)})),St(s,"dragover",Yn),St(s,"mousemove",Yn),St(s,"touchmove",Yn),St(s,"mouseup",o._onDrop),St(s,"touchend",o._onDrop),St(s,"touchcancel",o._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,en.draggable=!0),Zt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||vt))r();else{if(Wn.eventCanceled)return void this._onDrop();St(s,"mouseup",o._disableDelayedDrag),St(s,"touchend",o._disableDelayedDrag),St(s,"touchcancel",o._disableDelayedDrag),St(s,"mousemove",o._delayedDragTouchMoveHandler),St(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&St(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){en&&Gn(en),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._disableDelayedDrag),Tt(e,"touchend",this._disableDelayedDrag),Tt(e,"touchcancel",this._disableDelayedDrag),Tt(e,"mousemove",this._delayedDragTouchMoveHandler),Tt(e,"touchmove",this._delayedDragTouchMoveHandler),Tt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?St(document,"pointermove",this._onTouchMove):St(document,t?"touchmove":"mousemove",this._onTouchMove):(St(en,"dragend",this),St(rn,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Dn=!1,rn&&en){Zt("dragStarted",this,{evt:t}),this.nativeDraggable&&St(document,"dragover",jn);var n=this.options;!e&&At(en,n.dragClass,!1),At(en,n.ghostClass,!0),Wn.active=this,e&&this._appendGhost(),Kt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(mn){this._lastX=mn.clientX,this._lastY=mn.clientY,Un();for(var e=document.elementFromPoint(mn.clientX,mn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(mn.clientX,mn.clientY))!==t;)t=e;if(en.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:mn.clientX,clientY:mn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);qn()}},_onTouchMove:function(e){if(gn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=nn&&Ot(nn,!0),a=nn&&i&&i.a,s=nn&&i&&i.d,l=Nn&&Tn&&Ut(Tn),u=(o.clientX-gn.clientX+r.x)/(a||1)+(l?l[0]-An[0]:0)/(a||1),c=(o.clientY-gn.clientY+r.y)/(s||1)+(l?l[1]-An[1]:0)/(s||1);if(!Wn.active&&!Dn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===en)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Lt(a)),!1!==zn(rn,i,en,t,a,n,e,!!a))return _(),i.appendChild(en),tn=i,A(),B(!0)}else if(a.parentNode===i){n=Lt(a);var m,v,y,b=en.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(en.animated&&en.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Rt(a,"top","top")||Rt(en,"top","top"),k=I?I.scrollTop:void 0;if(In!==a&&(v=n[E],_n=!1,Bn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Snc+u*i/2:ld-Sn)return-kn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===a))){var S=Xt(en);do{S-=m,y=tn.children[S]}while(y&&("none"===Ct(y,"display")||y===nn))}if(0===m||y===a)return B(!1);In=a,kn=m;var T=a.nextElementSibling,D=!1,x=zn(rn,i,en,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),Cn=!0,setTimeout(Qn,30),_(),D&&!T?i.appendChild(en):a.parentNode.insertBefore(en,D?T:a),I&&Wt(I,0,k-I.scrollTop),tn=en.parentNode,void 0===v||Bn||(Sn=Math.abs(v-Lt(a)[E])),A(),B(!0)}if(i.contains(en))return B(!1)}return!1}function P(s,l){Zt(s,p,ht({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return zn(rn,i,en,t,n,Lt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),p.captureAnimationState(),p!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(p),p!==f&&(At(en,hn?hn.options.ghostClass:u.options.ghostClass,!1),At(en,s.ghostClass,!0)),hn!==p&&p!==Wn.active?hn=p:p===Wn.active&&hn&&(hn=null),f===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){P("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===en&&!en.animated||a===i&&!a.animated)&&(In=null),s.dragoverBubble||e.rootEl||a===document||(en.parentNode[Gt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function A(){cn=Xt(en),fn=Xt(en,s.draggable),Kt({sortable:p,name:"change",toEl:i,newIndex:cn,newDraggableIndex:fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Tt(document,"mousemove",this._onTouchMove),Tt(document,"touchmove",this._onTouchMove),Tt(document,"pointermove",this._onTouchMove),Tt(document,"dragover",Yn),Tt(document,"mousemove",Yn),Tt(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._onDrop),Tt(e,"touchend",this._onDrop),Tt(e,"pointerup",this._onDrop),Tt(e,"touchcancel",this._onDrop),Tt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Xt(en),fn=Xt(en,n.draggable),Zt("drop",this,{evt:e}),tn=en&&en.parentNode,cn=Xt(en),fn=Xt(en,n.draggable),Wn.eventCanceled||(Dn=!1,Bn=!1,_n=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$n(this.cloneId),$n(this._dragStartId),this.nativeDraggable&&(Tt(document,"drop",this),Tt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(en,"transform",""),e&&(En&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),nn&&nn.parentNode&&nn.parentNode.removeChild(nn),(rn===tn||hn&&"clone"!==hn.lastPutMode)&&sn&&sn.parentNode&&sn.parentNode.removeChild(sn),en&&(this.nativeDraggable&&Tt(en,"dragend",this),Gn(en),en.style["will-change"]="",En&&!Dn&&At(en,hn?hn.options.ghostClass:this.options.ghostClass,!1),At(en,this.options.chosenClass,!1),Kt({sortable:this,name:"unchoose",toEl:tn,newIndex:null,newDraggableIndex:null,originalEvent:e}),rn!==tn?(cn>=0&&(Kt({rootEl:tn,name:"add",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"remove",toEl:tn,originalEvent:e}),Kt({rootEl:tn,name:"sort",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),hn&&hn.save()):cn!==un&&cn>=0&&(Kt({sortable:this,name:"update",toEl:tn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),Wn.active&&(null!=cn&&-1!==cn||(cn=un,fn=dn),Kt({sortable:this,name:"end",toEl:tn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Zt("nulling",this),rn=en=tn=nn=on=sn=an=ln=gn=mn=En=cn=fn=un=dn=In=kn=hn=pn=Wn.dragged=Wn.ghost=Wn.clone=Wn.active=null,On.forEach((function(e){e.checked=!0})),On.length=vn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":en&&(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,o=n.length,i=this.options;r { + this._request( + this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN, + AUTH_STATUS, + REQUEST_TYPE_POST, + CONTENT_TYPE_JSON, + data + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } syncSettings(data) { return new Promise((resolve, reject) => { this._request( @@ -61,50 +75,7 @@ export default class APIUtils { }); }); } - imageUpload(type, files) { - return new Promise((resolve, reject) => { - let url = ""; - switch (type) { - case "avatar-upload": - url = API_UPLOAD_AVATAR; - break; - case "background-upload": - url = API_UPLOAD_BACKGROUND; - break; - default: - url = API_IMAGE_UPLOAD; - break; - } - var imageData = new FormData(); - for (var i = 0; i < files.length; i++) { - var file = files[i]; - // Check the file type. - if (!file.type.match("image.*")) { - continue; - } - if (type === "avatar-upload") { - imageData.append("avatar_upload", file, file.name); - } else if (type === "background-upload") { - imageData.append("background_upload", file, file.name); - } else { - imageData.append("post_image", file, file.name); - } - } - this._request( - url, - DataEvent.API_IMAGES_UPLOAD, - REQUEST_TYPE_POST, - CONTENT_TYPE_FORM, - imageData - ) - .then((r) => { - resolve(r); - }) - .catch((err) => { - reject(err); - }); - }); - } + publishSite(data) { return new Promise((resolve, reject) => { this._request( @@ -192,40 +163,6 @@ export default class APIUtils { }); }); } - handleBackup(id, files) { - return new Promise((resolve, reject) => { - var url, event, method, type, data; - - if (id === "create-backup") { - url = API_CREATE_BACKUP; - event = DataEvent.API_BACKUP_CREATE; - method = REQUEST_TYPE_POST; - type = CONTENT_TYPE_JSON; - data = { task: "create_backup" }; - } else { - url = API_RESTORE_BACKUP; - event = DataEvent.API_BACKUP_RESTORE; - method = REQUEST_TYPE_POST; - type = CONTENT_TYPE_FORM; - data = new FormData(); - for (var i = 0; i < files.length; i++) { - var file = files[i]; - // Check the file type. - if (!file.type.match("application.zip")) { - continue; - } - data.append("backup_upload", file, file.name); - } - } - this._request(url, event, method, type, data) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } handleReindex(data) { return new Promise((resolve, reject) => { diff --git a/src/libraries/FipamoAPI.js b/src/libraries/FipamoContentAPI.js similarity index 65% rename from src/libraries/FipamoAPI.js rename to src/libraries/FipamoContentAPI.js index 39c808d..1b704c0 100644 --- a/src/libraries/FipamoAPI.js +++ b/src/libraries/FipamoContentAPI.js @@ -3,136 +3,45 @@ export const REQUEST_TYPE_POST = "POST"; export const REQUEST_TYPE_GET = "GET"; export const REQUEST_TYPE_PUT = "PUT"; export const REQUEST_TYPE_DELETE = "DELETE"; + //** POST CONTENT TYPES **// export const CONTENT_TYPE_JSON = "json"; export const CONTENT_TYPE_FORM = "x-www-form-urlencoded"; + //** API URLS **// -export const API_STATUS = "/api/v1/status"; -export const API_INIT = "/api/v1/init"; -export const API_RESTORE = "/api/v1/restore"; -export const API_LOGIN = "/api/v1/login"; export const API_GET_PAGES = "/api/v1/page/published"; +export const API_GET_FEATURED = "/api/v1/page/featured"; +export const API_GET_MENU = "/api/v1/page/menu"; export const API_GET_PAGE = "/api/v1/page/single"; -export const API_GET_SECRET = "/api/v1/get-secret"; -export const API_RESET_PASS = "/api/v1/reset-password"; +export const API_GET_TAGS = "/api/v1/page/tags"; + //** API TASKS **// -export const AUTH_STATUS = "getAuthStatus"; -export const TASK_SITE_INIT = "blogInit"; -export const TASK_BACKUP_RESTORE = "downloadBackup"; -export const TASK_GET_SECRET = "retrieveSecret"; -export const TASK_RESET_PASS = "resetPassword"; export const TASK_GET_CONTENT = "retrieveContent"; +/** + * FipamoContentAPI + */ export default class FipamoAPI { //-------------------------- // constructor //-------------------------- - constructor(baseURL = null) { + + /** + * @constructor + * @param {string} baseURL - url of site + * @param {string} key - user api key + */ + constructor(baseURL = null, key = null) { this.baseURL = null; - if (baseURL) { - this.baseURL = baseURL; - } + this.key = null; + if (key) this.key = key; + if (baseURL) this.baseURL = baseURL; } //-------------------------- // methods //-------------------------- - //** MEMBER AUTH METHODS **// - login(data) { - return new Promise((resolve, reject) => { - this._request( - this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN, - AUTH_STATUS, - REQUEST_TYPE_POST, - CONTENT_TYPE_JSON, - data - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - init(data) { - return new Promise((resolve, reject) => { - this._request( - API_INIT, - TASK_SITE_INIT, - REQUEST_TYPE_POST, - CONTENT_TYPE_JSON, - data - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - handleInitRestore(form) { - return new Promise((resolve, reject) => { - var url, event, method, type, data; - - url = API_RESTORE; - event = TASK_BACKUP_RESTORE; - method = REQUEST_TYPE_POST; - type = CONTENT_TYPE_FORM; - data = new FormData(form); - this._request(url, event, method, type, data) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - getSecret(data) { - return new Promise((resolve, reject) => { - this._request( - API_GET_SECRET, - TASK_GET_SECRET, - REQUEST_TYPE_POST, - CONTENT_TYPE_JSON, - data - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - setNewPass(data) { - return new Promise((resolve, reject) => { - this._request( - API_RESET_PASS, - TASK_RESET_PASS, - REQUEST_TYPE_POST, - CONTENT_TYPE_JSON, - data - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - //** CONTENT API METHODS **// - - getPages(num, key) { - let pageNum = num; - if (pageNum === null || pageNum === "" || !pageNum) pageNum = 1; + getPages(key) { return new Promise((resolve, reject) => { this._request( this.baseURL @@ -150,6 +59,60 @@ export default class FipamoAPI { }); } + getFeatured(key) { + return new Promise((resolve, reject) => { + this._request( + this.baseURL + ? this.baseURL + API_GET_FEATURED + "?key=" + key + : API_GET_FEATURED, + TASK_GET_CONTENT, + REQUEST_TYPE_GET + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + getMenu(key) { + return new Promise((resolve, reject) => { + this._request( + this.baseURL + ? this.baseURL + API_GET_MENU + "?key=" + key + : API_GET_MENU, + TASK_GET_CONTENT, + REQUEST_TYPE_GET + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + getTags(key) { + return new Promise((resolve, reject) => { + this._request( + this.baseURL + ? this.baseURL + API_GET_TAGS + "?key=" + key + : API_GET_TAGS, + TASK_GET_CONTENT, + REQUEST_TYPE_GET + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + getPage(id, key) { return new Promise((resolve, reject) => { this._request( diff --git a/src/libraries/FipamoUtilityAPI.js b/src/libraries/FipamoUtilityAPI.js new file mode 100644 index 0000000..41a64e5 --- /dev/null +++ b/src/libraries/FipamoUtilityAPI.js @@ -0,0 +1,258 @@ +//** REQUEST TYPES **// +export const REQUEST_TYPE_POST = "POST"; +export const REQUEST_TYPE_GET = "GET"; +export const REQUEST_TYPE_PUT = "PUT"; +export const REQUEST_TYPE_DELETE = "DELETE"; +//** POST CONTENT TYPES **// +export const CONTENT_TYPE_JSON = "json"; +export const CONTENT_TYPE_FORM = "x-www-form-urlencoded"; +//** API URLS **// +export const API_STATUS = "/api/v1/status"; +export const API_INIT = "/api/v1/init"; +export const API_RESTORE = "/api/v1/restore"; +export const API_GET_SECRET = "/api/v1/get-secret"; +export const API_RESET_PASS = "/api/v1/reset-password"; +export const API_CREATE_BACKUP = "/api/v1/backup"; +export const API_DOWNLOAD_BACKUP = "/api/v1/backup/download"; +export const API_RESTORE_BACKUP = "/api/v1/backup/restore"; +export const API_UPLOAD_AVATAR = "/api/v1/settings/add-avatar"; +export const API_UPLOAD_BACKGROUND = "/api/v1/settings/add-feature-background"; +export const API_IMAGE_UPLOAD = "/api/v1/page/add-entry-image"; +//** API TASKS **// +export const AUTH_STATUS = "getAuthStatus"; +export const TASK_SITE_INIT = "blogInit"; +export const TASK_BACKUP_RESTORE = "downloadBackup"; +export const TASK_GET_SECRET = "retrieveSecret"; +export const TASK_RESET_PASS = "resetPassword"; +export const TASK_GET_CONTENT = "retrieveContent"; + +import * as DataEvent from "../com/events/DataEvent"; + +/** + * FipamoUtilityAPI + */ +export default class FipamoUtilityAPI { + //-------------------------- + // constructor + //-------------------------- + + /** + * @constructor + */ + constructor() {} + //-------------------------- + // methods + //-------------------------- + + //** MEMBER AUTH METHODS **// + + initNew(data) { + return new Promise((resolve, reject) => { + this._request( + API_INIT, + TASK_SITE_INIT, + REQUEST_TYPE_POST, + CONTENT_TYPE_JSON, + data + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + initRestore(form) { + return new Promise((resolve, reject) => { + var url, event, method, type, data; + + url = API_RESTORE; + event = TASK_BACKUP_RESTORE; + method = REQUEST_TYPE_POST; + type = CONTENT_TYPE_FORM; + data = new FormData(form); + this._request(url, event, method, type, data) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + backup(id, files) { + return new Promise((resolve, reject) => { + var url, event, method, type, data; + + if (id === "create-backup") { + url = API_CREATE_BACKUP; + event = DataEvent.API_BACKUP_CREATE; + method = REQUEST_TYPE_POST; + type = CONTENT_TYPE_JSON; + data = { task: "create_backup" }; + } else { + url = API_RESTORE_BACKUP; + event = DataEvent.API_BACKUP_RESTORE; + method = REQUEST_TYPE_POST; + type = CONTENT_TYPE_FORM; + data = new FormData(); + for (var i = 0; i < files.length; i++) { + var file = files[i]; + // Check the file type. + if (!file.type.match("application.zip")) { + continue; + } + data.append("backup_upload", file, file.name); + } + } + this._request(url, event, method, type, data) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + secret(data) { + return new Promise((resolve, reject) => { + this._request( + API_GET_SECRET, + TASK_GET_SECRET, + REQUEST_TYPE_POST, + CONTENT_TYPE_JSON, + data + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + newPass(data) { + return new Promise((resolve, reject) => { + this._request( + API_RESET_PASS, + TASK_RESET_PASS, + REQUEST_TYPE_POST, + CONTENT_TYPE_JSON, + data + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + + imageUpload(type, files) { + return new Promise((resolve, reject) => { + let url = ""; + switch (type) { + case "avatar-upload": + url = API_UPLOAD_AVATAR; + break; + case "background-upload": + url = API_UPLOAD_BACKGROUND; + break; + default: + url = API_IMAGE_UPLOAD; + break; + } + var imageData = new FormData(); + for (var i = 0; i < files.length; i++) { + var file = files[i]; + // Check the file type. + if (!file.type.match("image.*")) { + continue; + } + if (type === "avatar-upload") { + imageData.append("avatar_upload", file, file.name); + } else if (type === "background-upload") { + imageData.append("background_upload", file, file.name); + } else { + imageData.append("post_image", file, file.name); + } + } + this._request( + url, + DataEvent.API_IMAGES_UPLOAD, + REQUEST_TYPE_POST, + CONTENT_TYPE_FORM, + imageData + ) + .then((r) => { + resolve(r); + }) + .catch((err) => { + reject(err); + }); + }); + } + + //-------------------------- + // private + //-------------------------- + _request( + requestURL, + eventType, + requestType = REQUEST_TYPE_GET, + contentType = CONTENT_TYPE_JSON, + requestData = null + ) { + var self = this; + return new Promise(function (resolve, reject) { + var request = new XMLHttpRequest(); + request.upload.onprogress = self.handleLoadProgress; + request.open(requestType, requestURL, true); + request.onload = () => { + if (request.status == 200) { + let response = JSON.parse(request["response"]); + resolve(response); + } else { + let error = JSON.parse(request["response"]); + reject(error); + } + }; + if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) { + switch (contentType) { + case CONTENT_TYPE_JSON: + request.setRequestHeader( + "Content-type", + "application/" + contentType + ); + /** + request.setRequestHeader( + "Access-Control-Allow-Origin", + self.baseURL + ); + **/ + request.send(JSON.stringify(requestData)); + break; + case CONTENT_TYPE_FORM: + request.send(requestData); + break; + } + } else { + request.send(); + } + }); + } + + //-------------------------- + // event handlers + //-------------------------- + handleLoadProgress(e) { + this.percentComplete = Math.ceil((e.loaded / e.total) * 100); + //pass element to display request progress + } +} From 8101b16cf9a2a390a57fd2276253fd133736ff00 Mon Sep 17 00:00:00 2001 From: Ro Date: Mon, 21 Jun 2021 14:36:06 -0700 Subject: [PATCH 2/8] edited method names for Content and Utility API, updated base class --- public/assets/scripts/dash.min.js | 4 +- src/com/Base.js | 8 +- src/libraries/FipamoContentAPI.js | 122 ++- src/libraries/FipamoUtilityAPI.js | 4 +- src/package-lock.json | 1295 +++++++++++++++++++++++++++++ src/package.json | 6 + 6 files changed, 1358 insertions(+), 81 deletions(-) diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 44a7e5b..8e2783c 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,4 +1,4 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==h&&t!==d&&t!==c&&t!==g&&t!==f&&t!==p&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"initNew",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"initRestore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(e,t){var n=this;return new Promise((function(r,o){var i,a,s,l,u;if("create-backup"===e)i="/api/v1/backup",a=f,s=T,l=D,u={task:"create_backup"};else{i="/api/v1/backup/restore",a=p,s=T,l=x,u=new FormData;for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return he(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=he(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=pe(W,e),n=pe(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,he(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*p)/p)),h.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,h("begin")), +!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==h&&t!==d&&t!==c&&t!==g&&t!==f&&t!==p&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(e,t){var n=this;return new Promise((function(r,o){var i,a,s,l,u;if("create-backup"===e)i="/api/v1/backup",a=f,s=T,l=D,u={task:"create_backup"};else{i="/api/v1/backup/restore",a=p,s=T,l=x,u=new FormData;for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return he(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=he(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=pe(W,e),n=pe(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,he(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*p)/p)),h.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,h("begin")), !l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=g&&0!==l.currentTime&&p(0),(v>=m&&l.currentTime!==d||!d)&&p(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,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&&(a(),s(l)))))}return s(l),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=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*ze.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ye.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Qe(Oe(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ge(e,t){for(var n=t.length;n--;)de(e,t[n].animatable.target)&&t.splice(n,1)}function Qe(e,t){var n=t.animations,r=t.children;Ge(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ge(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}ze.version="3.2.1",ze.speed=1,ze.suspendWhenDocumentHidden=!0,ze.running=Ye,ze.remove=function(e){for(var t=Oe(e),n=Ye.length;n--;){Qe(t,Ye[n])}},ze.get=Se,ze.set=Fe,ze.convertPx=be,ze.path=function(e,t){var n=Z.str(e)?se(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Be(n),totalLength:_e(n)*(r/100)}}},ze.setDashoffset=function(e){var t=_e(e);return e.setAttribute("stroke-dasharray",t),t},ze.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=Z.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,p=me(c?e[1]:e)||0,h=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;nt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(O,e.url),nt.alert("Image Added to Entry",!0)})).catch((function(){nt.alert("Uh oh. Image not added",!1)}))}}]),t}();rt.uploadFiles=[];var ot=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}]),t}(),it=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,p=document.getElementById("mg-domain").value,h=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var vt=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=mt(/Edge/i),bt=mt(/firefox/i),wt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),It=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function St(e,t,n){e.addEventListener(t,n,!vt&&kt)}function Tt(e,t,n){e.removeEventListener(t,n,!vt&&kt)}function Dt(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 xt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Pt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Dt(e,t):Dt(e,t))||r&&e===n)return e;if(e===n)break}while(e=xt(e))}return null}var _t,Bt=/\s+/g;function At(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Bt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Bt," ")}}function Ct(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 Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=qt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=gt(n,["evt"]);$t.pluginEvent.bind(Wn)(e,t,ht({dragEl:en,parentEl:tn,ghostEl:nn,rootEl:rn,nextEl:on,lastDownEl:an,cloneEl:sn,cloneHidden:ln,dragStarted:En,putSortable:hn,activeSortable:Wn.active,originalEvent:r,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn,hideGhostForTarget:Un,unhideGhostForTarget:qn,cloneNowHidden:function(){ln=!0},cloneNowShown:function(){ln=!1},dispatchSortableEvent:function(e){Kt({sortable:t,name:e,originalEvent:r})}},o))};function Kt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[Gt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||vt||yt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=p?p.lastPutMode:void 0;var y=ht({},h,$t.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ht({putSortable:hn,cloneEl:sn,targetEl:en,rootEl:rn,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn},e))}var en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,pn,hn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn=!1,xn=!1,Pn=[],_n=!1,Bn=!1,An=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Ln=yt||vt?"cssFloat":"float",Rn=Mn&&!It&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(vt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ct(o),s=i&&Ct(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Lt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Lt(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Xn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==dt(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},Un=function(){!Hn&&nn&&Ct(nn,"display","none")},qn=function(){!Hn&&nn&&Ct(nn,"display","")};Mn&&document.addEventListener("click",(function(e){if(xn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xn=!1,!1}),!0);var Yn=function(e){if(en){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Pn.some((function(e){if(!Ft(e)){var t=Lt(e),n=e[Gt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Gt]._onDragOver(n)}}var o,i,a},jn=function(e){en&&en.parentNode[Gt]._isOutsideThisEl(e.target)};function Wn(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[Gt]=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!==Wn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in $t.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Rn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?St(e,"pointerdown",this._onTapStart):(St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Pn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),pt(this,Qt())}function zn(e,t,n,r,o,i,a,s){var l,u,c=e[Gt],d=c.options.onMove;return!window.CustomEvent||vt||yt?(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=o||t,l.relatedRect=i||Lt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),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 $n(e){return clearTimeout(e)}Wn.prototype={constructor:Wn,_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,en):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||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),!en&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Pt(s,r.draggable,n,!1))&&s.animated||an===s)){if(un=Xt(s),dn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Kt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Zt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Pt(l,r.trim(),n,!1))return Kt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Zt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Pt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!en&&n.parentNode===i){var l=Lt(n);if(rn=i,tn=(en=n).parentNode,on=en.nextSibling,an=n,pn=a.group,Wn.dragged=en,gn={target:en,clientX:(t||e).clientX,clientY:(t||e).clientY},bn=gn.clientX-l.left,wn=gn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,en.style["will-change"]="all",r=function(){Zt("delayEnded",o,{evt:e}),Wn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!bt&&o.nativeDraggable&&(en.draggable=!0),o._triggerDragStart(e,t),Kt({sortable:o,name:"choose",originalEvent:e}),At(en,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(en,e.trim(),Gn)})),St(s,"dragover",Yn),St(s,"mousemove",Yn),St(s,"touchmove",Yn),St(s,"mouseup",o._onDrop),St(s,"touchend",o._onDrop),St(s,"touchcancel",o._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,en.draggable=!0),Zt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||vt))r();else{if(Wn.eventCanceled)return void this._onDrop();St(s,"mouseup",o._disableDelayedDrag),St(s,"touchend",o._disableDelayedDrag),St(s,"touchcancel",o._disableDelayedDrag),St(s,"mousemove",o._delayedDragTouchMoveHandler),St(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&St(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){en&&Gn(en),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._disableDelayedDrag),Tt(e,"touchend",this._disableDelayedDrag),Tt(e,"touchcancel",this._disableDelayedDrag),Tt(e,"mousemove",this._delayedDragTouchMoveHandler),Tt(e,"touchmove",this._delayedDragTouchMoveHandler),Tt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?St(document,"pointermove",this._onTouchMove):St(document,t?"touchmove":"mousemove",this._onTouchMove):(St(en,"dragend",this),St(rn,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Dn=!1,rn&&en){Zt("dragStarted",this,{evt:t}),this.nativeDraggable&&St(document,"dragover",jn);var n=this.options;!e&&At(en,n.dragClass,!1),At(en,n.ghostClass,!0),Wn.active=this,e&&this._appendGhost(),Kt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(mn){this._lastX=mn.clientX,this._lastY=mn.clientY,Un();for(var e=document.elementFromPoint(mn.clientX,mn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(mn.clientX,mn.clientY))!==t;)t=e;if(en.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:mn.clientX,clientY:mn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);qn()}},_onTouchMove:function(e){if(gn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=nn&&Ot(nn,!0),a=nn&&i&&i.a,s=nn&&i&&i.d,l=Nn&&Tn&&Ut(Tn),u=(o.clientX-gn.clientX+r.x)/(a||1)+(l?l[0]-An[0]:0)/(a||1),c=(o.clientY-gn.clientY+r.y)/(s||1)+(l?l[1]-An[1]:0)/(s||1);if(!Wn.active&&!Dn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===en)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Lt(a)),!1!==zn(rn,i,en,t,a,n,e,!!a))return _(),i.appendChild(en),tn=i,A(),B(!0)}else if(a.parentNode===i){n=Lt(a);var m,v,y,b=en.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(en.animated&&en.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Rt(a,"top","top")||Rt(en,"top","top"),k=I?I.scrollTop:void 0;if(In!==a&&(v=n[E],_n=!1,Bn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Snc+u*i/2:ld-Sn)return-kn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===a))){var S=Xt(en);do{S-=m,y=tn.children[S]}while(y&&("none"===Ct(y,"display")||y===nn))}if(0===m||y===a)return B(!1);In=a,kn=m;var T=a.nextElementSibling,D=!1,x=zn(rn,i,en,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),Cn=!0,setTimeout(Qn,30),_(),D&&!T?i.appendChild(en):a.parentNode.insertBefore(en,D?T:a),I&&Wt(I,0,k-I.scrollTop),tn=en.parentNode,void 0===v||Bn||(Sn=Math.abs(v-Lt(a)[E])),A(),B(!0)}if(i.contains(en))return B(!1)}return!1}function P(s,l){Zt(s,p,ht({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return zn(rn,i,en,t,n,Lt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),p.captureAnimationState(),p!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(p),p!==f&&(At(en,hn?hn.options.ghostClass:u.options.ghostClass,!1),At(en,s.ghostClass,!0)),hn!==p&&p!==Wn.active?hn=p:p===Wn.active&&hn&&(hn=null),f===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){P("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===en&&!en.animated||a===i&&!a.animated)&&(In=null),s.dragoverBubble||e.rootEl||a===document||(en.parentNode[Gt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function A(){cn=Xt(en),fn=Xt(en,s.draggable),Kt({sortable:p,name:"change",toEl:i,newIndex:cn,newDraggableIndex:fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Tt(document,"mousemove",this._onTouchMove),Tt(document,"touchmove",this._onTouchMove),Tt(document,"pointermove",this._onTouchMove),Tt(document,"dragover",Yn),Tt(document,"mousemove",Yn),Tt(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._onDrop),Tt(e,"touchend",this._onDrop),Tt(e,"pointerup",this._onDrop),Tt(e,"touchcancel",this._onDrop),Tt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Xt(en),fn=Xt(en,n.draggable),Zt("drop",this,{evt:e}),tn=en&&en.parentNode,cn=Xt(en),fn=Xt(en,n.draggable),Wn.eventCanceled||(Dn=!1,Bn=!1,_n=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$n(this.cloneId),$n(this._dragStartId),this.nativeDraggable&&(Tt(document,"drop",this),Tt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(en,"transform",""),e&&(En&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),nn&&nn.parentNode&&nn.parentNode.removeChild(nn),(rn===tn||hn&&"clone"!==hn.lastPutMode)&&sn&&sn.parentNode&&sn.parentNode.removeChild(sn),en&&(this.nativeDraggable&&Tt(en,"dragend",this),Gn(en),en.style["will-change"]="",En&&!Dn&&At(en,hn?hn.options.ghostClass:this.options.ghostClass,!1),At(en,this.options.chosenClass,!1),Kt({sortable:this,name:"unchoose",toEl:tn,newIndex:null,newDraggableIndex:null,originalEvent:e}),rn!==tn?(cn>=0&&(Kt({rootEl:tn,name:"add",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"remove",toEl:tn,originalEvent:e}),Kt({rootEl:tn,name:"sort",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),hn&&hn.save()):cn!==un&&cn>=0&&(Kt({sortable:this,name:"update",toEl:tn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),Wn.active&&(null!=cn&&-1!==cn||(cn=un,fn=dn),Kt({sortable:this,name:"end",toEl:tn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Zt("nulling",this),rn=en=tn=nn=on=sn=an=ln=gn=mn=En=cn=fn=un=dn=In=kn=hn=pn=Wn.dragged=Wn.ghost=Wn.clone=Wn.active=null,On.forEach((function(e){e.checked=!0})),On.length=vn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":en&&(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,o=n.length,i=this.options;r { if (response.type === DataEvent.API_INIT_LAME) { self.processing = false; @@ -121,7 +121,7 @@ export default class Base { var form = document.getElementById("init-restore"); this.processing = true; api - .handleInitRestore(form) + .restore(form) .then((response) => { if (response.type === DataEvent.REQUEST_LAME) { self.processing = false; @@ -152,7 +152,7 @@ export default class Base { }; this.processing = true; api - .getSecret(data) + .secret(data) .then((response) => { self.processing = false; if (response.secret) { @@ -177,7 +177,7 @@ export default class Base { secret: document.getElementById("secret").value }; api - .setNewPass(data) + .newPass(data) .then((response) => { self.processing = false; if (response.type == "passNotCreated") { diff --git a/src/libraries/FipamoContentAPI.js b/src/libraries/FipamoContentAPI.js index 1b704c0..8c33f56 100644 --- a/src/libraries/FipamoContentAPI.js +++ b/src/libraries/FipamoContentAPI.js @@ -11,24 +11,21 @@ export const CONTENT_TYPE_FORM = "x-www-form-urlencoded"; //** API URLS **// export const API_GET_PAGES = "/api/v1/page/published"; export const API_GET_FEATURED = "/api/v1/page/featured"; -export const API_GET_MENU = "/api/v1/page/menu"; export const API_GET_PAGE = "/api/v1/page/single"; +export const API_GET_MENU = "/api/v1/page/menu"; export const API_GET_TAGS = "/api/v1/page/tags"; //** API TASKS **// export const TASK_GET_CONTENT = "retrieveContent"; /** - * FipamoContentAPI + * Fipamo Content API + * class for retrieving page data from install */ export default class FipamoAPI { - //-------------------------- - // constructor - //-------------------------- - /** * @constructor - * @param {string} baseURL - url of site + * @param {string} baseURL - url of site; uses local when empty * @param {string} key - user api key */ constructor(baseURL = null, key = null) { @@ -41,12 +38,48 @@ export default class FipamoAPI { // methods //-------------------------- - getPages(key) { + /** + * Method for retrieving page data + * @param {string} type - type of pages being retrieved; defaults to published + */ + pages(type = null) { + //set url based on request type + let requestURL = ""; + switch (type) { + default: + case "published": + requestURL = API_GET_PAGES + "?key=" + this.key; + break; + case "featured": + requestURL = API_GET_FEATURED + "?key=" + this.key; + break; + case "menu": + requestURL = API_GET_MENU + "?key=" + this.key; + break; + } + return new Promise((resolve, reject) => { + this._request( + this.baseURL ? this.baseURL + requestURL : requestURL, + TASK_GET_CONTENT + ) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + /** + * Method for retrieving single page + * @param {string} id - uuid of desired page + */ + page(id) { return new Promise((resolve, reject) => { this._request( this.baseURL - ? this.baseURL + API_GET_PAGES + "?key=" + key - : API_GET_PAGES, + ? this.baseURL + API_GET_PAGE + "/" + id + "?key=" + this.key + : API_GET_PAGE + "/" + id + "?key=" + this.key, TASK_GET_CONTENT, REQUEST_TYPE_GET ) @@ -59,12 +92,15 @@ export default class FipamoAPI { }); } - getFeatured(key) { + /** + * Method for retrieving all tags used by pages + */ + tags() { return new Promise((resolve, reject) => { this._request( this.baseURL - ? this.baseURL + API_GET_FEATURED + "?key=" + key - : API_GET_FEATURED, + ? this.baseURL + API_GET_TAGS + "?key=" + this.key + : API_GET_TAGS + "?key=" + this.key, TASK_GET_CONTENT, REQUEST_TYPE_GET ) @@ -77,60 +113,6 @@ export default class FipamoAPI { }); } - getMenu(key) { - return new Promise((resolve, reject) => { - this._request( - this.baseURL - ? this.baseURL + API_GET_MENU + "?key=" + key - : API_GET_MENU, - TASK_GET_CONTENT, - REQUEST_TYPE_GET - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - getTags(key) { - return new Promise((resolve, reject) => { - this._request( - this.baseURL - ? this.baseURL + API_GET_TAGS + "?key=" + key - : API_GET_TAGS, - TASK_GET_CONTENT, - REQUEST_TYPE_GET - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } - - getPage(id, key) { - return new Promise((resolve, reject) => { - this._request( - //API_GET_PAGE + "/" + id + "?key=" + key, - this.baseURL - ? this.baseURL + API_GET_PAGE + "/" + id + "?key=" + key - : API_GET_PAGE, - TASK_GET_CONTENT, - REQUEST_TYPE_GET - ) - .then((result) => { - resolve(result); - }) - .catch((err) => { - reject(err); - }); - }); - } //-------------------------- // private //-------------------------- @@ -162,12 +144,6 @@ export default class FipamoAPI { "Content-type", "application/" + contentType ); - /** - request.setRequestHeader( - "Access-Control-Allow-Origin", - self.baseURL - ); - **/ request.send(JSON.stringify(requestData)); break; case CONTENT_TYPE_FORM: diff --git a/src/libraries/FipamoUtilityAPI.js b/src/libraries/FipamoUtilityAPI.js index 41a64e5..8f8943d 100644 --- a/src/libraries/FipamoUtilityAPI.js +++ b/src/libraries/FipamoUtilityAPI.js @@ -46,7 +46,7 @@ export default class FipamoUtilityAPI { //** MEMBER AUTH METHODS **// - initNew(data) { + create(data) { return new Promise((resolve, reject) => { this._request( API_INIT, @@ -64,7 +64,7 @@ export default class FipamoUtilityAPI { }); } - initRestore(form) { + restore(form) { return new Promise((resolve, reject) => { var url, event, method, type, data; diff --git a/src/package-lock.json b/src/package-lock.json index 348a909..236d761 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -4,25 +4,1320 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/compat-data": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.14.5.tgz", + "integrity": "sha512-kixrYn4JwfAVPa0f2yfzc2AWti6WRRyO3XjWW5PJAvtE11qhSayrrcrEnee05KAtNaPC+EwehE8Qt1UedEVB8w==" + }, + "@babel/core": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.14.6.tgz", + "integrity": "sha512-gJnOEWSqTk96qG5BoIrl5bVtc23DCycmIePPYnamY9RboYdI4nFy5vAQMSl81O5K/W0sLDWfGysnOECC+KUUCA==", + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.14.5", + "@babel/helper-compilation-targets": "^7.14.5", + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helpers": "^7.14.6", + "@babel/parser": "^7.14.6", + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.14.5", + "@babel/types": "^7.14.5", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "requires": { + "@babel/highlight": "^7.14.5" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@babel/eslint-parser": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.14.5.tgz", + "integrity": "sha512-20BlOHuGf3UXS7z1QPyllM9Gz8SEgcp/UcKeUmdHIFZO6HF1n+3KaLpeyfwWvjY/Os/ynPX3k8qXE/nZ5dw/0g==", + "requires": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@babel/generator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.5.tgz", + "integrity": "sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA==", + "requires": { + "@babel/types": "^7.14.5", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.14.5.tgz", + "integrity": "sha512-v+QtZqXEiOnpO6EYvlImB6zCD2Lel06RzOPzmkz/D/XgQiUu3C/Jb1LOqSt/AIA34TYi/Q+KlT8vTQrgdxkbLw==", + "requires": { + "@babel/compat-data": "^7.14.5", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.16.6", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@babel/helper-function-name": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz", + "integrity": "sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ==", + "requires": { + "@babel/helper-get-function-arity": "^7.14.5", + "@babel/template": "^7.14.5", + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz", + "integrity": "sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz", + "integrity": "sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.14.5.tgz", + "integrity": "sha512-UxUeEYPrqH1Q/k0yRku1JE7dyfyehNwT6SVkMHvYvPDv4+uu627VXBckVj891BO8ruKBkiDoGnZf4qPDD8abDQ==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-module-imports": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", + "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-module-transforms": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.14.5.tgz", + "integrity": "sha512-iXpX4KW8LVODuAieD7MzhNjmM6dzYY5tfRqT+R9HDXWl0jPn/djKmA+G9s/2C2T9zggw5tK1QNqZ70USfedOwA==", + "requires": { + "@babel/helper-module-imports": "^7.14.5", + "@babel/helper-replace-supers": "^7.14.5", + "@babel/helper-simple-access": "^7.14.5", + "@babel/helper-split-export-declaration": "^7.14.5", + "@babel/helper-validator-identifier": "^7.14.5", + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.14.5", + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz", + "integrity": "sha512-IqiLIrODUOdnPU9/F8ib1Fx2ohlgDhxnIDU7OEVi+kAbEZcyiF7BLU8W6PfvPi9LzztjS7kcbzbmL7oG8kD6VA==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-replace-supers": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.14.5.tgz", + "integrity": "sha512-3i1Qe9/8x/hCHINujn+iuHy+mMRLoc77b2nI9TB0zjH1hvn9qGlXjWlggdwUcju36PkPCy/lpM7LLUdcTyH4Ow==", + "requires": { + "@babel/helper-member-expression-to-functions": "^7.14.5", + "@babel/helper-optimise-call-expression": "^7.14.5", + "@babel/traverse": "^7.14.5", + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-simple-access": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.5.tgz", + "integrity": "sha512-nfBN9xvmCt6nrMZjfhkl7i0oTV3yxR4/FztsbOASyTvVcoYd0TRHh7eMLdlEcCqobydC0LAF3LtC92Iwxo0wyw==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz", + "integrity": "sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA==", + "requires": { + "@babel/types": "^7.14.5" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz", + "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==" + }, + "@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", + "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==" + }, + "@babel/helpers": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.14.6.tgz", + "integrity": "sha512-yesp1ENQBiLI+iYHSJdoZKUtRpfTlL1grDIX9NRlAVppljLw/4tTyYupIB7uIYmC3stW/imAv8EqaKaS/ibmeA==", + "requires": { + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.14.5", + "@babel/types": "^7.14.5" + } + }, + "@babel/highlight": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "requires": { + "@babel/helper-validator-identifier": "^7.14.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + } + } + }, + "@babel/parser": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.6.tgz", + "integrity": "sha512-oG0ej7efjEXxb4UgE+klVx+3j4MVo+A2vCzm7OUN4CLo6WhQ+vSOD2yJ8m7B+DghObxtLxt3EfgMWpq+AsWehQ==" + }, + "@babel/template": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", + "integrity": "sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g==", + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "requires": { + "@babel/highlight": "^7.14.5" + } + } + } + }, + "@babel/traverse": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.14.5.tgz", + "integrity": "sha512-G3BiS15vevepdmFqmUc9X+64y0viZYygubAMO8SvBmKARuF6CPSZtH4Ng9vi/lrWlZFGe3FWdXNy835akH8Glg==", + "requires": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.14.5", + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-hoist-variables": "^7.14.5", + "@babel/helper-split-export-declaration": "^7.14.5", + "@babel/parser": "^7.14.5", + "@babel/types": "^7.14.5", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "requires": { + "@babel/highlight": "^7.14.5" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + } + } + }, + "@babel/types": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz", + "integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==", + "requires": { + "@babel/helper-validator-identifier": "^7.14.5", + "to-fast-properties": "^2.0.0" + } + }, + "@eslint/eslintrc": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + } + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "animejs": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/animejs/-/animejs-3.2.1.tgz", "integrity": "sha512-sWno3ugFryK5nhiDm/2BKeFCpZv7vzerWUcUPyAZLDhMek3+S/p418ldZJbJXo5ZUOpfm2kP2XRO4NJcULMy9A==" }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browserslist": { + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", + "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "requires": { + "caniuse-lite": "^1.0.30001219", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.723", + "escalade": "^3.1.1", + "node-releases": "^1.1.71" + } + }, "bulma": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.2.tgz", "integrity": "sha512-e14EF+3VSZ488yL/lJH0tR8mFWiEQVCMi/BQUMi2TGMBOk+zrDg4wryuwm/+dRSHJw0gMawp2tsW7X1JYUCE3A==" }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001238", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001238.tgz", + "integrity": "sha512-bZGam2MxEt7YNsa2VwshqWQMwrYs5tR5WZQRYSuFxsBQunWjBuXhN4cS9nV5FFb1Z9y+DoQcQ0COyQbv6A+CKw==" + }, "caret-pos": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz", "integrity": "sha512-cOIiBS1SjzXg+LXSiQAzGg89dHDKq/y4c30+tB5hkVN7GbtXh1BNypOmjti4LwAWQrvP4y+bNG7RJFxLGoL3bA==" }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "electron-to-chromium": { + "version": "1.3.752", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.752.tgz", + "integrity": "sha512-2Tg+7jSl3oPxgsBsWKh5H83QazTkmWG/cnNwJplmyZc7KcN61+I10oUgaXSVk/NwfvN3BdkKDR4FYuRBQQ2v0A==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-plugin-babel": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-babel/-/eslint-plugin-babel-5.3.1.tgz", + "integrity": "sha512-VsQEr6NH3dj664+EyxJwO4FCYm/00JhYb3Sk3ft8o+fpKuIfQ9TaW6uVUfvwMXHcf/lsnRIoyFPsLMyiWCSL/g==", + "dev": true, + "requires": { + "eslint-rule-composer": "^0.3.0" + } + }, + "eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==" + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", + "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "requires": { + "minimist": "^1.2.5" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node-releases": { + "version": "1.1.73", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz", + "integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, "sortablejs": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.13.0.tgz", "integrity": "sha512-RBJirPY0spWCrU5yCmWM1eFs/XgX2J5c6b275/YyxFRgnzPhKl/TDeU2hNR8Dt7ITq66NRPM4UlOt+e5O4CFHg==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz", + "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } } diff --git a/src/package.json b/src/package.json index 9fa74e5..e268aaf 100644 --- a/src/package.json +++ b/src/package.json @@ -8,9 +8,15 @@ "repository": "https://code.playvicio.us/Are0h/Fipamo", "private": true, "dependencies": { + "@babel/core": "^7.14.6", + "@babel/eslint-parser": "^7.14.5", "animejs": "^3.2.1", "bulma": "^0.9.2", "caret-pos": "^2.0.0", "sortablejs": "^1.13.0" + }, + "devDependencies": { + "eslint": "^7.28.0", + "eslint-plugin-babel": "^5.3.1" } } From f7e3b3b55ec613c06c06cce3f44c7e34bf2663b1 Mon Sep 17 00:00:00 2001 From: Ro Date: Tue, 22 Jun 2021 12:13:11 -0700 Subject: [PATCH 3/8] edited and commented methods for Utility API, removed DataEvents class --- public/assets/scripts/dash.min.js | 8 +-- src/libraries/FipamoUtilityAPI.js | 88 +++++++++++++++++-------------- 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 8e2783c..59543a6 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==h&&t!==d&&t!==c&&t!==g&&t!==f&&t!==p&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(e,t){var n=this;return new Promise((function(r,o){var i,a,s,l,u;if("create-backup"===e)i="/api/v1/backup",a=f,s=T,l=D,u={task:"create_backup"};else{i="/api/v1/backup/restore",a=p,s=T,l=x,u=new FormData;for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return he(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=he(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=pe(W,e),n=pe(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,he(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*p)/p)),h.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,h("begin")), -!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=g&&0!==l.currentTime&&p(0),(v>=m&&l.currentTime!==d||!d)&&p(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,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&&(a(),s(l)))))}return s(l),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=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*ze.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ye.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Qe(Oe(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ge(e,t){for(var n=t.length;n--;)de(e,t[n].animatable.target)&&t.splice(n,1)}function Qe(e,t){var n=t.animations,r=t.children;Ge(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ge(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}ze.version="3.2.1",ze.speed=1,ze.suspendWhenDocumentHidden=!0,ze.running=Ye,ze.remove=function(e){for(var t=Oe(e),n=Ye.length;n--;){Qe(t,Ye[n])}},ze.get=Se,ze.set=Fe,ze.convertPx=be,ze.path=function(e,t){var n=Z.str(e)?se(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Be(n),totalLength:_e(n)*(r/100)}}},ze.setDashoffset=function(e){var t=_e(e);return e.setAttribute("stroke-dasharray",t),t},ze.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=Z.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,p=me(c?e[1]:e)||0,h=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;nt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(O,e.url),nt.alert("Image Added to Entry",!0)})).catch((function(){nt.alert("Uh oh. Image not added",!1)}))}}]),t}();rt.uploadFiles=[];var ot=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}]),t}(),it=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,p=document.getElementById("mg-domain").value,h=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==p&&t!==d&&t!==c&&t!==g&&t!==f&&t!==h&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return pe(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=pe(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=he(W,e),n=he(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,pe(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*ze.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ye.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Qe(Oe(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ge(e,t){for(var n=t.length;n--;)de(e,t[n].animatable.target)&&t.splice(n,1)}function Qe(e,t){var n=t.animations,r=t.children;Ge(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ge(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}ze.version="3.2.1",ze.speed=1,ze.suspendWhenDocumentHidden=!0,ze.running=Ye,ze.remove=function(e){for(var t=Oe(e),n=Ye.length;n--;){Qe(t,Ye[n])}},ze.get=Se,ze.set=Fe,ze.convertPx=be,ze.path=function(e,t){var n=Z.str(e)?se(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Be(n),totalLength:_e(n)*(r/100)}}},ze.setDashoffset=function(e){var t=_e(e);return e.setAttribute("stroke-dasharray",t),t},ze.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=Z.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=me(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;nt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(O,e.url),nt.alert("Image Added to Entry",!0)})).catch((function(){nt.alert("Uh oh. Image not added",!1)}))}}]),t}();rt.uploadFiles=[];var ot=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}]),t}(),it=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function dt(e){return(dt="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 ft(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=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var vt=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=mt(/Edge/i),bt=mt(/firefox/i),wt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),It=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function St(e,t,n){e.addEventListener(t,n,!vt&&kt)}function Tt(e,t,n){e.removeEventListener(t,n,!vt&&kt)}function Dt(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 xt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Pt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Dt(e,t):Dt(e,t))||r&&e===n)return e;if(e===n)break}while(e=xt(e))}return null}var _t,Bt=/\s+/g;function At(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Bt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Bt," ")}}function Ct(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 Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=qt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=gt(n,["evt"]);$t.pluginEvent.bind(Wn)(e,t,ht({dragEl:en,parentEl:tn,ghostEl:nn,rootEl:rn,nextEl:on,lastDownEl:an,cloneEl:sn,cloneHidden:ln,dragStarted:En,putSortable:hn,activeSortable:Wn.active,originalEvent:r,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn,hideGhostForTarget:Un,unhideGhostForTarget:qn,cloneNowHidden:function(){ln=!0},cloneNowShown:function(){ln=!1},dispatchSortableEvent:function(e){Kt({sortable:t,name:e,originalEvent:r})}},o))};function Kt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[Gt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||vt||yt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=p?p.lastPutMode:void 0;var y=ht({},h,$t.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ht({putSortable:hn,cloneEl:sn,targetEl:en,rootEl:rn,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn},e))}var en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,pn,hn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn=!1,xn=!1,Pn=[],_n=!1,Bn=!1,An=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Ln=yt||vt?"cssFloat":"float",Rn=Mn&&!It&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(vt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ct(o),s=i&&Ct(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Lt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Lt(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Xn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==dt(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},Un=function(){!Hn&&nn&&Ct(nn,"display","none")},qn=function(){!Hn&&nn&&Ct(nn,"display","")};Mn&&document.addEventListener("click",(function(e){if(xn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xn=!1,!1}),!0);var Yn=function(e){if(en){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Pn.some((function(e){if(!Ft(e)){var t=Lt(e),n=e[Gt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Gt]._onDragOver(n)}}var o,i,a},jn=function(e){en&&en.parentNode[Gt]._isOutsideThisEl(e.target)};function Wn(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[Gt]=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!==Wn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in $t.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Rn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?St(e,"pointerdown",this._onTapStart):(St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Pn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),pt(this,Qt())}function zn(e,t,n,r,o,i,a,s){var l,u,c=e[Gt],d=c.options.onMove;return!window.CustomEvent||vt||yt?(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=o||t,l.relatedRect=i||Lt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),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 $n(e){return clearTimeout(e)}Wn.prototype={constructor:Wn,_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,en):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||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),!en&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Pt(s,r.draggable,n,!1))&&s.animated||an===s)){if(un=Xt(s),dn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Kt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Zt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Pt(l,r.trim(),n,!1))return Kt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Zt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Pt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!en&&n.parentNode===i){var l=Lt(n);if(rn=i,tn=(en=n).parentNode,on=en.nextSibling,an=n,pn=a.group,Wn.dragged=en,gn={target:en,clientX:(t||e).clientX,clientY:(t||e).clientY},bn=gn.clientX-l.left,wn=gn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,en.style["will-change"]="all",r=function(){Zt("delayEnded",o,{evt:e}),Wn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!bt&&o.nativeDraggable&&(en.draggable=!0),o._triggerDragStart(e,t),Kt({sortable:o,name:"choose",originalEvent:e}),At(en,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(en,e.trim(),Gn)})),St(s,"dragover",Yn),St(s,"mousemove",Yn),St(s,"touchmove",Yn),St(s,"mouseup",o._onDrop),St(s,"touchend",o._onDrop),St(s,"touchcancel",o._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,en.draggable=!0),Zt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||vt))r();else{if(Wn.eventCanceled)return void this._onDrop();St(s,"mouseup",o._disableDelayedDrag),St(s,"touchend",o._disableDelayedDrag),St(s,"touchcancel",o._disableDelayedDrag),St(s,"mousemove",o._delayedDragTouchMoveHandler),St(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&St(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){en&&Gn(en),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._disableDelayedDrag),Tt(e,"touchend",this._disableDelayedDrag),Tt(e,"touchcancel",this._disableDelayedDrag),Tt(e,"mousemove",this._delayedDragTouchMoveHandler),Tt(e,"touchmove",this._delayedDragTouchMoveHandler),Tt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?St(document,"pointermove",this._onTouchMove):St(document,t?"touchmove":"mousemove",this._onTouchMove):(St(en,"dragend",this),St(rn,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Dn=!1,rn&&en){Zt("dragStarted",this,{evt:t}),this.nativeDraggable&&St(document,"dragover",jn);var n=this.options;!e&&At(en,n.dragClass,!1),At(en,n.ghostClass,!0),Wn.active=this,e&&this._appendGhost(),Kt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(mn){this._lastX=mn.clientX,this._lastY=mn.clientY,Un();for(var e=document.elementFromPoint(mn.clientX,mn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(mn.clientX,mn.clientY))!==t;)t=e;if(en.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:mn.clientX,clientY:mn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);qn()}},_onTouchMove:function(e){if(gn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=nn&&Ot(nn,!0),a=nn&&i&&i.a,s=nn&&i&&i.d,l=Nn&&Tn&&Ut(Tn),u=(o.clientX-gn.clientX+r.x)/(a||1)+(l?l[0]-An[0]:0)/(a||1),c=(o.clientY-gn.clientY+r.y)/(s||1)+(l?l[1]-An[1]:0)/(s||1);if(!Wn.active&&!Dn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===en)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Lt(a)),!1!==zn(rn,i,en,t,a,n,e,!!a))return _(),i.appendChild(en),tn=i,A(),B(!0)}else if(a.parentNode===i){n=Lt(a);var m,v,y,b=en.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(en.animated&&en.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Rt(a,"top","top")||Rt(en,"top","top"),k=I?I.scrollTop:void 0;if(In!==a&&(v=n[E],_n=!1,Bn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Snc+u*i/2:ld-Sn)return-kn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===a))){var S=Xt(en);do{S-=m,y=tn.children[S]}while(y&&("none"===Ct(y,"display")||y===nn))}if(0===m||y===a)return B(!1);In=a,kn=m;var T=a.nextElementSibling,D=!1,x=zn(rn,i,en,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),Cn=!0,setTimeout(Qn,30),_(),D&&!T?i.appendChild(en):a.parentNode.insertBefore(en,D?T:a),I&&Wt(I,0,k-I.scrollTop),tn=en.parentNode,void 0===v||Bn||(Sn=Math.abs(v-Lt(a)[E])),A(),B(!0)}if(i.contains(en))return B(!1)}return!1}function P(s,l){Zt(s,p,ht({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return zn(rn,i,en,t,n,Lt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),p.captureAnimationState(),p!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(p),p!==f&&(At(en,hn?hn.options.ghostClass:u.options.ghostClass,!1),At(en,s.ghostClass,!0)),hn!==p&&p!==Wn.active?hn=p:p===Wn.active&&hn&&(hn=null),f===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){P("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===en&&!en.animated||a===i&&!a.animated)&&(In=null),s.dragoverBubble||e.rootEl||a===document||(en.parentNode[Gt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function A(){cn=Xt(en),fn=Xt(en,s.draggable),Kt({sortable:p,name:"change",toEl:i,newIndex:cn,newDraggableIndex:fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Tt(document,"mousemove",this._onTouchMove),Tt(document,"touchmove",this._onTouchMove),Tt(document,"pointermove",this._onTouchMove),Tt(document,"dragover",Yn),Tt(document,"mousemove",Yn),Tt(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._onDrop),Tt(e,"touchend",this._onDrop),Tt(e,"pointerup",this._onDrop),Tt(e,"touchcancel",this._onDrop),Tt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Xt(en),fn=Xt(en,n.draggable),Zt("drop",this,{evt:e}),tn=en&&en.parentNode,cn=Xt(en),fn=Xt(en,n.draggable),Wn.eventCanceled||(Dn=!1,Bn=!1,_n=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$n(this.cloneId),$n(this._dragStartId),this.nativeDraggable&&(Tt(document,"drop",this),Tt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(en,"transform",""),e&&(En&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),nn&&nn.parentNode&&nn.parentNode.removeChild(nn),(rn===tn||hn&&"clone"!==hn.lastPutMode)&&sn&&sn.parentNode&&sn.parentNode.removeChild(sn),en&&(this.nativeDraggable&&Tt(en,"dragend",this),Gn(en),en.style["will-change"]="",En&&!Dn&&At(en,hn?hn.options.ghostClass:this.options.ghostClass,!1),At(en,this.options.chosenClass,!1),Kt({sortable:this,name:"unchoose",toEl:tn,newIndex:null,newDraggableIndex:null,originalEvent:e}),rn!==tn?(cn>=0&&(Kt({rootEl:tn,name:"add",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"remove",toEl:tn,originalEvent:e}),Kt({rootEl:tn,name:"sort",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),hn&&hn.save()):cn!==un&&cn>=0&&(Kt({sortable:this,name:"update",toEl:tn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),Wn.active&&(null!=cn&&-1!==cn||(cn=un,fn=dn),Kt({sortable:this,name:"end",toEl:tn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Zt("nulling",this),rn=en=tn=nn=on=sn=an=ln=gn=mn=En=cn=fn=un=dn=In=kn=hn=pn=Wn.dragged=Wn.ghost=Wn.clone=Wn.active=null,On.forEach((function(e){e.checked=!0})),On.length=vn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":en&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var vt=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=mt(/Edge/i),bt=mt(/firefox/i),wt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),It=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function St(e,t,n){e.addEventListener(t,n,!vt&&kt)}function Tt(e,t,n){e.removeEventListener(t,n,!vt&&kt)}function Dt(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 xt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Pt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Dt(e,t):Dt(e,t))||r&&e===n)return e;if(e===n)break}while(e=xt(e))}return null}var _t,Bt=/\s+/g;function At(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Bt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Bt," ")}}function Ct(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 Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=qt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=gt(n,["evt"]);$t.pluginEvent.bind(Wn)(e,t,pt({dragEl:en,parentEl:tn,ghostEl:nn,rootEl:rn,nextEl:on,lastDownEl:an,cloneEl:sn,cloneHidden:ln,dragStarted:En,putSortable:pn,activeSortable:Wn.active,originalEvent:r,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn,hideGhostForTarget:Un,unhideGhostForTarget:qn,cloneNowHidden:function(){ln=!0},cloneNowShown:function(){ln=!1},dispatchSortableEvent:function(e){Kt({sortable:t,name:e,originalEvent:r})}},o))};function Kt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Gt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||vt||yt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=pt({},p,$t.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(pt({putSortable:pn,cloneEl:sn,targetEl:en,rootEl:rn,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn},e))}var en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn=!1,xn=!1,Pn=[],_n=!1,Bn=!1,An=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Ln=yt||vt?"cssFloat":"float",Rn=Mn&&!It&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(vt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ct(o),s=i&&Ct(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Lt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Lt(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Xn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==dt(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},Un=function(){!Hn&&nn&&Ct(nn,"display","none")},qn=function(){!Hn&&nn&&Ct(nn,"display","")};Mn&&document.addEventListener("click",(function(e){if(xn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xn=!1,!1}),!0);var Yn=function(e){if(en){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Pn.some((function(e){if(!Ft(e)){var t=Lt(e),n=e[Gt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Gt]._onDragOver(n)}}var o,i,a},jn=function(e){en&&en.parentNode[Gt]._isOutsideThisEl(e.target)};function Wn(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=ht({},t),e[Gt]=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!==Wn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in $t.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Rn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?St(e,"pointerdown",this._onTapStart):(St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Pn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ht(this,Qt())}function zn(e,t,n,r,o,i,a,s){var l,u,c=e[Gt],d=c.options.onMove;return!window.CustomEvent||vt||yt?(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=o||t,l.relatedRect=i||Lt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),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 $n(e){return clearTimeout(e)}Wn.prototype={constructor:Wn,_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,en):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||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),!en&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Pt(s,r.draggable,n,!1))&&s.animated||an===s)){if(un=Xt(s),dn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Kt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Zt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Pt(l,r.trim(),n,!1))return Kt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Zt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Pt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!en&&n.parentNode===i){var l=Lt(n);if(rn=i,tn=(en=n).parentNode,on=en.nextSibling,an=n,hn=a.group,Wn.dragged=en,gn={target:en,clientX:(t||e).clientX,clientY:(t||e).clientY},bn=gn.clientX-l.left,wn=gn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,en.style["will-change"]="all",r=function(){Zt("delayEnded",o,{evt:e}),Wn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!bt&&o.nativeDraggable&&(en.draggable=!0),o._triggerDragStart(e,t),Kt({sortable:o,name:"choose",originalEvent:e}),At(en,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(en,e.trim(),Gn)})),St(s,"dragover",Yn),St(s,"mousemove",Yn),St(s,"touchmove",Yn),St(s,"mouseup",o._onDrop),St(s,"touchend",o._onDrop),St(s,"touchcancel",o._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,en.draggable=!0),Zt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||vt))r();else{if(Wn.eventCanceled)return void this._onDrop();St(s,"mouseup",o._disableDelayedDrag),St(s,"touchend",o._disableDelayedDrag),St(s,"touchcancel",o._disableDelayedDrag),St(s,"mousemove",o._delayedDragTouchMoveHandler),St(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&St(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){en&&Gn(en),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._disableDelayedDrag),Tt(e,"touchend",this._disableDelayedDrag),Tt(e,"touchcancel",this._disableDelayedDrag),Tt(e,"mousemove",this._delayedDragTouchMoveHandler),Tt(e,"touchmove",this._delayedDragTouchMoveHandler),Tt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?St(document,"pointermove",this._onTouchMove):St(document,t?"touchmove":"mousemove",this._onTouchMove):(St(en,"dragend",this),St(rn,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Dn=!1,rn&&en){Zt("dragStarted",this,{evt:t}),this.nativeDraggable&&St(document,"dragover",jn);var n=this.options;!e&&At(en,n.dragClass,!1),At(en,n.ghostClass,!0),Wn.active=this,e&&this._appendGhost(),Kt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(mn){this._lastX=mn.clientX,this._lastY=mn.clientY,Un();for(var e=document.elementFromPoint(mn.clientX,mn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(mn.clientX,mn.clientY))!==t;)t=e;if(en.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:mn.clientX,clientY:mn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);qn()}},_onTouchMove:function(e){if(gn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=nn&&Ot(nn,!0),a=nn&&i&&i.a,s=nn&&i&&i.d,l=Nn&&Tn&&Ut(Tn),u=(o.clientX-gn.clientX+r.x)/(a||1)+(l?l[0]-An[0]:0)/(a||1),c=(o.clientY-gn.clientY+r.y)/(s||1)+(l?l[1]-An[1]:0)/(s||1);if(!Wn.active&&!Dn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===en)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Lt(a)),!1!==zn(rn,i,en,t,a,n,e,!!a))return _(),i.appendChild(en),tn=i,A(),B(!0)}else if(a.parentNode===i){n=Lt(a);var m,v,y,b=en.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(en.animated&&en.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Rt(a,"top","top")||Rt(en,"top","top"),k=I?I.scrollTop:void 0;if(In!==a&&(v=n[E],_n=!1,Bn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Snc+u*i/2:ld-Sn)return-kn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===a))){var S=Xt(en);do{S-=m,y=tn.children[S]}while(y&&("none"===Ct(y,"display")||y===nn))}if(0===m||y===a)return B(!1);In=a,kn=m;var T=a.nextElementSibling,D=!1,x=zn(rn,i,en,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),Cn=!0,setTimeout(Qn,30),_(),D&&!T?i.appendChild(en):a.parentNode.insertBefore(en,D?T:a),I&&Wt(I,0,k-I.scrollTop),tn=en.parentNode,void 0===v||Bn||(Sn=Math.abs(v-Lt(a)[E])),A(),B(!0)}if(i.contains(en))return B(!1)}return!1}function P(s,l){Zt(s,h,pt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return zn(rn,i,en,t,n,Lt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(At(en,pn?pn.options.ghostClass:u.options.ghostClass,!1),At(en,s.ghostClass,!0)),pn!==h&&h!==Wn.active?pn=h:h===Wn.active&&pn&&(pn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===en&&!en.animated||a===i&&!a.animated)&&(In=null),s.dragoverBubble||e.rootEl||a===document||(en.parentNode[Gt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){cn=Xt(en),fn=Xt(en,s.draggable),Kt({sortable:h,name:"change",toEl:i,newIndex:cn,newDraggableIndex:fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Tt(document,"mousemove",this._onTouchMove),Tt(document,"touchmove",this._onTouchMove),Tt(document,"pointermove",this._onTouchMove),Tt(document,"dragover",Yn),Tt(document,"mousemove",Yn),Tt(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._onDrop),Tt(e,"touchend",this._onDrop),Tt(e,"pointerup",this._onDrop),Tt(e,"touchcancel",this._onDrop),Tt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Xt(en),fn=Xt(en,n.draggable),Zt("drop",this,{evt:e}),tn=en&&en.parentNode,cn=Xt(en),fn=Xt(en,n.draggable),Wn.eventCanceled||(Dn=!1,Bn=!1,_n=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$n(this.cloneId),$n(this._dragStartId),this.nativeDraggable&&(Tt(document,"drop",this),Tt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(en,"transform",""),e&&(En&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),nn&&nn.parentNode&&nn.parentNode.removeChild(nn),(rn===tn||pn&&"clone"!==pn.lastPutMode)&&sn&&sn.parentNode&&sn.parentNode.removeChild(sn),en&&(this.nativeDraggable&&Tt(en,"dragend",this),Gn(en),en.style["will-change"]="",En&&!Dn&&At(en,pn?pn.options.ghostClass:this.options.ghostClass,!1),At(en,this.options.chosenClass,!1),Kt({sortable:this,name:"unchoose",toEl:tn,newIndex:null,newDraggableIndex:null,originalEvent:e}),rn!==tn?(cn>=0&&(Kt({rootEl:tn,name:"add",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"remove",toEl:tn,originalEvent:e}),Kt({rootEl:tn,name:"sort",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),pn&&pn.save()):cn!==un&&cn>=0&&(Kt({sortable:this,name:"update",toEl:tn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),Wn.active&&(null!=cn&&-1!==cn||(cn=un,fn=dn),Kt({sortable:this,name:"end",toEl:tn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Zt("nulling",this),rn=en=tn=nn=on=sn=an=ln=gn=mn=En=cn=fn=un=dn=In=kn=pn=hn=Wn.dragged=Wn.ghost=Wn.clone=Wn.active=null,On.forEach((function(e){e.checked=!0})),On.length=vn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":en&&(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,o=n.length,i=this.options;r { this._request( @@ -63,7 +61,13 @@ export default class FipamoUtilityAPI { }); }); } - + /** + * Method for restoring site from backup + * @param {object} form - form object that contains restore data and files + * @property {string} restore_member_handle - handle for site user + * @property {string} restore_member_pass - password for site user + * @property {file} backup-upload - backup zip file + */ restore(form) { return new Promise((resolve, reject) => { var url, event, method, type, data; @@ -82,32 +86,20 @@ export default class FipamoUtilityAPI { }); }); } + /** + * Method for creating a backup zip + */ - backup(id, files) { + backup() { return new Promise((resolve, reject) => { var url, event, method, type, data; - if (id === "create-backup") { - url = API_CREATE_BACKUP; - event = DataEvent.API_BACKUP_CREATE; - method = REQUEST_TYPE_POST; - type = CONTENT_TYPE_JSON; - data = { task: "create_backup" }; - } else { - url = API_RESTORE_BACKUP; - event = DataEvent.API_BACKUP_RESTORE; - method = REQUEST_TYPE_POST; - type = CONTENT_TYPE_FORM; - data = new FormData(); - for (var i = 0; i < files.length; i++) { - var file = files[i]; - // Check the file type. - if (!file.type.match("application.zip")) { - continue; - } - data.append("backup_upload", file, file.name); - } - } + url = API_CREATE_BACKUP; + event = TASK_BACKUP_CREATE; + method = REQUEST_TYPE_POST; + type = CONTENT_TYPE_JSON; + data = { task: "create_backup" }; + this._request(url, event, method, type, data) .then((result) => { resolve(result); @@ -118,6 +110,12 @@ export default class FipamoUtilityAPI { }); } + /** + * Method for retrieving user secret key + * @param {object} data - json object that contains data for set up + * @property {string} email - email for site user + */ + secret(data) { return new Promise((resolve, reject) => { this._request( @@ -135,6 +133,13 @@ export default class FipamoUtilityAPI { }); }); } + /** + * Method for resetting password for user + * @param {object} data - json object that contains data for set up + * @property {string} new_password - password for user + * @property {string} new_password2 - confirm password for user + * @property {string} secret - secret key for user + */ newPass(data) { return new Promise((resolve, reject) => { @@ -154,6 +159,11 @@ export default class FipamoUtilityAPI { }); } + /** + * Method for uploading images [todo: change to uploading files] + * @param {string} type - type of upload + * @param {input} files - form input containing files + */ imageUpload(type, files) { return new Promise((resolve, reject) => { let url = ""; @@ -185,7 +195,7 @@ export default class FipamoUtilityAPI { } this._request( url, - DataEvent.API_IMAGES_UPLOAD, + TASK_UPLOAD_FILES, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData From e40e56630200244779555aaca33351376ec10525 Mon Sep 17 00:00:00 2001 From: Ro Date: Tue, 22 Jun 2021 13:18:16 -0700 Subject: [PATCH 4/8] edited and commented Admin API, removed DataEvents class --- public/assets/scripts/dash.min.js | 8 +- src/libraries/FipamoAdminAPI.js | 133 +++++++++++++++++++++++------- 2 files changed, 107 insertions(+), 34 deletions(-) diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 59543a6..ba99659 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);a(e)}else{var t=JSON.parse(l.response);s(t)}},"PUT"==n||n==v)switch(t!==u&&t!==p&&t!==d&&t!==c&&t!==g&&t!==f&&t!==h&&t!==m||l.setRequestHeader("fipamo-access-token",i.token),r){case E:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case I:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",D="json",x="x-www-form-urlencoded",P=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",T,D,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case D:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case x:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 B).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),C="editorDelete",O="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var L=["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"],R=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&L.push("width"),L.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},U=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=R(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},q=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):U(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=q(e,o);return t||0===t?i.setPos(t):i.getPosition()},j=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case l: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((function(){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 O:var n,r;Y(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Y(this.textEditor).pos,this.emitEvent(O);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(C)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function $(e,t){return e.apply(null,t)}var Z={arr:function(e){return Array.isArray(e)},obj:function(e){return J(Object.prototype.toString.call(e),"Object")},pth:function(e){return Z.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||Z.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 Z.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 Z.hex(e)||Z.rgb(e)||Z.hsl(e)},key:function(e){return!W.hasOwnProperty(e)&&!z.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function K(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ee(e,t){var n=K(e),r=V(Z.und(n[0])?1:n[0],.1,100),o=V(Z.und(n[1])?100:n[1],.1,100),i=V(Z.und(n[2])?10:n[2],.1,100),a=V(Z.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Q.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Q.springs[e]=i,i}}function te(e){return void 0===e&&(e=10),function(t){return Math.ceil(V(t,1e-6,1)*e)*(1/e)}}var ne,re,oe=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ie=(ne={linear:function(){return function(e){return e}}},re={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=V(e,1,10),r=V(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){re[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(re).forEach((function(e){var t=re[e];ne["easeIn"+e]=t,ne["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},ne["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}},ne["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}}})),ne);function ae(e,t){if(Z.fnc(e))return e;var n=e.split("(")[0],r=ie[n],o=K(e);switch(n){case"spring":return ee(e,t);case"cubicBezier":return $(oe,o);case"steps":return $(te,o);default:return $(r,o)}}function se(e){try{return document.querySelectorAll(e)}catch(e){return}}function le(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 ve(e,t){return Z.fnc(e)?e(t.target,t.id,t.total):e}function ye(e,t){return e.getAttribute(t)}function be(e,t,n){if(de([n,"deg","rad","turn"],me(t)))return t;var r=Q.CSS[t+n];if(!Z.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Q.CSS[t+n]=s,s}function we(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?be(e,o,n):o}}function Ee(e,t){return Z.dom(e)&&!Z.inp(e)&&(!Z.nil(ye(e,t))||Z.svg(e)&&e[t])?"attribute":Z.dom(e)&&de(G,t)?"transform":Z.dom(e)&&"transform"!==t&&we(e,t)?"css":null!=e[t]?"object":void 0}function Ie(e){if(Z.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ke(e,t,n,r){var o=J(t,"scale")?1:0+function(e){return J(e,"translate")||"perspective"===e?"px":J(e,"rotate")||J(e,"skew")?"deg":void 0}(t),i=Ie(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Se(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return we(e,t,n);case"attribute":return ye(e,t);default:return e[t]||0}}function Te(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function De(e,t){if(Z.col(e))return ge(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function xe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Pe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=xe(t,i)),t=i}return r}function _e(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ye(e,"r")}(e);case"rect":return function(e){return 2*ye(e,"width")+2*ye(e,"height")}(e);case"line":return function(e){return xe({x:ye(e,"x1"),y:ye(e,"y1")},{x:ye(e,"x2"),y:ye(e,"y2")})}(e);case"polyline":return Pe(e);case"polygon":return function(e){var t=e.points;return Pe(e)+xe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Be(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Z.svg(t)&&Z.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ye(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Ae(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 o=Be(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Ce(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=De(Z.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Z.str(e)||t?r.split(n):[]}}function Oe(e){return le(e?ue(Z.arr(e)?e.map(ce):ce(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Oe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ie(e)}}}))}function Ne(e,t){var n=fe(t);if(/^spring/.test(n.easing)&&(n.duration=ee(n.easing)),Z.arr(e)){var r=e.length;2===r&&!Z.obj(e[0])?e={value:e}:Z.fnc(t.duration)||(n.duration=t.duration/r)}var o=Z.arr(e)?e:[e];return o.map((function(e,n){var r=Z.obj(e)&&!Z.pth(e)?e:{value:e};return Z.und(r.delay)&&(r.delay=n?0:t.delay),Z.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return pe(e,n)}))}function Le(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=pe(function(e){for(var t=le(ue(e.map((function(e){return Object.keys(e)}))),(function(e){return Z.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)Z.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){ze.suspendWhenDocumentHidden&&(We()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||We()&&ze.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function We(){return!!document&&document.hidden}function ze(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=he(W,e),n=he(z,e),r=Le(n,e),o=Me(e.targets),i=Xe(o,r),a=Ue(i,n),s=qe;return qe++,pe(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/ze.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*ze.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ye.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Qe(Oe(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ge(e,t){for(var n=t.length;n--;)de(e,t[n].animatable.target)&&t.splice(n,1)}function Qe(e,t){var n=t.animations,r=t.children;Ge(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ge(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}ze.version="3.2.1",ze.speed=1,ze.suspendWhenDocumentHidden=!0,ze.running=Ye,ze.remove=function(e){for(var t=Oe(e),n=Ye.length;n--;){Qe(t,Ye[n])}},ze.get=Se,ze.set=Fe,ze.convertPx=be,ze.path=function(e,t){var n=Z.str(e)?se(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Be(n),totalLength:_e(n)*(r/100)}}},ze.setDashoffset=function(e){var t=_e(e);return e.setAttribute("stroke-dasharray",t),t},ze.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=Z.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=me(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;nt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(O,e.url),nt.alert("Image Added to Entry",!0)})).catch((function(){nt.alert("Uh oh. Image not added",!1)}))}}]),t}();rt.uploadFiles=[];var ot=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}]),t}(),it=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var h=new XMLHttpRequest;if(h.upload.onprogress=i.handleLoadProgress,h.open(n,e,!0),h.onload=function(){if(200==h.status){var e=JSON.parse(h.response);a(e)}else{var t=JSON.parse(h.response);c(t)}},"PUT"==n||n==s)switch(t!==d&&t!==p&&t!==g&&t!==f&&t!==m||h.setRequestHeader("fipamo-access-token",i.token),r){case l:h.setRequestHeader("Content-type","application/"+r),h.send(JSON.stringify(o));break;case u:h.send(o)}else h.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),y="POST",b="json",w="x-www-form-urlencoded",E=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==y)switch(r){case b:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case w:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),I=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),k="requestLame",S="postUpdated";new function t(){e(this,t)};var T=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 T).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),D="editorDelete",P="editorUploadImage",_="editorSave",B="editorUpdate";new function t(){e(this,t)};var A=["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"],C=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&A.push("width"),A.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function O(e){return(O="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 M=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}},N=function(e){return"object"===O(e)&&null!==e},L=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=C(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):L(e,t)},H=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;N(t)&&(r=t,t=null);var o=M(r),i=R(e,o);return t||0===t?i.setPos(t):i.getPosition()},F=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=H(e.textEditor).pos;t.refresh(),H(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(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((function(){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 P:var n,r;H(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=H(this.textEditor).pos,this.emitEvent(P);break;case"submit-save":case"edit-save":this.emitEvent(_);break;case"submit-update":case"edit-update":this.emitEvent(B);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(D)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function z(e,t){return e.apply(null,t)}var G={arr:function(e){return Array.isArray(e)},obj:function(e){return W(Object.prototype.toString.call(e),"Object")},pth:function(e){return G.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||G.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 G.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 G.hex(e)||G.rgb(e)||G.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!U.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Q(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function V(e,t){var n=Q(e),r=j(G.und(n[0])?1:n[0],.1,100),o=j(G.und(n[1])?100:n[1],.1,100),i=j(G.und(n[2])?10:n[2],.1,100),a=j(G.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Y.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Y.springs[e]=i,i}}function J(e){return void 0===e&&(e=10),function(t){return Math.ceil(j(t,1e-6,1)*e)*(1/e)}}var $,Z,K=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ee=($={linear:function(){return function(e){return e}}},Z={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=j(e,1,10),r=j(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){Z[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(Z).forEach((function(e){var t=Z[e];$["easeIn"+e]=t,$["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},$["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}},$["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}}})),$);function te(e,t){if(G.fnc(e))return e;var n=e.split("(")[0],r=ee[n],o=Q(e);switch(n){case"spring":return V(e,t);case"cubicBezier":return z(K,o);case"steps":return z(J,o);default:return z(r,o)}}function ne(e){try{return document.querySelectorAll(e)}catch(e){return}}function re(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function de(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 fe(e,t){return G.fnc(e)?e(t.target,t.id,t.total):e}function he(e,t){return e.getAttribute(t)}function pe(e,t,n){if(ae([n,"deg","rad","turn"],de(t)))return t;var r=Y.CSS[t+n];if(!G.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Y.CSS[t+n]=s,s}function ge(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?pe(e,o,n):o}}function me(e,t){return G.dom(e)&&!G.inp(e)&&(!G.nil(he(e,t))||G.svg(e)&&e[t])?"attribute":G.dom(e)&&ae(q,t)?"transform":G.dom(e)&&"transform"!==t&&ge(e,t)?"css":null!=e[t]?"object":void 0}function ve(e){if(G.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ye(e,t,n,r){var o=W(t,"scale")?1:0+function(e){return W(e,"translate")||"perspective"===e?"px":W(e,"rotate")||W(e,"skew")?"deg":void 0}(t),i=ve(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?pe(e,i,r):i}function be(e,t,n,r){switch(me(e,t)){case"transform":return ye(e,t,r,n);case"css":return ge(e,t,n);case"attribute":return he(e,t);default:return e[t]||0}}function we(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=de(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Ee(e,t){if(G.col(e))return ce(e);if(/\s/g.test(e))return e;var n=de(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Ie(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ke(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Ie(t,i)),t=i}return r}function Se(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*he(e,"r")}(e);case"rect":return function(e){return 2*he(e,"width")+2*he(e,"height")}(e);case"line":return function(e){return Ie({x:he(e,"x1"),y:he(e,"y1")},{x:he(e,"x2"),y:he(e,"y2")})}(e);case"polyline":return ke(e);case"polygon":return function(e){var t=e.points;return ke(e)+Ie(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;G.svg(t)&&G.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=he(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function xe(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 o=Te(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function De(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ee(G.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:G.str(e)||t?r.split(n):[]}}function Pe(e){return re(e?oe(G.arr(e)?e.map(ie):ie(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function _e(e){var t=Pe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ve(e)}}}))}function Be(e,t){var n=se(t);if(/^spring/.test(n.easing)&&(n.duration=V(n.easing)),G.arr(e)){var r=e.length;2===r&&!G.obj(e[0])?e={value:e}:G.fnc(t.duration)||(n.duration=t.duration/r)}var o=G.arr(e)?e:[e];return o.map((function(e,n){var r=G.obj(e)&&!G.pth(e)?e:{value:e};return G.und(r.delay)&&(r.delay=n?0:t.delay),G.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ue(e,n)}))}function Ae(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ue(function(e){for(var t=re(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return G.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)G.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ue.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(He.forEach((function(e){return e._onDocumentVisibility()})),Fe()))})),function(){e||Xe()&&Ue.suspendWhenDocumentHidden||!(He.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function Ue(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=le(X,e),n=le(U,e),r=Ae(n,e),o=_e(e.targets),i=Ne(o,r),a=Le(i,n),s=Re;return Re++,ue(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ue.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0, +l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Me(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ue.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,He.push(l),d(),Fe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ye(Pe(e),l)},l.reset(),l.autoplay&&l.play(),l}function qe(e,t){for(var n=t.length;n--;)ae(e,t[n].animatable.target)&&t.splice(n,1)}function Ye(e,t){var n=t.animations,r=t.children;qe(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;qe(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ue.version="3.2.1",Ue.speed=1,Ue.suspendWhenDocumentHidden=!0,Ue.running=He,Ue.remove=function(e){for(var t=Pe(e),n=He.length;n--;){Ye(t,He[n])}},Ue.get=be,Ue.set=Me,Ue.convertPx=pe,Ue.path=function(e,t){var n=G.str(e)?ne(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Te(n),totalLength:Se(n)*(r/100)}}},Ue.setDashoffset=function(e){var t=Se(e);return e.setAttribute("stroke-dasharray",t),t},Ue.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?te(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=G.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=de(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&He.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;$e.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(P,e.url),$e.alert("Image Added to Entry",!0)})).catch((function(){$e.alert("Uh oh. Image not added",!1)}))}}]),t}();Ze.uploadFiles=[];var Ke=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new Ze}}}]),t}(),et=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function dt(e){return(dt="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 ft(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(){return(ht=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var vt=mt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=mt(/Edge/i),bt=mt(/firefox/i),wt=mt(/safari/i)&&!mt(/chrome/i)&&!mt(/android/i),Et=mt(/iP(ad|od|hone)/i),It=mt(/chrome/i)&&mt(/android/i),kt={capture:!1,passive:!1};function St(e,t,n){e.addEventListener(t,n,!vt&&kt)}function Tt(e,t,n){e.removeEventListener(t,n,!vt&&kt)}function Dt(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 xt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Pt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Dt(e,t):Dt(e,t))||r&&e===n)return e;if(e===n)break}while(e=xt(e))}return null}var _t,Bt=/\s+/g;function At(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Bt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Bt," ")}}function Ct(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 Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=qt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=gt(n,["evt"]);$t.pluginEvent.bind(Wn)(e,t,pt({dragEl:en,parentEl:tn,ghostEl:nn,rootEl:rn,nextEl:on,lastDownEl:an,cloneEl:sn,cloneHidden:ln,dragStarted:En,putSortable:pn,activeSortable:Wn.active,originalEvent:r,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn,hideGhostForTarget:Un,unhideGhostForTarget:qn,cloneNowHidden:function(){ln=!0},cloneNowShown:function(){ln=!1},dispatchSortableEvent:function(e){Kt({sortable:t,name:e,originalEvent:r})}},o))};function Kt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Gt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||vt||yt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=pt({},p,$t.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(pt({putSortable:pn,cloneEl:sn,targetEl:en,rootEl:rn,oldIndex:un,oldDraggableIndex:dn,newIndex:cn,newDraggableIndex:fn},e))}var en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn=!1,xn=!1,Pn=[],_n=!1,Bn=!1,An=[],Cn=!1,On=[],Mn="undefined"!=typeof document,Nn=Et,Ln=yt||vt?"cssFloat":"float",Rn=Mn&&!It&&!Et&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(vt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ct(o),s=i&&Ct(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Lt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Lt(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Xn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==dt(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},Un=function(){!Hn&&nn&&Ct(nn,"display","none")},qn=function(){!Hn&&nn&&Ct(nn,"display","")};Mn&&document.addEventListener("click",(function(e){if(xn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),xn=!1,!1}),!0);var Yn=function(e){if(en){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Pn.some((function(e){if(!Ft(e)){var t=Lt(e),n=e[Gt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Gt]._onDragOver(n)}}var o,i,a},jn=function(e){en&&en.parentNode[Gt]._isOutsideThisEl(e.target)};function Wn(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=ht({},t),e[Gt]=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!==Wn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in $t.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Rn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?St(e,"pointerdown",this._onTapStart):(St(e,"mousedown",this._onTapStart),St(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(St(e,"dragover",this),St(e,"dragenter",this)),Pn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ht(this,Qt())}function zn(e,t,n,r,o,i,a,s){var l,u,c=e[Gt],d=c.options.onMove;return!window.CustomEvent||vt||yt?(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=o||t,l.relatedRect=i||Lt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),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 $n(e){return clearTimeout(e)}Wn.prototype={constructor:Wn,_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,en):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||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),!en&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Pt(s,r.draggable,n,!1))&&s.animated||an===s)){if(un=Xt(s),dn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Kt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Zt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Pt(l,r.trim(),n,!1))return Kt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Zt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Pt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!en&&n.parentNode===i){var l=Lt(n);if(rn=i,tn=(en=n).parentNode,on=en.nextSibling,an=n,hn=a.group,Wn.dragged=en,gn={target:en,clientX:(t||e).clientX,clientY:(t||e).clientY},bn=gn.clientX-l.left,wn=gn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,en.style["will-change"]="all",r=function(){Zt("delayEnded",o,{evt:e}),Wn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!bt&&o.nativeDraggable&&(en.draggable=!0),o._triggerDragStart(e,t),Kt({sortable:o,name:"choose",originalEvent:e}),At(en,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(en,e.trim(),Gn)})),St(s,"dragover",Yn),St(s,"mousemove",Yn),St(s,"touchmove",Yn),St(s,"mouseup",o._onDrop),St(s,"touchend",o._onDrop),St(s,"touchcancel",o._onDrop),bt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,en.draggable=!0),Zt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(yt||vt))r();else{if(Wn.eventCanceled)return void this._onDrop();St(s,"mouseup",o._disableDelayedDrag),St(s,"touchend",o._disableDelayedDrag),St(s,"touchcancel",o._disableDelayedDrag),St(s,"mousemove",o._delayedDragTouchMoveHandler),St(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&St(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){en&&Gn(en),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._disableDelayedDrag),Tt(e,"touchend",this._disableDelayedDrag),Tt(e,"touchcancel",this._disableDelayedDrag),Tt(e,"mousemove",this._delayedDragTouchMoveHandler),Tt(e,"touchmove",this._delayedDragTouchMoveHandler),Tt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?St(document,"pointermove",this._onTouchMove):St(document,t?"touchmove":"mousemove",this._onTouchMove):(St(en,"dragend",this),St(rn,"dragstart",this._onDragStart));try{document.selection?Jn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Dn=!1,rn&&en){Zt("dragStarted",this,{evt:t}),this.nativeDraggable&&St(document,"dragover",jn);var n=this.options;!e&&At(en,n.dragClass,!1),At(en,n.ghostClass,!0),Wn.active=this,e&&this._appendGhost(),Kt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(mn){this._lastX=mn.clientX,this._lastY=mn.clientY,Un();for(var e=document.elementFromPoint(mn.clientX,mn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(mn.clientX,mn.clientY))!==t;)t=e;if(en.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:mn.clientX,clientY:mn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);qn()}},_onTouchMove:function(e){if(gn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=nn&&Ot(nn,!0),a=nn&&i&&i.a,s=nn&&i&&i.d,l=Nn&&Tn&&Ut(Tn),u=(o.clientX-gn.clientX+r.x)/(a||1)+(l?l[0]-An[0]:0)/(a||1),c=(o.clientY-gn.clientY+r.y)/(s||1)+(l?l[1]-An[1]:0)/(s||1);if(!Wn.active&&!Dn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===en)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Lt(a)),!1!==zn(rn,i,en,t,a,n,e,!!a))return _(),i.appendChild(en),tn=i,A(),B(!0)}else if(a.parentNode===i){n=Lt(a);var m,v,y,b=en.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(en.animated&&en.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Rt(a,"top","top")||Rt(en,"top","top"),k=I?I.scrollTop:void 0;if(In!==a&&(v=n[E],_n=!1,Bn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Snc+u*i/2:ld-Sn)return-kn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Bn,In===a))){var S=Xt(en);do{S-=m,y=tn.children[S]}while(y&&("none"===Ct(y,"display")||y===nn))}if(0===m||y===a)return B(!1);In=a,kn=m;var T=a.nextElementSibling,D=!1,x=zn(rn,i,en,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),Cn=!0,setTimeout(Qn,30),_(),D&&!T?i.appendChild(en):a.parentNode.insertBefore(en,D?T:a),I&&Wt(I,0,k-I.scrollTop),tn=en.parentNode,void 0===v||Bn||(Sn=Math.abs(v-Lt(a)[E])),A(),B(!0)}if(i.contains(en))return B(!1)}return!1}function P(s,l){Zt(s,h,pt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return zn(rn,i,en,t,n,Lt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(At(en,pn?pn.options.ghostClass:u.options.ghostClass,!1),At(en,s.ghostClass,!0)),pn!==h&&h!==Wn.active?pn=h:h===Wn.active&&pn&&(pn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===en&&!en.animated||a===i&&!a.animated)&&(In=null),s.dragoverBubble||e.rootEl||a===document||(en.parentNode[Gt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){cn=Xt(en),fn=Xt(en,s.draggable),Kt({sortable:h,name:"change",toEl:i,newIndex:cn,newDraggableIndex:fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Tt(document,"mousemove",this._onTouchMove),Tt(document,"touchmove",this._onTouchMove),Tt(document,"pointermove",this._onTouchMove),Tt(document,"dragover",Yn),Tt(document,"mousemove",Yn),Tt(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;Tt(e,"mouseup",this._onDrop),Tt(e,"touchend",this._onDrop),Tt(e,"pointerup",this._onDrop),Tt(e,"touchcancel",this._onDrop),Tt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;cn=Xt(en),fn=Xt(en,n.draggable),Zt("drop",this,{evt:e}),tn=en&&en.parentNode,cn=Xt(en),fn=Xt(en,n.draggable),Wn.eventCanceled||(Dn=!1,Bn=!1,_n=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),$n(this.cloneId),$n(this._dragStartId),this.nativeDraggable&&(Tt(document,"drop",this),Tt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(en,"transform",""),e&&(En&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),nn&&nn.parentNode&&nn.parentNode.removeChild(nn),(rn===tn||pn&&"clone"!==pn.lastPutMode)&&sn&&sn.parentNode&&sn.parentNode.removeChild(sn),en&&(this.nativeDraggable&&Tt(en,"dragend",this),Gn(en),en.style["will-change"]="",En&&!Dn&&At(en,pn?pn.options.ghostClass:this.options.ghostClass,!1),At(en,this.options.chosenClass,!1),Kt({sortable:this,name:"unchoose",toEl:tn,newIndex:null,newDraggableIndex:null,originalEvent:e}),rn!==tn?(cn>=0&&(Kt({rootEl:tn,name:"add",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"remove",toEl:tn,originalEvent:e}),Kt({rootEl:tn,name:"sort",toEl:tn,fromEl:rn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),pn&&pn.save()):cn!==un&&cn>=0&&(Kt({sortable:this,name:"update",toEl:tn,originalEvent:e}),Kt({sortable:this,name:"sort",toEl:tn,originalEvent:e})),Wn.active&&(null!=cn&&-1!==cn||(cn=un,fn=dn),Kt({sortable:this,name:"end",toEl:tn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Zt("nulling",this),rn=en=tn=nn=on=sn=an=ln=gn=mn=En=cn=fn=un=dn=In=kn=pn=hn=Wn.dragged=Wn.ghost=Wn.clone=Wn.active=null,On.forEach((function(e){e.checked=!0})),On.length=vn=yn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":en&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function dt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var ft=dt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ht=dt(/Edge/i),pt=dt(/firefox/i),gt=dt(/safari/i)&&!dt(/chrome/i)&&!dt(/android/i),mt=dt(/iP(ad|od|hone)/i),vt=dt(/chrome/i)&&dt(/android/i),yt={capture:!1,passive:!1};function bt(e,t,n){e.addEventListener(t,n,!ft&&yt)}function wt(e,t,n){e.removeEventListener(t,n,!ft&&yt)}function Et(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 It(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function kt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Et(e,t):Et(e,t))||r&&e===n)return e;if(e===n)break}while(e=It(e))}return null}var St,Tt=/\s+/g;function xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Tt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Tt," ")}}function Dt(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 Pt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Dt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function _t(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Bt())break;r=Rt(r,!1)}return!1}function Ot(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ct(n,["evt"]);zt.pluginEvent.bind(Xn)(e,t,ut({dragEl:Vt,parentEl:Jt,ghostEl:$t,rootEl:Zt,nextEl:Kt,lastDownEl:en,cloneEl:tn,cloneHidden:nn,dragStarted:mn,putSortable:un,activeSortable:Xn.active,originalEvent:r,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn,hideGhostForTarget:Ln,unhideGhostForTarget:Rn,cloneNowHidden:function(){nn=!0},cloneNowShown:function(){nn=!1},dispatchSortableEvent:function(e){Qt({sortable:t,name:e,originalEvent:r})}},o))};function Qt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[qt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||ft||ht?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=ut({},p,zt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ut({putSortable:un,cloneEl:tn,targetEl:Vt,rootEl:Zt,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn},e))}var Vt,Jt,$t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En=!1,In=!1,kn=[],Sn=!1,Tn=!1,xn=[],Dn=!1,Pn=[],_n="undefined"!=typeof document,Bn=mt,An=ht||ft?"cssFloat":"float",Cn=_n&&!vt&&!mt&&"draggable"in document.createElement("div"),On=function(){if(_n){if(ft)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Mn=function(e,t){var n=Dt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ot(e,0,t),i=Ot(e,1,t),a=o&&Dt(o),s=i&&Dt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+At(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[An]||i&&"none"===n[An]&&l+u>r)?"vertical":"horizontal"},Nn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==at(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},Ln=function(){!On&&$t&&Dt($t,"display","none")},Rn=function(){!On&&$t&&Dt($t,"display","")};_n&&document.addEventListener("click",(function(e){if(In)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),In=!1,!1}),!0);var Hn=function(e){if(Vt){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,kn.some((function(e){if(!Mt(e)){var t=At(e),n=e[qt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[qt]._onDragOver(n)}}var o,i,a},Fn=function(e){Vt&&Vt.parentNode[qt]._isOutsideThisEl(e.target)};function Xn(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=lt({},t),e[qt]=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 Mn(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!==Xn.supportPointer&&"PointerEvent"in window&&!gt,emptyInsertThreshold:5};for(var r in zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Nn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Cn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?bt(e,"pointerdown",this._onTapStart):(bt(e,"mousedown",this._onTapStart),bt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(bt(e,"dragover",this),bt(e,"dragenter",this)),kn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),lt(this,Yt())}function Un(e,t,n,r,o,i,a,s){var l,u,c=e[qt],d=c.options.onMove;return!window.CustomEvent||ft||ht?(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=o||t,l.relatedRect=i||At(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function qn(e){e.draggable=!1}function Yn(){Dn=!1}function jn(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 Wn(e){return setTimeout(e,0)}function zn(e){return clearTimeout(e)}Xn.prototype={constructor:Xn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(vn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Vt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Pn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Pn.push(r)}}(n),!Vt&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!gt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=kt(s,r.draggable,n,!1))&&s.animated||en===s)){if(rn=Nt(s),an=Nt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Qt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Gt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=kt(l,r.trim(),n,!1))return Qt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Gt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!kt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!Vt&&n.parentNode===i){var l=At(n);if(Zt=i,Jt=(Vt=n).parentNode,Kt=Vt.nextSibling,en=n,ln=a.group,Xn.dragged=Vt,cn={target:Vt,clientX:(t||e).clientX,clientY:(t||e).clientY},pn=cn.clientX-l.left,gn=cn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Vt.style["will-change"]="all",r=function(){Gt("delayEnded",o,{evt:e}),Xn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!pt&&o.nativeDraggable&&(Vt.draggable=!0),o._triggerDragStart(e,t),Qt({sortable:o,name:"choose",originalEvent:e}),xt(Vt,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){_t(Vt,e.trim(),qn)})),bt(s,"dragover",Hn),bt(s,"mousemove",Hn),bt(s,"touchmove",Hn),bt(s,"mouseup",o._onDrop),bt(s,"touchend",o._onDrop),bt(s,"touchcancel",o._onDrop),pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Vt.draggable=!0),Gt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(ht||ft))r();else{if(Xn.eventCanceled)return void this._onDrop();bt(s,"mouseup",o._disableDelayedDrag),bt(s,"touchend",o._disableDelayedDrag),bt(s,"touchcancel",o._disableDelayedDrag),bt(s,"mousemove",o._delayedDragTouchMoveHandler),bt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&bt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){Vt&&qn(Vt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._disableDelayedDrag),wt(e,"touchend",this._disableDelayedDrag),wt(e,"touchcancel",this._disableDelayedDrag),wt(e,"mousemove",this._delayedDragTouchMoveHandler),wt(e,"touchmove",this._delayedDragTouchMoveHandler),wt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?bt(document,"pointermove",this._onTouchMove):bt(document,t?"touchmove":"mousemove",this._onTouchMove):(bt(Vt,"dragend",this),bt(Zt,"dragstart",this._onDragStart));try{document.selection?Wn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(En=!1,Zt&&Vt){Gt("dragStarted",this,{evt:t}),this.nativeDraggable&&bt(document,"dragover",Fn);var n=this.options;!e&&xt(Vt,n.dragClass,!1),xt(Vt,n.ghostClass,!0),Xn.active=this,e&&this._appendGhost(),Qt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(dn){this._lastX=dn.clientX,this._lastY=dn.clientY,Ln();for(var e=document.elementFromPoint(dn.clientX,dn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(dn.clientX,dn.clientY))!==t;)t=e;if(Vt.parentNode[qt]._isOutsideThisEl(e),t)do{if(t[qt]){if(t[qt]._onDragOver({clientX:dn.clientX,clientY:dn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Rn()}},_onTouchMove:function(e){if(cn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=$t&&Pt($t,!0),a=$t&&i&&i.a,s=$t&&i&&i.d,l=Bn&&wn&&Lt(wn),u=(o.clientX-cn.clientX+r.x)/(a||1)+(l?l[0]-xn[0]:0)/(a||1),c=(o.clientY-cn.clientY+r.y)/(s||1)+(l?l[1]-xn[1]:0)/(s||1);if(!Xn.active&&!En){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===Vt)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=At(a)),!1!==Un(Zt,i,Vt,t,a,n,e,!!a))return _(),i.appendChild(Vt),Jt=i,A(),B(!0)}else if(a.parentNode===i){n=At(a);var m,v,y,b=Vt.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(Vt.animated&&Vt.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ct(a,"top","top")||Ct(Vt,"top","top"),k=I?I.scrollTop:void 0;if(vn!==a&&(v=n[E],Sn=!1,Tn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&bnc+u*i/2:ld-bn)return-yn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Tn,vn===a))){var S=Nt(Vt);do{S-=m,y=Jt.children[S]}while(y&&("none"===Dt(y,"display")||y===$t))}if(0===m||y===a)return B(!1);vn=a,yn=m;var T=a.nextElementSibling,x=!1,D=Un(Zt,i,Vt,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Dn=!0,setTimeout(Yn,30),_(),x&&!T?i.appendChild(Vt):a.parentNode.insertBefore(Vt,x?T:a),I&&Xt(I,0,k-I.scrollTop),Jt=Vt.parentNode,void 0===v||Tn||(bn=Math.abs(v-At(a)[E])),A(),B(!0)}if(i.contains(Vt))return B(!1)}return!1}function P(s,l){Gt(s,h,ut({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Un(Zt,i,Vt,t,n,At(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(xt(Vt,un?un.options.ghostClass:u.options.ghostClass,!1),xt(Vt,s.ghostClass,!0)),un!==h&&h!==Xn.active?un=h:h===Xn.active&&un&&(un=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Vt&&!Vt.animated||a===i&&!a.animated)&&(vn=null),s.dragoverBubble||e.rootEl||a===document||(Vt.parentNode[qt]._isOutsideThisEl(e.target),!t&&Hn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){on=Nt(Vt),sn=Nt(Vt,s.draggable),Qt({sortable:h,name:"change",toEl:i,newIndex:on,newDraggableIndex:sn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){wt(document,"mousemove",this._onTouchMove),wt(document,"touchmove",this._onTouchMove),wt(document,"pointermove",this._onTouchMove),wt(document,"dragover",Hn),wt(document,"mousemove",Hn),wt(document,"touchmove",Hn)},_offUpEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._onDrop),wt(e,"touchend",this._onDrop),wt(e,"pointerup",this._onDrop),wt(e,"touchcancel",this._onDrop),wt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;on=Nt(Vt),sn=Nt(Vt,n.draggable),Gt("drop",this,{evt:e}),Jt=Vt&&Vt.parentNode,on=Nt(Vt),sn=Nt(Vt,n.draggable),Xn.eventCanceled||(En=!1,Tn=!1,Sn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zn(this.cloneId),zn(this._dragStartId),this.nativeDraggable&&(wt(document,"drop",this),wt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),gt&&Dt(document.body,"user-select",""),Dt(Vt,"transform",""),e&&(mn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),$t&&$t.parentNode&&$t.parentNode.removeChild($t),(Zt===Jt||un&&"clone"!==un.lastPutMode)&&tn&&tn.parentNode&&tn.parentNode.removeChild(tn),Vt&&(this.nativeDraggable&&wt(Vt,"dragend",this),qn(Vt),Vt.style["will-change"]="",mn&&!En&&xt(Vt,un?un.options.ghostClass:this.options.ghostClass,!1),xt(Vt,this.options.chosenClass,!1),Qt({sortable:this,name:"unchoose",toEl:Jt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Zt!==Jt?(on>=0&&(Qt({rootEl:Jt,name:"add",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"remove",toEl:Jt,originalEvent:e}),Qt({rootEl:Jt,name:"sort",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),un&&un.save()):on!==rn&&on>=0&&(Qt({sortable:this,name:"update",toEl:Jt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),Xn.active&&(null!=on&&-1!==on||(on=rn,sn=an),Qt({sortable:this,name:"end",toEl:Jt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Gt("nulling",this),Zt=Vt=Jt=$t=Kt=tn=en=nn=cn=dn=mn=on=sn=rn=an=vn=yn=un=ln=Xn.dragged=Xn.ghost=Xn.clone=Xn.active=null,Pn.forEach((function(e){e.checked=!0})),Pn.length=fn=hn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Vt&&(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,o=n.length,i=this.options;r { - if (response.type === DataEvent.API_REQUEST_GOOD) { + if (response.type === API_ACCESS_GOOD) { this.token = response.token; } else { //don't set token } }); } - //-------------------------- - // public - //-------------------------- + /** + * Method for retrieving user authorizing user login + * @param {object} data - json object that contains data for set up + * @property {string} handle - handle for site user + * @property {string} password - password for site user + */ login(data) { return new Promise((resolve, reject) => { this._request( @@ -58,11 +75,31 @@ export default class APIUtils { }); }); } + /** + * Method for saving settings + * @param {object} data - json object that contains settings data set on the front-end + * @property {string} global.base_url - base url for site + * @property {string} global.title - site title + * @property {string} global.descriptions - brief site summary + * @property {string} global.background - url for site feature image for header + * @property {boolean} global.private - privacy state for site [disabled] + * @property {boolean} global.renderOnSave - property for publishing site when page saved [disabled] + * @property {string} global.theme - current theme for site + * @property {boolean} global.externalAPI - toggle for external API access + * @property {string} member.handle - current member handle + * @property {string} member.email - current member email + * @property {string} email.active - current email protocol being used + * @property {string} email.smtp.domain - url of smtp service being + * @property {string} email.smtp.email - email account of smtp service + * @property {string} email.smtp.password - password for email of smtp service + * @property {string} email.mailgun.domain - mailgun domain url + * @property {string} email.mailgun.key - mailgun key + */ syncSettings(data) { return new Promise((resolve, reject) => { this._request( API_SETTINGS_SYNC, - DataEvent.API_SETTINGS_WRITE, + TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data @@ -76,11 +113,16 @@ export default class APIUtils { }); } + /** + * Method for retrieving user authorizing user login + * @param {object} data - json object that contains task + * @property {string} task - publishing task [deprecated] + */ publishSite(data) { return new Promise((resolve, reject) => { this._request( API_PUBLISH_PAGES, - DataEvent.API_RENDER_PAGES, + TASK_PUBLISH_SITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data @@ -94,23 +136,41 @@ export default class APIUtils { }); } + /** + * Method for handling page creating and editing + * @param {string} task - current page action + * @param {object} data - form object that contains info for current page being edited/created + * @property {string} id - sequence id for page + * @property {string} uuid - unique identifier for page + * @property {string} layout - current page layout + * @property {string} current_title - saved url save title for persistence when changing title + * @property {string} content - markdown body of page + * @property {string} title - current title of page + * @property {string} created - date page was created + * @property {string} slug - url safe string of page title + * @property {string} tags - comma separated list of tags + * @property {boolean} menu - property that indicates page is included in site menu + * @property {boolean} featured - property that indicates page is featured + * @property {boolean} published - property that indicates page is public + * @property {input} feature_image - main image for page + */ pageActions(task, data) { let url, event, content; switch (task) { case TASK_PAGE_CREATE: url = API_NEW_PAGE; - event = DataEvent.API_PAGE_WRITE; + event = TASK_PAGE_CREATE; content = CONTENT_TYPE_FORM; break; case TASK_PAGE_EDIT: url = API_EDIT_PAGE; - event = DataEvent.API_PAGE_WRITE; + event = TASK_PAGE_EDIT; content = CONTENT_TYPE_FORM; break; case TASK_PAGE_DELETE: url = API_DELETE_PAGE; - event = DataEvent.API_PAGE_DELETE; + event = TASK_PAGE_DELETE; content = CONTENT_TYPE_JSON; break; @@ -129,11 +189,19 @@ export default class APIUtils { }); } + /** + * Method for saving pages to be included in main site navigation + * @param {object} data - json object that contains items to be included in main site navigation + * @property {string} item.title - page title + * @property {string} item.slug - url safe title + * @property {string} item.uuid - unique identifier + * @property {string} item.path - directory path to associated markdown file + */ syncNav(data) { return new Promise((resolve, reject) => { this._request( API_NAV_SYNC, - DataEvent.API_SETTINGS_WRITE, + TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data @@ -146,11 +214,16 @@ export default class APIUtils { }); }); } + /** + * Method for sending mail + * @param {object} message - json object that contains items to be included in main site navigation + * @property {string} content - message to send + */ sendMail(message) { return new Promise((resolve, reject) => { this._request( API_SEND_MAIL, - DataEvent.SEND_MAIL, + TASK_SEND_MAIL, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, message @@ -163,12 +236,15 @@ export default class APIUtils { }); }); } - - handleReindex(data) { + /** + * Maintenance method to clean up page sequencing [disabled] + * @param {object} data - json object that contains items to be included in main site navigation + */ + reindexPages(data) { return new Promise((resolve, reject) => { this._request( API_REINDEX_PAGES, - DataEvent.API_REINDEX_PAGES, + TASK_REINDEX_PAGE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data @@ -208,14 +284,11 @@ export default class APIUtils { }; if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) { if ( - eventType === DataEvent.API_PAGE_WRITE || - eventType === DataEvent.API_IMAGES_UPLOAD || - eventType === DataEvent.API_SETTINGS_WRITE || - eventType === DataEvent.API_PAGE_DELETE || - eventType === DataEvent.API_RENDER_PAGES || - eventType === DataEvent.API_BACKUP_CREATE || - eventType === DataEvent.API_BACKUP_RESTORE || - eventType === DataEvent.API_REINDEX_PAGES + eventType === TASK_SETTINGS_WRITE || + eventType === TASK_PAGE_EDIT || + eventType === TASK_PAGE_DELETE || + eventType === TASK_PUBLISH_SITE || + eventType === TASK_REINDEX_PAGE ) request.setRequestHeader("fipamo-access-token", self.token); From ebdda2c089ec6f003e81eda452138d2bca7b2ffe Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 24 Jun 2021 11:58:55 -0700 Subject: [PATCH 5/8] updated front end controller scripts --- public/assets/scripts/dash.min.js | 8 ++++---- src/com/Base.js | 2 +- src/com/controllers/PageEditor.js | 6 ++++-- src/com/controllers/SettingsIndex.js | 26 ++++++-------------------- src/libraries/FipamoAdminAPI.js | 5 +++-- 5 files changed, 18 insertions(+), 29 deletions(-) diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index ba99659..751c142 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var h=new XMLHttpRequest;if(h.upload.onprogress=i.handleLoadProgress,h.open(n,e,!0),h.onload=function(){if(200==h.status){var e=JSON.parse(h.response);a(e)}else{var t=JSON.parse(h.response);c(t)}},"PUT"==n||n==s)switch(t!==d&&t!==p&&t!==g&&t!==f&&t!==m||h.setRequestHeader("fipamo-access-token",i.token),r){case l:h.setRequestHeader("Content-type","application/"+r),h.send(JSON.stringify(o));break;case u:h.send(o)}else h.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),y="POST",b="json",w="x-www-form-urlencoded",E=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==y)switch(r){case b:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case w:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),I=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),k="requestLame",S="postUpdated";new function t(){e(this,t)};var T=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 T).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),D="editorDelete",P="editorUploadImage",_="editorSave",B="editorUpdate";new function t(){e(this,t)};var A=["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"],C=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&A.push("width"),A.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function O(e){return(O="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 M=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}},N=function(e){return"object"===O(e)&&null!==e},L=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=C(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):L(e,t)},H=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;N(t)&&(r=t,t=null);var o=M(r),i=R(e,o);return t||0===t?i.setPos(t):i.getPosition()},F=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=H(e.textEditor).pos;t.refresh(),H(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(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((function(){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 P:var n,r;H(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=H(this.textEditor).pos,this.emitEvent(P);break;case"submit-save":case"edit-save":this.emitEvent(_);break;case"submit-update":case"edit-update":this.emitEvent(B);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(D)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function z(e,t){return e.apply(null,t)}var G={arr:function(e){return Array.isArray(e)},obj:function(e){return W(Object.prototype.toString.call(e),"Object")},pth:function(e){return G.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||G.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 G.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 G.hex(e)||G.rgb(e)||G.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!U.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Q(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function V(e,t){var n=Q(e),r=j(G.und(n[0])?1:n[0],.1,100),o=j(G.und(n[1])?100:n[1],.1,100),i=j(G.und(n[2])?10:n[2],.1,100),a=j(G.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Y.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Y.springs[e]=i,i}}function J(e){return void 0===e&&(e=10),function(t){return Math.ceil(j(t,1e-6,1)*e)*(1/e)}}var $,Z,K=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ee=($={linear:function(){return function(e){return e}}},Z={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=j(e,1,10),r=j(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){Z[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(Z).forEach((function(e){var t=Z[e];$["easeIn"+e]=t,$["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},$["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}},$["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}}})),$);function te(e,t){if(G.fnc(e))return e;var n=e.split("(")[0],r=ee[n],o=Q(e);switch(n){case"spring":return V(e,t);case"cubicBezier":return z(K,o);case"steps":return z(J,o);default:return z(r,o)}}function ne(e){try{return document.querySelectorAll(e)}catch(e){return}}function re(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function de(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 fe(e,t){return G.fnc(e)?e(t.target,t.id,t.total):e}function he(e,t){return e.getAttribute(t)}function pe(e,t,n){if(ae([n,"deg","rad","turn"],de(t)))return t;var r=Y.CSS[t+n];if(!G.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Y.CSS[t+n]=s,s}function ge(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?pe(e,o,n):o}}function me(e,t){return G.dom(e)&&!G.inp(e)&&(!G.nil(he(e,t))||G.svg(e)&&e[t])?"attribute":G.dom(e)&&ae(q,t)?"transform":G.dom(e)&&"transform"!==t&&ge(e,t)?"css":null!=e[t]?"object":void 0}function ve(e){if(G.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ye(e,t,n,r){var o=W(t,"scale")?1:0+function(e){return W(e,"translate")||"perspective"===e?"px":W(e,"rotate")||W(e,"skew")?"deg":void 0}(t),i=ve(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?pe(e,i,r):i}function be(e,t,n,r){switch(me(e,t)){case"transform":return ye(e,t,r,n);case"css":return ge(e,t,n);case"attribute":return he(e,t);default:return e[t]||0}}function we(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=de(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Ee(e,t){if(G.col(e))return ce(e);if(/\s/g.test(e))return e;var n=de(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Ie(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ke(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Ie(t,i)),t=i}return r}function Se(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*he(e,"r")}(e);case"rect":return function(e){return 2*he(e,"width")+2*he(e,"height")}(e);case"line":return function(e){return Ie({x:he(e,"x1"),y:he(e,"y1")},{x:he(e,"x2"),y:he(e,"y2")})}(e);case"polyline":return ke(e);case"polygon":return function(e){var t=e.points;return ke(e)+Ie(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;G.svg(t)&&G.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=he(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function xe(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 o=Te(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function De(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ee(G.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:G.str(e)||t?r.split(n):[]}}function Pe(e){return re(e?oe(G.arr(e)?e.map(ie):ie(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function _e(e){var t=Pe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ve(e)}}}))}function Be(e,t){var n=se(t);if(/^spring/.test(n.easing)&&(n.duration=V(n.easing)),G.arr(e)){var r=e.length;2===r&&!G.obj(e[0])?e={value:e}:G.fnc(t.duration)||(n.duration=t.duration/r)}var o=G.arr(e)?e:[e];return o.map((function(e,n){var r=G.obj(e)&&!G.pth(e)?e:{value:e};return G.und(r.delay)&&(r.delay=n?0:t.delay),G.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ue(e,n)}))}function Ae(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ue(function(e){for(var t=re(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return G.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)G.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ue.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(He.forEach((function(e){return e._onDocumentVisibility()})),Fe()))})),function(){e||Xe()&&Ue.suspendWhenDocumentHidden||!(He.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function Ue(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=le(X,e),n=le(U,e),r=Ae(n,e),o=_e(e.targets),i=Ne(o,r),a=Le(i,n),s=Re;return Re++,ue(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ue.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0, -l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Me(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ue.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,He.push(l),d(),Fe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ye(Pe(e),l)},l.reset(),l.autoplay&&l.play(),l}function qe(e,t){for(var n=t.length;n--;)ae(e,t[n].animatable.target)&&t.splice(n,1)}function Ye(e,t){var n=t.animations,r=t.children;qe(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;qe(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ue.version="3.2.1",Ue.speed=1,Ue.suspendWhenDocumentHidden=!0,Ue.running=He,Ue.remove=function(e){for(var t=Pe(e),n=He.length;n--;){Ye(t,He[n])}},Ue.get=be,Ue.set=Me,Ue.convertPx=pe,Ue.path=function(e,t){var n=G.str(e)?ne(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Te(n),totalLength:Se(n)*(r/100)}}},Ue.setDashoffset=function(e){var t=Se(e);return e.setAttribute("stroke-dasharray",t),t},Ue.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?te(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=G.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=de(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&He.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;$e.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(P,e.url),$e.alert("Image Added to Entry",!0)})).catch((function(){$e.alert("Uh oh. Image not added",!1)}))}}]),t}();Ze.uploadFiles=[];var Ke=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new Ze}}}]),t}(),et=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var h=new XMLHttpRequest;if(h.upload.onprogress=i.handleLoadProgress,h.open(n,e,!0),h.onload=function(){if(200==h.status){var e=JSON.parse(h.response);a(e)}else{var t=JSON.parse(h.response);c(t)}},"PUT"==n||n==s)switch(t!==d&&t!==p&&t!==g&&t!==f&&t!==m||h.setRequestHeader("fipamo-access-token",i.token),r){case l:h.setRequestHeader("Content-type","application/"+r),h.send(JSON.stringify(o));break;case u:h.send(o)}else h.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),y="POST",b="json",w="x-www-form-urlencoded",E=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==y)switch(r){case b:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case w:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),I=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),S="requestLame",T="postUpdated";new function t(){e(this,t)};var k=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 k).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),D="editorDelete",P="editorUploadImage",_="editorSave",B="editorUpdate";new function t(){e(this,t)};var A=["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"],C=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&A.push("width"),A.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function O(e){return(O="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 M=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}},N=function(e){return"object"===O(e)&&null!==e},L=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=C(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):L(e,t)},H=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;N(t)&&(r=t,t=null);var o=M(r),i=R(e,o);return t||0===t?i.setPos(t):i.getPosition()},F=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=H(e.textEditor).pos;t.refresh(),H(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case T: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((function(){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 P:var n,r;H(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=H(this.textEditor).pos,this.emitEvent(P);break;case"submit-save":case"edit-save":this.emitEvent(_);break;case"submit-update":case"edit-update":this.emitEvent(B);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(D)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function z(e,t){return e.apply(null,t)}var G={arr:function(e){return Array.isArray(e)},obj:function(e){return W(Object.prototype.toString.call(e),"Object")},pth:function(e){return G.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||G.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 G.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 G.hex(e)||G.rgb(e)||G.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!U.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Q(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function V(e,t){var n=Q(e),r=j(G.und(n[0])?1:n[0],.1,100),o=j(G.und(n[1])?100:n[1],.1,100),i=j(G.und(n[2])?10:n[2],.1,100),a=j(G.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Y.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Y.springs[e]=i,i}}function J(e){return void 0===e&&(e=10),function(t){return Math.ceil(j(t,1e-6,1)*e)*(1/e)}}var $,Z,K=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ee=($={linear:function(){return function(e){return e}}},Z={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=j(e,1,10),r=j(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){Z[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(Z).forEach((function(e){var t=Z[e];$["easeIn"+e]=t,$["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},$["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}},$["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}}})),$);function te(e,t){if(G.fnc(e))return e;var n=e.split("(")[0],r=ee[n],o=Q(e);switch(n){case"spring":return V(e,t);case"cubicBezier":return z(K,o);case"steps":return z(J,o);default:return z(r,o)}}function ne(e){try{return document.querySelectorAll(e)}catch(e){return}}function re(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function de(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 fe(e,t){return G.fnc(e)?e(t.target,t.id,t.total):e}function he(e,t){return e.getAttribute(t)}function pe(e,t,n){if(ae([n,"deg","rad","turn"],de(t)))return t;var r=Y.CSS[t+n];if(!G.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Y.CSS[t+n]=s,s}function ge(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?pe(e,o,n):o}}function me(e,t){return G.dom(e)&&!G.inp(e)&&(!G.nil(he(e,t))||G.svg(e)&&e[t])?"attribute":G.dom(e)&&ae(q,t)?"transform":G.dom(e)&&"transform"!==t&&ge(e,t)?"css":null!=e[t]?"object":void 0}function ve(e){if(G.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ye(e,t,n,r){var o=W(t,"scale")?1:0+function(e){return W(e,"translate")||"perspective"===e?"px":W(e,"rotate")||W(e,"skew")?"deg":void 0}(t),i=ve(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?pe(e,i,r):i}function be(e,t,n,r){switch(me(e,t)){case"transform":return ye(e,t,r,n);case"css":return ge(e,t,n);case"attribute":return he(e,t);default:return e[t]||0}}function we(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=de(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Ee(e,t){if(G.col(e))return ce(e);if(/\s/g.test(e))return e;var n=de(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Ie(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Se(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Ie(t,i)),t=i}return r}function Te(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*he(e,"r")}(e);case"rect":return function(e){return 2*he(e,"width")+2*he(e,"height")}(e);case"line":return function(e){return Ie({x:he(e,"x1"),y:he(e,"y1")},{x:he(e,"x2"),y:he(e,"y2")})}(e);case"polyline":return Se(e);case"polygon":return function(e){var t=e.points;return Se(e)+Ie(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function ke(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;G.svg(t)&&G.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=he(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function xe(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 o=ke(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function De(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ee(G.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:G.str(e)||t?r.split(n):[]}}function Pe(e){return re(e?oe(G.arr(e)?e.map(ie):ie(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function _e(e){var t=Pe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ve(e)}}}))}function Be(e,t){var n=se(t);if(/^spring/.test(n.easing)&&(n.duration=V(n.easing)),G.arr(e)){var r=e.length;2===r&&!G.obj(e[0])?e={value:e}:G.fnc(t.duration)||(n.duration=t.duration/r)}var o=G.arr(e)?e:[e];return o.map((function(e,n){var r=G.obj(e)&&!G.pth(e)?e:{value:e};return G.und(r.delay)&&(r.delay=n?0:t.delay),G.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ue(e,n)}))}function Ae(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ue(function(e){for(var t=re(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return G.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)G.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ue.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(He.forEach((function(e){return e._onDocumentVisibility()})),Fe()))})),function(){e||Xe()&&Ue.suspendWhenDocumentHidden||!(He.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function Ue(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=le(X,e),n=le(U,e),r=Ae(n,e),o=_e(e.targets),i=Ne(o,r),a=Le(i,n),s=Re;return Re++,ue(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ue.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0, +l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Me(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ue.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,He.push(l),d(),Fe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ye(Pe(e),l)},l.reset(),l.autoplay&&l.play(),l}function qe(e,t){for(var n=t.length;n--;)ae(e,t[n].animatable.target)&&t.splice(n,1)}function Ye(e,t){var n=t.animations,r=t.children;qe(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;qe(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ue.version="3.2.1",Ue.speed=1,Ue.suspendWhenDocumentHidden=!0,Ue.running=He,Ue.remove=function(e){for(var t=Pe(e),n=He.length;n--;){Ye(t,He[n])}},Ue.get=be,Ue.set=Me,Ue.convertPx=pe,Ue.path=function(e,t){var n=G.str(e)?ne(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:ke(n),totalLength:Te(n)*(r/100)}}},Ue.setDashoffset=function(e){var t=Te(e);return e.setAttribute("stroke-dasharray",t),t},Ue.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?te(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=G.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=de(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&He.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;$e.alert("Uploading Image",null),(new E).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(P,e.url),$e.alert("Image Added to Entry",!0)})).catch((function(){$e.alert("Uh oh. Image not added",!1)}))}}]),t}();Ze.uploadFiles=[];var Ke=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new Ze}}}]),t}(),et=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function at(e){return(at="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 st(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(){return(lt=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function dt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var ft=dt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ht=dt(/Edge/i),pt=dt(/firefox/i),gt=dt(/safari/i)&&!dt(/chrome/i)&&!dt(/android/i),mt=dt(/iP(ad|od|hone)/i),vt=dt(/chrome/i)&&dt(/android/i),yt={capture:!1,passive:!1};function bt(e,t,n){e.addEventListener(t,n,!ft&&yt)}function wt(e,t,n){e.removeEventListener(t,n,!ft&&yt)}function Et(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 It(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function kt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Et(e,t):Et(e,t))||r&&e===n)return e;if(e===n)break}while(e=It(e))}return null}var St,Tt=/\s+/g;function xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Tt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Tt," ")}}function Dt(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 Pt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Dt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function _t(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Bt())break;r=Rt(r,!1)}return!1}function Ot(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ct(n,["evt"]);zt.pluginEvent.bind(Xn)(e,t,ut({dragEl:Vt,parentEl:Jt,ghostEl:$t,rootEl:Zt,nextEl:Kt,lastDownEl:en,cloneEl:tn,cloneHidden:nn,dragStarted:mn,putSortable:un,activeSortable:Xn.active,originalEvent:r,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn,hideGhostForTarget:Ln,unhideGhostForTarget:Rn,cloneNowHidden:function(){nn=!0},cloneNowShown:function(){nn=!1},dispatchSortableEvent:function(e){Qt({sortable:t,name:e,originalEvent:r})}},o))};function Qt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[qt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||ft||ht?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=ut({},p,zt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ut({putSortable:un,cloneEl:tn,targetEl:Vt,rootEl:Zt,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn},e))}var Vt,Jt,$t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En=!1,In=!1,kn=[],Sn=!1,Tn=!1,xn=[],Dn=!1,Pn=[],_n="undefined"!=typeof document,Bn=mt,An=ht||ft?"cssFloat":"float",Cn=_n&&!vt&&!mt&&"draggable"in document.createElement("div"),On=function(){if(_n){if(ft)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Mn=function(e,t){var n=Dt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ot(e,0,t),i=Ot(e,1,t),a=o&&Dt(o),s=i&&Dt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+At(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[An]||i&&"none"===n[An]&&l+u>r)?"vertical":"horizontal"},Nn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==at(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},Ln=function(){!On&&$t&&Dt($t,"display","none")},Rn=function(){!On&&$t&&Dt($t,"display","")};_n&&document.addEventListener("click",(function(e){if(In)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),In=!1,!1}),!0);var Hn=function(e){if(Vt){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,kn.some((function(e){if(!Mt(e)){var t=At(e),n=e[qt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[qt]._onDragOver(n)}}var o,i,a},Fn=function(e){Vt&&Vt.parentNode[qt]._isOutsideThisEl(e.target)};function Xn(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=lt({},t),e[qt]=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 Mn(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!==Xn.supportPointer&&"PointerEvent"in window&&!gt,emptyInsertThreshold:5};for(var r in zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Nn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Cn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?bt(e,"pointerdown",this._onTapStart):(bt(e,"mousedown",this._onTapStart),bt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(bt(e,"dragover",this),bt(e,"dragenter",this)),kn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),lt(this,Yt())}function Un(e,t,n,r,o,i,a,s){var l,u,c=e[qt],d=c.options.onMove;return!window.CustomEvent||ft||ht?(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=o||t,l.relatedRect=i||At(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function qn(e){e.draggable=!1}function Yn(){Dn=!1}function jn(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 Wn(e){return setTimeout(e,0)}function zn(e){return clearTimeout(e)}Xn.prototype={constructor:Xn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(vn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Vt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Pn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Pn.push(r)}}(n),!Vt&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!gt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=kt(s,r.draggable,n,!1))&&s.animated||en===s)){if(rn=Nt(s),an=Nt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Qt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Gt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=kt(l,r.trim(),n,!1))return Qt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Gt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!kt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!Vt&&n.parentNode===i){var l=At(n);if(Zt=i,Jt=(Vt=n).parentNode,Kt=Vt.nextSibling,en=n,ln=a.group,Xn.dragged=Vt,cn={target:Vt,clientX:(t||e).clientX,clientY:(t||e).clientY},pn=cn.clientX-l.left,gn=cn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Vt.style["will-change"]="all",r=function(){Gt("delayEnded",o,{evt:e}),Xn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!pt&&o.nativeDraggable&&(Vt.draggable=!0),o._triggerDragStart(e,t),Qt({sortable:o,name:"choose",originalEvent:e}),xt(Vt,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){_t(Vt,e.trim(),qn)})),bt(s,"dragover",Hn),bt(s,"mousemove",Hn),bt(s,"touchmove",Hn),bt(s,"mouseup",o._onDrop),bt(s,"touchend",o._onDrop),bt(s,"touchcancel",o._onDrop),pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Vt.draggable=!0),Gt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(ht||ft))r();else{if(Xn.eventCanceled)return void this._onDrop();bt(s,"mouseup",o._disableDelayedDrag),bt(s,"touchend",o._disableDelayedDrag),bt(s,"touchcancel",o._disableDelayedDrag),bt(s,"mousemove",o._delayedDragTouchMoveHandler),bt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&bt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){Vt&&qn(Vt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._disableDelayedDrag),wt(e,"touchend",this._disableDelayedDrag),wt(e,"touchcancel",this._disableDelayedDrag),wt(e,"mousemove",this._delayedDragTouchMoveHandler),wt(e,"touchmove",this._delayedDragTouchMoveHandler),wt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?bt(document,"pointermove",this._onTouchMove):bt(document,t?"touchmove":"mousemove",this._onTouchMove):(bt(Vt,"dragend",this),bt(Zt,"dragstart",this._onDragStart));try{document.selection?Wn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(En=!1,Zt&&Vt){Gt("dragStarted",this,{evt:t}),this.nativeDraggable&&bt(document,"dragover",Fn);var n=this.options;!e&&xt(Vt,n.dragClass,!1),xt(Vt,n.ghostClass,!0),Xn.active=this,e&&this._appendGhost(),Qt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(dn){this._lastX=dn.clientX,this._lastY=dn.clientY,Ln();for(var e=document.elementFromPoint(dn.clientX,dn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(dn.clientX,dn.clientY))!==t;)t=e;if(Vt.parentNode[qt]._isOutsideThisEl(e),t)do{if(t[qt]){if(t[qt]._onDragOver({clientX:dn.clientX,clientY:dn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Rn()}},_onTouchMove:function(e){if(cn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=$t&&Pt($t,!0),a=$t&&i&&i.a,s=$t&&i&&i.d,l=Bn&&wn&&Lt(wn),u=(o.clientX-cn.clientX+r.x)/(a||1)+(l?l[0]-xn[0]:0)/(a||1),c=(o.clientY-cn.clientY+r.y)/(s||1)+(l?l[1]-xn[1]:0)/(s||1);if(!Xn.active&&!En){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===Vt)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=At(a)),!1!==Un(Zt,i,Vt,t,a,n,e,!!a))return _(),i.appendChild(Vt),Jt=i,A(),B(!0)}else if(a.parentNode===i){n=At(a);var m,v,y,b=Vt.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(Vt.animated&&Vt.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ct(a,"top","top")||Ct(Vt,"top","top"),k=I?I.scrollTop:void 0;if(vn!==a&&(v=n[E],Sn=!1,Tn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&bnc+u*i/2:ld-bn)return-yn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Tn,vn===a))){var S=Nt(Vt);do{S-=m,y=Jt.children[S]}while(y&&("none"===Dt(y,"display")||y===$t))}if(0===m||y===a)return B(!1);vn=a,yn=m;var T=a.nextElementSibling,x=!1,D=Un(Zt,i,Vt,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Dn=!0,setTimeout(Yn,30),_(),x&&!T?i.appendChild(Vt):a.parentNode.insertBefore(Vt,x?T:a),I&&Xt(I,0,k-I.scrollTop),Jt=Vt.parentNode,void 0===v||Tn||(bn=Math.abs(v-At(a)[E])),A(),B(!0)}if(i.contains(Vt))return B(!1)}return!1}function P(s,l){Gt(s,h,ut({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Un(Zt,i,Vt,t,n,At(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(xt(Vt,un?un.options.ghostClass:u.options.ghostClass,!1),xt(Vt,s.ghostClass,!0)),un!==h&&h!==Xn.active?un=h:h===Xn.active&&un&&(un=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Vt&&!Vt.animated||a===i&&!a.animated)&&(vn=null),s.dragoverBubble||e.rootEl||a===document||(Vt.parentNode[qt]._isOutsideThisEl(e.target),!t&&Hn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){on=Nt(Vt),sn=Nt(Vt,s.draggable),Qt({sortable:h,name:"change",toEl:i,newIndex:on,newDraggableIndex:sn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){wt(document,"mousemove",this._onTouchMove),wt(document,"touchmove",this._onTouchMove),wt(document,"pointermove",this._onTouchMove),wt(document,"dragover",Hn),wt(document,"mousemove",Hn),wt(document,"touchmove",Hn)},_offUpEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._onDrop),wt(e,"touchend",this._onDrop),wt(e,"pointerup",this._onDrop),wt(e,"touchcancel",this._onDrop),wt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;on=Nt(Vt),sn=Nt(Vt,n.draggable),Gt("drop",this,{evt:e}),Jt=Vt&&Vt.parentNode,on=Nt(Vt),sn=Nt(Vt,n.draggable),Xn.eventCanceled||(En=!1,Tn=!1,Sn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zn(this.cloneId),zn(this._dragStartId),this.nativeDraggable&&(wt(document,"drop",this),wt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),gt&&Dt(document.body,"user-select",""),Dt(Vt,"transform",""),e&&(mn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),$t&&$t.parentNode&&$t.parentNode.removeChild($t),(Zt===Jt||un&&"clone"!==un.lastPutMode)&&tn&&tn.parentNode&&tn.parentNode.removeChild(tn),Vt&&(this.nativeDraggable&&wt(Vt,"dragend",this),qn(Vt),Vt.style["will-change"]="",mn&&!En&&xt(Vt,un?un.options.ghostClass:this.options.ghostClass,!1),xt(Vt,this.options.chosenClass,!1),Qt({sortable:this,name:"unchoose",toEl:Jt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Zt!==Jt?(on>=0&&(Qt({rootEl:Jt,name:"add",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"remove",toEl:Jt,originalEvent:e}),Qt({rootEl:Jt,name:"sort",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),un&&un.save()):on!==rn&&on>=0&&(Qt({sortable:this,name:"update",toEl:Jt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),Xn.active&&(null!=on&&-1!==on||(on=rn,sn=an),Qt({sortable:this,name:"end",toEl:Jt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Gt("nulling",this),Zt=Vt=Jt=$t=Kt=tn=en=nn=cn=dn=mn=on=sn=rn=an=vn=yn=un=ln=Xn.dragged=Xn.ghost=Xn.clone=Xn.active=null,Pn.forEach((function(e){e.checked=!0})),Pn.length=fn=hn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Vt&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function dt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var ft=dt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ht=dt(/Edge/i),pt=dt(/firefox/i),gt=dt(/safari/i)&&!dt(/chrome/i)&&!dt(/android/i),mt=dt(/iP(ad|od|hone)/i),vt=dt(/chrome/i)&&dt(/android/i),yt={capture:!1,passive:!1};function bt(e,t,n){e.addEventListener(t,n,!ft&&yt)}function wt(e,t,n){e.removeEventListener(t,n,!ft&&yt)}function Et(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 It(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function St(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Et(e,t):Et(e,t))||r&&e===n)return e;if(e===n)break}while(e=It(e))}return null}var Tt,kt=/\s+/g;function xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(kt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(kt," ")}}function Dt(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 Pt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Dt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function _t(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Bt())break;r=Rt(r,!1)}return!1}function Ot(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ct(n,["evt"]);zt.pluginEvent.bind(Xn)(e,t,ut({dragEl:Vt,parentEl:Jt,ghostEl:$t,rootEl:Zt,nextEl:Kt,lastDownEl:en,cloneEl:tn,cloneHidden:nn,dragStarted:mn,putSortable:un,activeSortable:Xn.active,originalEvent:r,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn,hideGhostForTarget:Ln,unhideGhostForTarget:Rn,cloneNowHidden:function(){nn=!0},cloneNowShown:function(){nn=!1},dispatchSortableEvent:function(e){Qt({sortable:t,name:e,originalEvent:r})}},o))};function Qt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[qt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||ft||ht?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=ut({},p,zt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ut({putSortable:un,cloneEl:tn,targetEl:Vt,rootEl:Zt,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn},e))}var Vt,Jt,$t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En=!1,In=!1,Sn=[],Tn=!1,kn=!1,xn=[],Dn=!1,Pn=[],_n="undefined"!=typeof document,Bn=mt,An=ht||ft?"cssFloat":"float",Cn=_n&&!vt&&!mt&&"draggable"in document.createElement("div"),On=function(){if(_n){if(ft)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Mn=function(e,t){var n=Dt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ot(e,0,t),i=Ot(e,1,t),a=o&&Dt(o),s=i&&Dt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+At(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[An]||i&&"none"===n[An]&&l+u>r)?"vertical":"horizontal"},Nn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==at(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},Ln=function(){!On&&$t&&Dt($t,"display","none")},Rn=function(){!On&&$t&&Dt($t,"display","")};_n&&document.addEventListener("click",(function(e){if(In)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),In=!1,!1}),!0);var Hn=function(e){if(Vt){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Sn.some((function(e){if(!Mt(e)){var t=At(e),n=e[qt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[qt]._onDragOver(n)}}var o,i,a},Fn=function(e){Vt&&Vt.parentNode[qt]._isOutsideThisEl(e.target)};function Xn(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=lt({},t),e[qt]=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 Mn(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!==Xn.supportPointer&&"PointerEvent"in window&&!gt,emptyInsertThreshold:5};for(var r in zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Nn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Cn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?bt(e,"pointerdown",this._onTapStart):(bt(e,"mousedown",this._onTapStart),bt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(bt(e,"dragover",this),bt(e,"dragenter",this)),Sn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),lt(this,Yt())}function Un(e,t,n,r,o,i,a,s){var l,u,c=e[qt],d=c.options.onMove;return!window.CustomEvent||ft||ht?(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=o||t,l.relatedRect=i||At(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function qn(e){e.draggable=!1}function Yn(){Dn=!1}function jn(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 Wn(e){return setTimeout(e,0)}function zn(e){return clearTimeout(e)}Xn.prototype={constructor:Xn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(vn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Vt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Pn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Pn.push(r)}}(n),!Vt&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!gt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=St(s,r.draggable,n,!1))&&s.animated||en===s)){if(rn=Nt(s),an=Nt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Qt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Gt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=St(l,r.trim(),n,!1))return Qt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Gt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!St(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!Vt&&n.parentNode===i){var l=At(n);if(Zt=i,Jt=(Vt=n).parentNode,Kt=Vt.nextSibling,en=n,ln=a.group,Xn.dragged=Vt,cn={target:Vt,clientX:(t||e).clientX,clientY:(t||e).clientY},pn=cn.clientX-l.left,gn=cn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Vt.style["will-change"]="all",r=function(){Gt("delayEnded",o,{evt:e}),Xn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!pt&&o.nativeDraggable&&(Vt.draggable=!0),o._triggerDragStart(e,t),Qt({sortable:o,name:"choose",originalEvent:e}),xt(Vt,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){_t(Vt,e.trim(),qn)})),bt(s,"dragover",Hn),bt(s,"mousemove",Hn),bt(s,"touchmove",Hn),bt(s,"mouseup",o._onDrop),bt(s,"touchend",o._onDrop),bt(s,"touchcancel",o._onDrop),pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Vt.draggable=!0),Gt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(ht||ft))r();else{if(Xn.eventCanceled)return void this._onDrop();bt(s,"mouseup",o._disableDelayedDrag),bt(s,"touchend",o._disableDelayedDrag),bt(s,"touchcancel",o._disableDelayedDrag),bt(s,"mousemove",o._delayedDragTouchMoveHandler),bt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&bt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){Vt&&qn(Vt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._disableDelayedDrag),wt(e,"touchend",this._disableDelayedDrag),wt(e,"touchcancel",this._disableDelayedDrag),wt(e,"mousemove",this._delayedDragTouchMoveHandler),wt(e,"touchmove",this._delayedDragTouchMoveHandler),wt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?bt(document,"pointermove",this._onTouchMove):bt(document,t?"touchmove":"mousemove",this._onTouchMove):(bt(Vt,"dragend",this),bt(Zt,"dragstart",this._onDragStart));try{document.selection?Wn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(En=!1,Zt&&Vt){Gt("dragStarted",this,{evt:t}),this.nativeDraggable&&bt(document,"dragover",Fn);var n=this.options;!e&&xt(Vt,n.dragClass,!1),xt(Vt,n.ghostClass,!0),Xn.active=this,e&&this._appendGhost(),Qt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(dn){this._lastX=dn.clientX,this._lastY=dn.clientY,Ln();for(var e=document.elementFromPoint(dn.clientX,dn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(dn.clientX,dn.clientY))!==t;)t=e;if(Vt.parentNode[qt]._isOutsideThisEl(e),t)do{if(t[qt]){if(t[qt]._onDragOver({clientX:dn.clientX,clientY:dn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Rn()}},_onTouchMove:function(e){if(cn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=$t&&Pt($t,!0),a=$t&&i&&i.a,s=$t&&i&&i.d,l=Bn&&wn&&Lt(wn),u=(o.clientX-cn.clientX+r.x)/(a||1)+(l?l[0]-xn[0]:0)/(a||1),c=(o.clientY-cn.clientY+r.y)/(s||1)+(l?l[1]-xn[1]:0)/(s||1);if(!Xn.active&&!En){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===Vt)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=At(a)),!1!==Un(Zt,i,Vt,t,a,n,e,!!a))return _(),i.appendChild(Vt),Jt=i,A(),B(!0)}else if(a.parentNode===i){n=At(a);var m,v,y,b=Vt.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(Vt.animated&&Vt.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ct(a,"top","top")||Ct(Vt,"top","top"),S=I?I.scrollTop:void 0;if(vn!==a&&(v=n[E],Tn=!1,kn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&bnc+u*i/2:ld-bn)return-yn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,kn,vn===a))){var T=Nt(Vt);do{T-=m,y=Jt.children[T]}while(y&&("none"===Dt(y,"display")||y===$t))}if(0===m||y===a)return B(!1);vn=a,yn=m;var k=a.nextElementSibling,x=!1,D=Un(Zt,i,Vt,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Dn=!0,setTimeout(Yn,30),_(),x&&!k?i.appendChild(Vt):a.parentNode.insertBefore(Vt,x?k:a),I&&Xt(I,0,S-I.scrollTop),Jt=Vt.parentNode,void 0===v||kn||(bn=Math.abs(v-At(a)[E])),A(),B(!0)}if(i.contains(Vt))return B(!1)}return!1}function P(s,l){Gt(s,h,ut({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Un(Zt,i,Vt,t,n,At(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(xt(Vt,un?un.options.ghostClass:u.options.ghostClass,!1),xt(Vt,s.ghostClass,!0)),un!==h&&h!==Xn.active?un=h:h===Xn.active&&un&&(un=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Vt&&!Vt.animated||a===i&&!a.animated)&&(vn=null),s.dragoverBubble||e.rootEl||a===document||(Vt.parentNode[qt]._isOutsideThisEl(e.target),!t&&Hn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){on=Nt(Vt),sn=Nt(Vt,s.draggable),Qt({sortable:h,name:"change",toEl:i,newIndex:on,newDraggableIndex:sn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){wt(document,"mousemove",this._onTouchMove),wt(document,"touchmove",this._onTouchMove),wt(document,"pointermove",this._onTouchMove),wt(document,"dragover",Hn),wt(document,"mousemove",Hn),wt(document,"touchmove",Hn)},_offUpEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._onDrop),wt(e,"touchend",this._onDrop),wt(e,"pointerup",this._onDrop),wt(e,"touchcancel",this._onDrop),wt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;on=Nt(Vt),sn=Nt(Vt,n.draggable),Gt("drop",this,{evt:e}),Jt=Vt&&Vt.parentNode,on=Nt(Vt),sn=Nt(Vt,n.draggable),Xn.eventCanceled||(En=!1,kn=!1,Tn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zn(this.cloneId),zn(this._dragStartId),this.nativeDraggable&&(wt(document,"drop",this),wt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),gt&&Dt(document.body,"user-select",""),Dt(Vt,"transform",""),e&&(mn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),$t&&$t.parentNode&&$t.parentNode.removeChild($t),(Zt===Jt||un&&"clone"!==un.lastPutMode)&&tn&&tn.parentNode&&tn.parentNode.removeChild(tn),Vt&&(this.nativeDraggable&&wt(Vt,"dragend",this),qn(Vt),Vt.style["will-change"]="",mn&&!En&&xt(Vt,un?un.options.ghostClass:this.options.ghostClass,!1),xt(Vt,this.options.chosenClass,!1),Qt({sortable:this,name:"unchoose",toEl:Jt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Zt!==Jt?(on>=0&&(Qt({rootEl:Jt,name:"add",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"remove",toEl:Jt,originalEvent:e}),Qt({rootEl:Jt,name:"sort",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),un&&un.save()):on!==rn&&on>=0&&(Qt({sortable:this,name:"update",toEl:Jt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),Xn.active&&(null!=on&&-1!==on||(on=rn,sn=an),Qt({sortable:this,name:"end",toEl:Jt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Gt("nulling",this),Zt=Vt=Jt=$t=Kt=tn=en=nn=cn=dn=mn=on=sn=rn=an=vn=yn=un=ln=Xn.dragged=Xn.ghost=Xn.clone=Xn.active=null,Pn.forEach((function(e){e.checked=!0})),Pn.length=fn=hn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Vt&&(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,o=n.length,i=this.options;r { if (response.type === DataEvent.API_INIT_LAME) { self.processing = false; diff --git a/src/com/controllers/PageEditor.js b/src/com/controllers/PageEditor.js index d08df2d..8f5d393 100644 --- a/src/com/controllers/PageEditor.js +++ b/src/com/controllers/PageEditor.js @@ -4,10 +4,11 @@ import FipamoAdminAPI, { TASK_PAGE_EDIT, TASK_PAGE_DELETE } from "../../libraries/FipamoAdminAPI"; +import FipamoUtilityAPI from "../../libraries/FipamoUtilityAPI"; import * as DataEvent from "../events/DataEvent"; import PageActions from "../actions/PageActions"; import * as EditorEvent from "../events/EditorEvent"; -//import TinyDatePicker from 'tiny-date-picker'; +//import TinyDatePicker from 'tiny-date-picker'; TODO: Reactivate for scheduled publishing import TextEditor from "../ui/TextEditor"; import Notfications from "../ui/Notifications"; const notify = new Notfications(); @@ -249,7 +250,8 @@ export default class PostEditor { handleImageUpload(type, files) { let self = this; notify.alert("Uploading Image", null); - this.admin + let utils = new FipamoUtilityAPI(); + utils .imageUpload(type, files) .then((r) => { if (r.type == DataEvent.POST_IMAGE_ADDED) diff --git a/src/com/controllers/SettingsIndex.js b/src/com/controllers/SettingsIndex.js index 9c1c69a..429a6ae 100644 --- a/src/com/controllers/SettingsIndex.js +++ b/src/com/controllers/SettingsIndex.js @@ -1,5 +1,6 @@ import SettingsActions from "../actions/SettingsActions"; import FipamoAdminAPI from "../../libraries/FipamoAdminAPI"; +import FipamoUtilityAPI from "../../libraries/FipamoUtilityAPI"; import * as DataEvent from "../../../src/com/events/DataEvent"; import Mailer from "../actions/Mailer"; import Notifications from "../ui/Notifications"; @@ -88,10 +89,12 @@ export default class SettingsIndex { for (i = 0, length = mailBtn.length; i < length; i++) { mailBtn[i].addEventListener("click", (e) => this.handleMailOptions(e)); } - //handle backup + //handle backup from settings [disabled] + /* document .getElementById("create-backup") .addEventListener("click", (e) => this.handleBackup(e)); + */ /* document @@ -165,7 +168,8 @@ export default class SettingsIndex { } handleImageUpload(type, files) { notify.alert("Uploading Image... ", null); - this.admin + let utils = new FipamoAdminAPI(); + utils .imageUpload(type, files) .then((r) => { if (r.type == DataEvent.AVATAR_UPLOADED) { @@ -199,24 +203,6 @@ export default class SettingsIndex { notify.alert(err, false); }); } - handleBackup(e) { - if (this.processing) return; - let self = this; - e.preventDefault(); - e.stopPropagation(); - notify.alert("Creating backup", null); - this.processing = true; - this.admin - .handleBackup(e.target.id, e.target.files) - .then((r) => { - self.processing = false; - notify.alert(r.message, true); - }) - .catch((err) => { - self.processing = false; - notify.alert(err, false); - }); - } handleReindex(e) { if (this.processing) return; diff --git a/src/libraries/FipamoAdminAPI.js b/src/libraries/FipamoAdminAPI.js index df7ad50..deeffd1 100644 --- a/src/libraries/FipamoAdminAPI.js +++ b/src/libraries/FipamoAdminAPI.js @@ -20,8 +20,6 @@ export const API_SEND_MAIL = "/api/v1/mailer"; export const API_LOGIN = "/api/v1/login"; //** API TASKS **// export const AUTH_STATUS = "getAuthStatus"; -export const API_ACCESS_GOOD = "apiConnected"; -export const API_ACCESS_BAD = "apiNotConnected"; export const TASK_SETTINGS_WRITE = "writeSettings"; export const TASK_PUBLISH_SITE = "publishSite"; export const TASK_PAGE_CREATE = "createNewPage"; @@ -29,6 +27,9 @@ export const TASK_PAGE_EDIT = "editPage"; export const TASK_PAGE_DELETE = "deletePage"; export const TASK_SEND_MAIL = "sendMail"; export const TASK_REINDEX_PAGE = "reIndexPages"; +//** API STATUS **// +export const API_ACCESS_GOOD = "apiConnected"; +export const API_ACCESS_BAD = "apiNotConnected"; /** * Fipamo Administration API From b9056b64df0d1b279356c7aa0ae0a3fcb7a3c42c Mon Sep 17 00:00:00 2001 From: Ro Date: Fri, 25 Jun 2021 14:53:37 -0700 Subject: [PATCH 6/8] more commenting for API classess, edited constructor for Admin and Util, updated backend API, added jsdoc --- brain/api/v1/InitAPI.inc.php | 22 ++-- brain/controller/APIControl.inc.php | 16 ++- public/assets/scripts/dash.min.js | 8 +- src/com/controllers/SettingsIndex.js | 1 - src/libraries/FipamoAdminAPI.js | 25 +++-- src/libraries/FipamoContentAPI.js | 35 ++++-- src/libraries/FipamoUtilityAPI.js | 35 ++++-- src/package-lock.json | 152 ++++++++++++++++++++++++++- src/package.json | 2 + 9 files changed, 253 insertions(+), 43 deletions(-) diff --git a/brain/api/v1/InitAPI.inc.php b/brain/api/v1/InitAPI.inc.php index dfa9b0e..871e068 100644 --- a/brain/api/v1/InitAPI.inc.php +++ b/brain/api/v1/InitAPI.inc.php @@ -8,13 +8,21 @@ class InitAPI public static function handleInitTasks($task, $request) { - switch ($task) { - case "init": - $result = Setup::init($request); - break; - case "restore": - $result = Setup::restore($request); - break; + //check if a site config already exists. if it does, deny set up request + //restore to previous version of site while a config exists is only accessible + //through settings. + + if (Setup::status()) { + $result = ["type" => "blogInitFail", "message" => "Site already set up"]; + } else { + switch ($task) { + case "init": + $result = Setup::init($request); + break; + case "restore": + $result = Setup::restore($request); + break; + } } return $result; diff --git a/brain/controller/APIControl.inc.php b/brain/controller/APIControl.inc.php index 5a974b1..9c8562e 100644 --- a/brain/controller/APIControl.inc.php +++ b/brain/controller/APIControl.inc.php @@ -117,7 +117,21 @@ class APIControl } break; case "login": //move to 'api/auth' - $result = AuthAPI::login($body); + //check if request is remote and if so, verify token + if ($body["remote"] || $body["remote"] == "true") { + if (Member::verifyKey($body["key"])) { + $result = AuthAPI::login($body); + } else { + $result = [ + "message" => "API access denied, homie", + "type" => "API_ERROR", + ]; + } + } else { + //request is local, so it's cool + $result = AuthAPI::login($body); + } + break; case "logout": //move to 'api/auth' $result = AuthAPI::logout($body); diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 751c142..0e4ec63 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var h=new XMLHttpRequest;if(h.upload.onprogress=i.handleLoadProgress,h.open(n,e,!0),h.onload=function(){if(200==h.status){var e=JSON.parse(h.response);a(e)}else{var t=JSON.parse(h.response);c(t)}},"PUT"==n||n==s)switch(t!==d&&t!==p&&t!==g&&t!==f&&t!==m||h.setRequestHeader("fipamo-access-token",i.token),r){case l:h.setRequestHeader("Content-type","application/"+r),h.send(JSON.stringify(o));break;case u:h.send(o)}else h.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),y="POST",b="json",w="x-www-form-urlencoded",E=function(){function t(){e(this,t)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",y,b,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}for(var a=new FormData,s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:b,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==y)switch(r){case b:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case w:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),I=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),S="requestLame",T="postUpdated";new function t(){e(this,t)};var k=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 k).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),D="editorDelete",P="editorUploadImage",_="editorSave",B="editorUpdate";new function t(){e(this,t)};var A=["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"],C=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&A.push("width"),A.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function O(e){return(O="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 M=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}},N=function(e){return"object"===O(e)&&null!==e},L=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=C(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):L(e,t)},H=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;N(t)&&(r=t,t=null);var o=M(r),i=R(e,o);return t||0===t?i.setPos(t):i.getPosition()},F=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=H(e.textEditor).pos;t.refresh(),H(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case T: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((function(){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 P:var n,r;H(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=H(this.textEditor).pos,this.emitEvent(P);break;case"submit-save":case"edit-save":this.emitEvent(_);break;case"submit-update":case"edit-update":this.emitEvent(B);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(D)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function z(e,t){return e.apply(null,t)}var G={arr:function(e){return Array.isArray(e)},obj:function(e){return W(Object.prototype.toString.call(e),"Object")},pth:function(e){return G.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||G.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 G.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 G.hex(e)||G.rgb(e)||G.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!U.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Q(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function V(e,t){var n=Q(e),r=j(G.und(n[0])?1:n[0],.1,100),o=j(G.und(n[1])?100:n[1],.1,100),i=j(G.und(n[2])?10:n[2],.1,100),a=j(G.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=Y.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Y.springs[e]=i,i}}function J(e){return void 0===e&&(e=10),function(t){return Math.ceil(j(t,1e-6,1)*e)*(1/e)}}var $,Z,K=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),ee=($={linear:function(){return function(e){return e}}},Z={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=j(e,1,10),r=j(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){Z[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(Z).forEach((function(e){var t=Z[e];$["easeIn"+e]=t,$["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},$["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}},$["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}}})),$);function te(e,t){if(G.fnc(e))return e;var n=e.split("(")[0],r=ee[n],o=Q(e);switch(n){case"spring":return V(e,t);case"cubicBezier":return z(K,o);case"steps":return z(J,o);default:return z(r,o)}}function ne(e){try{return document.querySelectorAll(e)}catch(e){return}}function re(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function de(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 fe(e,t){return G.fnc(e)?e(t.target,t.id,t.total):e}function he(e,t){return e.getAttribute(t)}function pe(e,t,n){if(ae([n,"deg","rad","turn"],de(t)))return t;var r=Y.CSS[t+n];if(!G.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return Y.CSS[t+n]=s,s}function ge(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?pe(e,o,n):o}}function me(e,t){return G.dom(e)&&!G.inp(e)&&(!G.nil(he(e,t))||G.svg(e)&&e[t])?"attribute":G.dom(e)&&ae(q,t)?"transform":G.dom(e)&&"transform"!==t&&ge(e,t)?"css":null!=e[t]?"object":void 0}function ve(e){if(G.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function ye(e,t,n,r){var o=W(t,"scale")?1:0+function(e){return W(e,"translate")||"perspective"===e?"px":W(e,"rotate")||W(e,"skew")?"deg":void 0}(t),i=ve(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?pe(e,i,r):i}function be(e,t,n,r){switch(me(e,t)){case"transform":return ye(e,t,r,n);case"css":return ge(e,t,n);case"attribute":return he(e,t);default:return e[t]||0}}function we(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=de(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Ee(e,t){if(G.col(e))return ce(e);if(/\s/g.test(e))return e;var n=de(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Ie(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Se(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Ie(t,i)),t=i}return r}function Te(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*he(e,"r")}(e);case"rect":return function(e){return 2*he(e,"width")+2*he(e,"height")}(e);case"line":return function(e){return Ie({x:he(e,"x1"),y:he(e,"y1")},{x:he(e,"x2"),y:he(e,"y2")})}(e);case"polyline":return Se(e);case"polygon":return function(e){var t=e.points;return Se(e)+Ie(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function ke(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;G.svg(t)&&G.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=he(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function xe(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 o=ke(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function De(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ee(G.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:G.str(e)||t?r.split(n):[]}}function Pe(e){return re(e?oe(G.arr(e)?e.map(ie):ie(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function _e(e){var t=Pe(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ve(e)}}}))}function Be(e,t){var n=se(t);if(/^spring/.test(n.easing)&&(n.duration=V(n.easing)),G.arr(e)){var r=e.length;2===r&&!G.obj(e[0])?e={value:e}:G.fnc(t.duration)||(n.duration=t.duration/r)}var o=G.arr(e)?e:[e];return o.map((function(e,n){var r=G.obj(e)&&!G.pth(e)?e:{value:e};return G.und(r.delay)&&(r.delay=n?0:t.delay),G.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ue(e,n)}))}function Ae(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ue(function(e){for(var t=re(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return G.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)G.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ue.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(He.forEach((function(e){return e._onDocumentVisibility()})),Fe()))})),function(){e||Xe()&&Ue.suspendWhenDocumentHidden||!(He.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function Ue(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=le(X,e),n=le(U,e),r=Ae(n,e),o=_e(e.targets),i=Ne(o,r),a=Le(i,n),s=Re;return Re++,ue(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ue.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0, -l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Me(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ue.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,He.push(l),d(),Fe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ye(Pe(e),l)},l.reset(),l.autoplay&&l.play(),l}function qe(e,t){for(var n=t.length;n--;)ae(e,t[n].animatable.target)&&t.splice(n,1)}function Ye(e,t){var n=t.animations,r=t.children;qe(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;qe(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ue.version="3.2.1",Ue.speed=1,Ue.suspendWhenDocumentHidden=!0,Ue.running=He,Ue.remove=function(e){for(var t=Pe(e),n=He.length;n--;){Ye(t,He[n])}},Ue.get=be,Ue.set=Me,Ue.convertPx=pe,Ue.path=function(e,t){var n=G.str(e)?ne(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:ke(n),totalLength:Te(n)*(r/100)}}},Ue.setDashoffset=function(e){var t=Te(e);return e.setAttribute("stroke-dasharray",t),t},Ue.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?te(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=G.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=de(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&He.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;$e.alert("Uploading Image",null),(new E).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(P,e.url),$e.alert("Image Added to Entry",!0)})).catch((function(){$e.alert("Uh oh. Image not added",!1)}))}}]),t}();Ze.uploadFiles=[];var Ke=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new Ze}}}]),t}(),et=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,o&&(this.key=o),r&&(this.baseURL=r),this._request(c).then((function(e){e.type===y&&(n.token=e.token)}))}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t.baseURL?(e.key=t.key,e.remote=!0):e.remote=!1,t._request(t.baseURL?t.baseURL+d:d,"getAuthStatus",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/sync",f,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/publish",h,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,i=this;switch(e){case p:n="/api/v1/page/create",r=p,o=u;break;case g:n="/api/v1/page/write",r=g,o=u;break;case m:n="/api/v1/page/delete",r=m,o=l}return new Promise((function(e,a){i._request(n,r,s,o,t).then((function(t){e(t)})).catch((function(e){a(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/nav-sync",f,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/mailer","sendMail",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"reindexPages",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/reindex",v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var d=new XMLHttpRequest;if(d.upload.onprogress=i.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);a(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==f&&t!==g&&t!==m&&t!==h&&t!==v||d.setRequestHeader("fipamo-access-token",i.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),w="POST",E="json",I="x-www-form-urlencoded",k=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}var a=new FormData;n.baseURL?(a.append("key",n.key),a.append("remote",!0)):a.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==w)switch(r){case E:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case I:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),S=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),T="requestLame",x="postUpdated";new function t(){e(this,t)};var D=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 D).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),_="editorDelete",B="editorUploadImage",A="editorSave",C="editorUpdate";new function t(){e(this,t)};var O=["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"],M=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&O.push("width"),O.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function N(e){return(N="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 L=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}},R=function(e){return"object"===N(e)&&null!==e},H=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=M(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},F=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):H(e,t)},U=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;R(t)&&(r=t,t=null);var o=L(r),i=F(e,o);return t||0===t?i.setPos(t):i.getPosition()},X=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=U(e.textEditor).pos;t.refresh(),U(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case x: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((function(){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 B:var n,r;U(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=U(this.textEditor).pos,this.emitEvent(B);break;case"submit-save":case"edit-save":this.emitEvent(A);break;case"submit-update":case"edit-update":this.emitEvent(C);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(_)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function Q(e,t){return e.apply(null,t)}var V={arr:function(e){return Array.isArray(e)},obj:function(e){return G(Object.prototype.toString.call(e),"Object")},pth:function(e){return V.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||V.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 V.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 V.hex(e)||V.rgb(e)||V.hsl(e)},key:function(e){return!q.hasOwnProperty(e)&&!Y.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function J(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function $(e,t){var n=J(e),r=z(V.und(n[0])?1:n[0],.1,100),o=z(V.und(n[1])?100:n[1],.1,100),i=z(V.und(n[2])?10:n[2],.1,100),a=z(V.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=W.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=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(z(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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+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=z(e,1,10),r=z(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(V.fnc(e))return e;var n=e.split("(")[0],r=ne[n],o=J(e);switch(n){case"spring":return $(e,t);case"cubicBezier":return Q(te,o);case"steps":return Q(Z,o);default:return Q(r,o)}}function oe(e){try{return document.querySelectorAll(e)}catch(e){return}}function ie(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function he(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 pe(e,t){return V.fnc(e)?e(t.target,t.id,t.total):e}function ge(e,t){return e.getAttribute(t)}function me(e,t,n){if(le([n,"deg","rad","turn"],he(t)))return t;var r=W.CSS[t+n];if(!V.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*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(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?me(e,o,n):o}}function ye(e,t){return V.dom(e)&&!V.inp(e)&&(!V.nil(ge(e,t))||V.svg(e)&&e[t])?"attribute":V.dom(e)&&le(j,t)?"transform":V.dom(e)&&"transform"!==t&&ve(e,t)?"css":null!=e[t]?"object":void 0}function be(e){if(V.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function we(e,t,n,r){var o=G(t,"scale")?1:0+function(e){return G(e,"translate")||"perspective"===e?"px":G(e,"rotate")||G(e,"skew")?"deg":void 0}(t),i=be(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?me(e,i,r):i}function Ee(e,t,n,r){switch(ye(e,t)){case"transform":return we(e,t,r,n);case"css":return ve(e,t,n);case"attribute":return ge(e,t);default:return e[t]||0}}function Ie(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=he(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function ke(e,t){if(V.col(e))return fe(e);if(/\s/g.test(e))return e;var n=he(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 Te(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Se(t,i)),t=i}return r}function xe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ge(e,"r")}(e);case"rect":return function(e){return 2*ge(e,"width")+2*ge(e,"height")}(e);case"line":return function(e){return Se({x:ge(e,"x1"),y:ge(e,"y1")},{x:ge(e,"x2"),y:ge(e,"y2")})}(e);case"polyline":return Te(e);case"polygon":return function(e){var t=e.points;return Te(e)+Se(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function De(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;V.svg(t)&&V.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ge(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Pe(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 o=De(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function _e(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ke(V.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:V.str(e)||t?r.split(n):[]}}function Be(e){return ie(e?ae(V.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ae(e){var t=Be(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:be(e)}}}))}function Ce(e,t){var n=ue(t);if(/^spring/.test(n.easing)&&(n.duration=$(n.easing)),V.arr(e)){var r=e.length;2===r&&!V.obj(e[0])?e={value:e}:V.fnc(t.duration)||(n.duration=t.duration/r)}var o=V.arr(e)?e:[e];return o.map((function(e,n){var r=V.obj(e)&&!V.pth(e)?e:{value:e};return V.und(r.delay)&&(r.delay=n?0:t.delay),V.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return de(e,n)}))}function Oe(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=de(function(e){for(var t=ie(ae(e.map((function(e){return Object.keys(e)}))),(function(e){return V.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)V.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ye.suspendWhenDocumentHidden&&(qe()?e=cancelAnimationFrame(e):(Ue.forEach((function(e){return e._onDocumentVisibility()})),Xe()))})),function(){e||qe()&&Ye.suspendWhenDocumentHidden||!(Ue.length>0)||(e=requestAnimationFrame(t))}}();function qe(){return!!document&&document.hidden}function Ye(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ce(q,e),n=ce(Y,e),r=Oe(n,e),o=Ae(e.targets),i=Re(o,r),a=He(i,n),s=Fe;return Fe++,de(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ye.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Le(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ye.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ue.push(l),d(),Xe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){We(Be(e),l)},l.reset(),l.autoplay&&l.play(),l}function je(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;je(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;je(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ye.version="3.2.1",Ye.speed=1,Ye.suspendWhenDocumentHidden=!0,Ye.running=Ue,Ye.remove=function(e){for(var t=Be(e),n=Ue.length;n--;){We(t,Ue[n])}},Ye.get=Ee,Ye.set=Le,Ye.convertPx=me,Ye.path=function(e,t){var n=V.str(e)?oe(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:De(n),totalLength:xe(n)*(r/100)}}},Ye.setDashoffset=function(e){var t=xe(e);return e.setAttribute("stroke-dasharray",t),t},Ye.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?re(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=V.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=he(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ue.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;Ke.alert("Uploading Image",null),(new k).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(B,e.url),Ke.alert("Image Added to Entry",!0)})).catch((function(){Ke.alert("Uh oh. Image not added",!1)}))}}]),t}();et.uploadFiles=[];var tt=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new et}}}]),t}(),nt=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function at(e){return(at="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 st(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(){return(lt=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function dt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var ft=dt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ht=dt(/Edge/i),pt=dt(/firefox/i),gt=dt(/safari/i)&&!dt(/chrome/i)&&!dt(/android/i),mt=dt(/iP(ad|od|hone)/i),vt=dt(/chrome/i)&&dt(/android/i),yt={capture:!1,passive:!1};function bt(e,t,n){e.addEventListener(t,n,!ft&&yt)}function wt(e,t,n){e.removeEventListener(t,n,!ft&&yt)}function Et(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 It(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function St(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Et(e,t):Et(e,t))||r&&e===n)return e;if(e===n)break}while(e=It(e))}return null}var Tt,kt=/\s+/g;function xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(kt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(kt," ")}}function Dt(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 Pt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Dt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function _t(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Bt())break;r=Rt(r,!1)}return!1}function Ot(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ct(n,["evt"]);zt.pluginEvent.bind(Xn)(e,t,ut({dragEl:Vt,parentEl:Jt,ghostEl:$t,rootEl:Zt,nextEl:Kt,lastDownEl:en,cloneEl:tn,cloneHidden:nn,dragStarted:mn,putSortable:un,activeSortable:Xn.active,originalEvent:r,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn,hideGhostForTarget:Ln,unhideGhostForTarget:Rn,cloneNowHidden:function(){nn=!0},cloneNowShown:function(){nn=!1},dispatchSortableEvent:function(e){Qt({sortable:t,name:e,originalEvent:r})}},o))};function Qt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[qt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||ft||ht?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=ut({},p,zt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ut({putSortable:un,cloneEl:tn,targetEl:Vt,rootEl:Zt,oldIndex:rn,oldDraggableIndex:an,newIndex:on,newDraggableIndex:sn},e))}var Vt,Jt,$t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En=!1,In=!1,Sn=[],Tn=!1,kn=!1,xn=[],Dn=!1,Pn=[],_n="undefined"!=typeof document,Bn=mt,An=ht||ft?"cssFloat":"float",Cn=_n&&!vt&&!mt&&"draggable"in document.createElement("div"),On=function(){if(_n){if(ft)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Mn=function(e,t){var n=Dt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ot(e,0,t),i=Ot(e,1,t),a=o&&Dt(o),s=i&&Dt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+At(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+At(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[An]||i&&"none"===n[An]&&l+u>r)?"vertical":"horizontal"},Nn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==at(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},Ln=function(){!On&&$t&&Dt($t,"display","none")},Rn=function(){!On&&$t&&Dt($t,"display","")};_n&&document.addEventListener("click",(function(e){if(In)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),In=!1,!1}),!0);var Hn=function(e){if(Vt){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Sn.some((function(e){if(!Mt(e)){var t=At(e),n=e[qt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[qt]._onDragOver(n)}}var o,i,a},Fn=function(e){Vt&&Vt.parentNode[qt]._isOutsideThisEl(e.target)};function Xn(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=lt({},t),e[qt]=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 Mn(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!==Xn.supportPointer&&"PointerEvent"in window&&!gt,emptyInsertThreshold:5};for(var r in zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Nn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Cn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?bt(e,"pointerdown",this._onTapStart):(bt(e,"mousedown",this._onTapStart),bt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(bt(e,"dragover",this),bt(e,"dragenter",this)),Sn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),lt(this,Yt())}function Un(e,t,n,r,o,i,a,s){var l,u,c=e[qt],d=c.options.onMove;return!window.CustomEvent||ft||ht?(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=o||t,l.relatedRect=i||At(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function qn(e){e.draggable=!1}function Yn(){Dn=!1}function jn(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 Wn(e){return setTimeout(e,0)}function zn(e){return clearTimeout(e)}Xn.prototype={constructor:Xn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(vn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Vt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Pn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Pn.push(r)}}(n),!Vt&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!gt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=St(s,r.draggable,n,!1))&&s.animated||en===s)){if(rn=Nt(s),an=Nt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Qt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Gt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=St(l,r.trim(),n,!1))return Qt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Gt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!St(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!Vt&&n.parentNode===i){var l=At(n);if(Zt=i,Jt=(Vt=n).parentNode,Kt=Vt.nextSibling,en=n,ln=a.group,Xn.dragged=Vt,cn={target:Vt,clientX:(t||e).clientX,clientY:(t||e).clientY},pn=cn.clientX-l.left,gn=cn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Vt.style["will-change"]="all",r=function(){Gt("delayEnded",o,{evt:e}),Xn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!pt&&o.nativeDraggable&&(Vt.draggable=!0),o._triggerDragStart(e,t),Qt({sortable:o,name:"choose",originalEvent:e}),xt(Vt,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){_t(Vt,e.trim(),qn)})),bt(s,"dragover",Hn),bt(s,"mousemove",Hn),bt(s,"touchmove",Hn),bt(s,"mouseup",o._onDrop),bt(s,"touchend",o._onDrop),bt(s,"touchcancel",o._onDrop),pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Vt.draggable=!0),Gt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(ht||ft))r();else{if(Xn.eventCanceled)return void this._onDrop();bt(s,"mouseup",o._disableDelayedDrag),bt(s,"touchend",o._disableDelayedDrag),bt(s,"touchcancel",o._disableDelayedDrag),bt(s,"mousemove",o._delayedDragTouchMoveHandler),bt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&bt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){Vt&&qn(Vt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._disableDelayedDrag),wt(e,"touchend",this._disableDelayedDrag),wt(e,"touchcancel",this._disableDelayedDrag),wt(e,"mousemove",this._delayedDragTouchMoveHandler),wt(e,"touchmove",this._delayedDragTouchMoveHandler),wt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?bt(document,"pointermove",this._onTouchMove):bt(document,t?"touchmove":"mousemove",this._onTouchMove):(bt(Vt,"dragend",this),bt(Zt,"dragstart",this._onDragStart));try{document.selection?Wn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(En=!1,Zt&&Vt){Gt("dragStarted",this,{evt:t}),this.nativeDraggable&&bt(document,"dragover",Fn);var n=this.options;!e&&xt(Vt,n.dragClass,!1),xt(Vt,n.ghostClass,!0),Xn.active=this,e&&this._appendGhost(),Qt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(dn){this._lastX=dn.clientX,this._lastY=dn.clientY,Ln();for(var e=document.elementFromPoint(dn.clientX,dn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(dn.clientX,dn.clientY))!==t;)t=e;if(Vt.parentNode[qt]._isOutsideThisEl(e),t)do{if(t[qt]){if(t[qt]._onDragOver({clientX:dn.clientX,clientY:dn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Rn()}},_onTouchMove:function(e){if(cn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=$t&&Pt($t,!0),a=$t&&i&&i.a,s=$t&&i&&i.d,l=Bn&&wn&&Lt(wn),u=(o.clientX-cn.clientX+r.x)/(a||1)+(l?l[0]-xn[0]:0)/(a||1),c=(o.clientY-cn.clientY+r.y)/(s||1)+(l?l[1]-xn[1]:0)/(s||1);if(!Xn.active&&!En){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===Vt)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=At(a)),!1!==Un(Zt,i,Vt,t,a,n,e,!!a))return _(),i.appendChild(Vt),Jt=i,A(),B(!0)}else if(a.parentNode===i){n=At(a);var m,v,y,b=Vt.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(Vt.animated&&Vt.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ct(a,"top","top")||Ct(Vt,"top","top"),S=I?I.scrollTop:void 0;if(vn!==a&&(v=n[E],Tn=!1,kn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&bnc+u*i/2:ld-bn)return-yn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,kn,vn===a))){var T=Nt(Vt);do{T-=m,y=Jt.children[T]}while(y&&("none"===Dt(y,"display")||y===$t))}if(0===m||y===a)return B(!1);vn=a,yn=m;var k=a.nextElementSibling,x=!1,D=Un(Zt,i,Vt,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Dn=!0,setTimeout(Yn,30),_(),x&&!k?i.appendChild(Vt):a.parentNode.insertBefore(Vt,x?k:a),I&&Xt(I,0,S-I.scrollTop),Jt=Vt.parentNode,void 0===v||kn||(bn=Math.abs(v-At(a)[E])),A(),B(!0)}if(i.contains(Vt))return B(!1)}return!1}function P(s,l){Gt(s,h,ut({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Un(Zt,i,Vt,t,n,At(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(xt(Vt,un?un.options.ghostClass:u.options.ghostClass,!1),xt(Vt,s.ghostClass,!0)),un!==h&&h!==Xn.active?un=h:h===Xn.active&&un&&(un=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Vt&&!Vt.animated||a===i&&!a.animated)&&(vn=null),s.dragoverBubble||e.rootEl||a===document||(Vt.parentNode[qt]._isOutsideThisEl(e.target),!t&&Hn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){on=Nt(Vt),sn=Nt(Vt,s.draggable),Qt({sortable:h,name:"change",toEl:i,newIndex:on,newDraggableIndex:sn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){wt(document,"mousemove",this._onTouchMove),wt(document,"touchmove",this._onTouchMove),wt(document,"pointermove",this._onTouchMove),wt(document,"dragover",Hn),wt(document,"mousemove",Hn),wt(document,"touchmove",Hn)},_offUpEvents:function(){var e=this.el.ownerDocument;wt(e,"mouseup",this._onDrop),wt(e,"touchend",this._onDrop),wt(e,"pointerup",this._onDrop),wt(e,"touchcancel",this._onDrop),wt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;on=Nt(Vt),sn=Nt(Vt,n.draggable),Gt("drop",this,{evt:e}),Jt=Vt&&Vt.parentNode,on=Nt(Vt),sn=Nt(Vt,n.draggable),Xn.eventCanceled||(En=!1,kn=!1,Tn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zn(this.cloneId),zn(this._dragStartId),this.nativeDraggable&&(wt(document,"drop",this),wt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),gt&&Dt(document.body,"user-select",""),Dt(Vt,"transform",""),e&&(mn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),$t&&$t.parentNode&&$t.parentNode.removeChild($t),(Zt===Jt||un&&"clone"!==un.lastPutMode)&&tn&&tn.parentNode&&tn.parentNode.removeChild(tn),Vt&&(this.nativeDraggable&&wt(Vt,"dragend",this),qn(Vt),Vt.style["will-change"]="",mn&&!En&&xt(Vt,un?un.options.ghostClass:this.options.ghostClass,!1),xt(Vt,this.options.chosenClass,!1),Qt({sortable:this,name:"unchoose",toEl:Jt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Zt!==Jt?(on>=0&&(Qt({rootEl:Jt,name:"add",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"remove",toEl:Jt,originalEvent:e}),Qt({rootEl:Jt,name:"sort",toEl:Jt,fromEl:Zt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),un&&un.save()):on!==rn&&on>=0&&(Qt({sortable:this,name:"update",toEl:Jt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),Xn.active&&(null!=on&&-1!==on||(on=rn,sn=an),Qt({sortable:this,name:"end",toEl:Jt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Gt("nulling",this),Zt=Vt=Jt=$t=Kt=tn=en=nn=cn=dn=mn=on=sn=rn=an=vn=yn=un=ln=Xn.dragged=Xn.ghost=Xn.clone=Xn.active=null,Pn.forEach((function(e){e.checked=!0})),Pn.length=fn=hn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Vt&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ht(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var pt=ht(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),gt=ht(/Edge/i),mt=ht(/firefox/i),vt=ht(/safari/i)&&!ht(/chrome/i)&&!ht(/android/i),yt=ht(/iP(ad|od|hone)/i),bt=ht(/chrome/i)&&ht(/android/i),wt={capture:!1,passive:!1};function Et(e,t,n){e.addEventListener(t,n,!pt&&wt)}function It(e,t,n){e.removeEventListener(t,n,!pt&&wt)}function kt(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 St(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&&kt(e,t):kt(e,t))||r&&e===n)return e;if(e===n)break}while(e=St(e))}return null}var xt,Dt=/\s+/g;function Pt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Dt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Dt," ")}}function _t(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 Bt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=_t(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function At(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Ct())break;r=Ft(r,!1)}return!1}function Nt(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ft(n,["evt"]);Qt.pluginEvent.bind(qn)(e,t,dt({dragEl:$t,parentEl:Zt,ghostEl:Kt,rootEl:en,nextEl:tn,lastDownEl:nn,cloneEl:rn,cloneHidden:on,dragStarted:yn,putSortable:dn,activeSortable:qn.active,originalEvent:r,oldIndex:an,oldDraggableIndex:ln,newIndex:sn,newDraggableIndex:un,hideGhostForTarget:Hn,unhideGhostForTarget:Fn,cloneNowHidden:function(){on=!0},cloneNowShown:function(){on=!1},dispatchSortableEvent:function(e){Jt({sortable:t,name:e,originalEvent:r})}},o))};function Jt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[jt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||pt||gt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=dt({},p,Qt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(dt({putSortable:dn,cloneEl:rn,targetEl:$t,rootEl:en,oldIndex:an,oldDraggableIndex:ln,newIndex:sn,newDraggableIndex:un},e))}var $t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn=!1,Sn=!1,Tn=[],xn=!1,Dn=!1,Pn=[],_n=!1,Bn=[],An="undefined"!=typeof document,Cn=yt,On=gt||pt?"cssFloat":"float",Mn=An&&!bt&&!yt&&"draggable"in document.createElement("div"),Nn=function(){if(An){if(pt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ln=function(e,t){var n=_t(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Nt(e,0,t),i=Nt(e,1,t),a=o&&_t(o),s=i&&_t(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ot(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ot(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[On]||i&&"none"===n[On]&&l+u>r)?"vertical":"horizontal"},Rn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==lt(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},Hn=function(){!Nn&&Kt&&_t(Kt,"display","none")},Fn=function(){!Nn&&Kt&&_t(Kt,"display","")};An&&document.addEventListener("click",(function(e){if(Sn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Sn=!1,!1}),!0);var Un=function(e){if($t){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Tn.some((function(e){if(!Lt(e)){var t=Ot(e),n=e[jt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[jt]._onDragOver(n)}}var o,i,a},Xn=function(e){$t&&$t.parentNode[jt]._isOutsideThisEl(e.target)};function qn(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=ct({},t),e[jt]=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 Ln(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!==qn.supportPointer&&"PointerEvent"in window&&!vt,emptyInsertThreshold:5};for(var r in Qt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Rn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Mn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Et(e,"pointerdown",this._onTapStart):(Et(e,"mousedown",this._onTapStart),Et(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Et(e,"dragover",this),Et(e,"dragenter",this)),Tn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ct(this,Wt())}function Yn(e,t,n,r,o,i,a,s){var l,u,c=e[jt],d=c.options.onMove;return!window.CustomEvent||pt||gt?(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=o||t,l.relatedRect=i||Ot(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function jn(e){e.draggable=!1}function Wn(){_n=!1}function zn(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 Gn(e){return setTimeout(e,0)}function Qn(e){return clearTimeout(e)}qn.prototype={constructor:qn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(bn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,$t):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Bn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Bn.push(r)}}(n),!$t&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!vt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Tt(s,r.draggable,n,!1))&&s.animated||nn===s)){if(an=Rt(s),ln=Rt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Jt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Vt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Tt(l,r.trim(),n,!1))return Jt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Vt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Tt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!$t&&n.parentNode===i){var l=Ot(n);if(en=i,Zt=($t=n).parentNode,tn=$t.nextSibling,nn=n,cn=a.group,qn.dragged=$t,fn={target:$t,clientX:(t||e).clientX,clientY:(t||e).clientY},mn=fn.clientX-l.left,vn=fn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,$t.style["will-change"]="all",r=function(){Vt("delayEnded",o,{evt:e}),qn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!mt&&o.nativeDraggable&&($t.draggable=!0),o._triggerDragStart(e,t),Jt({sortable:o,name:"choose",originalEvent:e}),Pt($t,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){At($t,e.trim(),jn)})),Et(s,"dragover",Un),Et(s,"mousemove",Un),Et(s,"touchmove",Un),Et(s,"mouseup",o._onDrop),Et(s,"touchend",o._onDrop),Et(s,"touchcancel",o._onDrop),mt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$t.draggable=!0),Vt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(gt||pt))r();else{if(qn.eventCanceled)return void this._onDrop();Et(s,"mouseup",o._disableDelayedDrag),Et(s,"touchend",o._disableDelayedDrag),Et(s,"touchcancel",o._disableDelayedDrag),Et(s,"mousemove",o._delayedDragTouchMoveHandler),Et(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&Et(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){$t&&jn($t),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;It(e,"mouseup",this._disableDelayedDrag),It(e,"touchend",this._disableDelayedDrag),It(e,"touchcancel",this._disableDelayedDrag),It(e,"mousemove",this._delayedDragTouchMoveHandler),It(e,"touchmove",this._delayedDragTouchMoveHandler),It(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Et(document,"pointermove",this._onTouchMove):Et(document,t?"touchmove":"mousemove",this._onTouchMove):(Et($t,"dragend",this),Et(en,"dragstart",this._onDragStart));try{document.selection?Gn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(kn=!1,en&&$t){Vt("dragStarted",this,{evt:t}),this.nativeDraggable&&Et(document,"dragover",Xn);var n=this.options;!e&&Pt($t,n.dragClass,!1),Pt($t,n.ghostClass,!0),qn.active=this,e&&this._appendGhost(),Jt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(hn){this._lastX=hn.clientX,this._lastY=hn.clientY,Hn();for(var e=document.elementFromPoint(hn.clientX,hn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(hn.clientX,hn.clientY))!==t;)t=e;if($t.parentNode[jt]._isOutsideThisEl(e),t)do{if(t[jt]){if(t[jt]._onDragOver({clientX:hn.clientX,clientY:hn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Fn()}},_onTouchMove:function(e){if(fn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=Kt&&Bt(Kt,!0),a=Kt&&i&&i.a,s=Kt&&i&&i.d,l=Cn&&In&&Ht(In),u=(o.clientX-fn.clientX+r.x)/(a||1)+(l?l[0]-Pn[0]:0)/(a||1),c=(o.clientY-fn.clientY+r.y)/(s||1)+(l?l[1]-Pn[1]:0)/(s||1);if(!qn.active&&!kn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===$t)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ot(a)),!1!==Yn(en,i,$t,t,a,n,e,!!a))return _(),i.appendChild($t),Zt=i,A(),B(!0)}else if(a.parentNode===i){n=Ot(a);var m,v,y,b=$t.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}($t.animated&&$t.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Mt(a,"top","top")||Mt($t,"top","top"),k=I?I.scrollTop:void 0;if(bn!==a&&(v=n[E],xn=!1,Dn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Enc+u*i/2:ld-En)return-wn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Dn,bn===a))){var S=Rt($t);do{S-=m,y=Zt.children[S]}while(y&&("none"===_t(y,"display")||y===Kt))}if(0===m||y===a)return B(!1);bn=a,wn=m;var T=a.nextElementSibling,x=!1,D=Yn(en,i,$t,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),_n=!0,setTimeout(Wn,30),_(),x&&!T?i.appendChild($t):a.parentNode.insertBefore($t,x?T:a),I&&qt(I,0,k-I.scrollTop),Zt=$t.parentNode,void 0===v||Dn||(En=Math.abs(v-Ot(a)[E])),A(),B(!0)}if(i.contains($t))return B(!1)}return!1}function P(s,l){Vt(s,h,dt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Yn(en,i,$t,t,n,Ot(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Pt($t,dn?dn.options.ghostClass:u.options.ghostClass,!1),Pt($t,s.ghostClass,!0)),dn!==h&&h!==qn.active?dn=h:h===qn.active&&dn&&(dn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===$t&&!$t.animated||a===i&&!a.animated)&&(bn=null),s.dragoverBubble||e.rootEl||a===document||($t.parentNode[jt]._isOutsideThisEl(e.target),!t&&Un(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){sn=Rt($t),un=Rt($t,s.draggable),Jt({sortable:h,name:"change",toEl:i,newIndex:sn,newDraggableIndex:un,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){It(document,"mousemove",this._onTouchMove),It(document,"touchmove",this._onTouchMove),It(document,"pointermove",this._onTouchMove),It(document,"dragover",Un),It(document,"mousemove",Un),It(document,"touchmove",Un)},_offUpEvents:function(){var e=this.el.ownerDocument;It(e,"mouseup",this._onDrop),It(e,"touchend",this._onDrop),It(e,"pointerup",this._onDrop),It(e,"touchcancel",this._onDrop),It(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;sn=Rt($t),un=Rt($t,n.draggable),Vt("drop",this,{evt:e}),Zt=$t&&$t.parentNode,sn=Rt($t),un=Rt($t,n.draggable),qn.eventCanceled||(kn=!1,Dn=!1,xn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Qn(this.cloneId),Qn(this._dragStartId),this.nativeDraggable&&(It(document,"drop",this),It(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),vt&&_t(document.body,"user-select",""),_t($t,"transform",""),e&&(yn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Kt&&Kt.parentNode&&Kt.parentNode.removeChild(Kt),(en===Zt||dn&&"clone"!==dn.lastPutMode)&&rn&&rn.parentNode&&rn.parentNode.removeChild(rn),$t&&(this.nativeDraggable&&It($t,"dragend",this),jn($t),$t.style["will-change"]="",yn&&!kn&&Pt($t,dn?dn.options.ghostClass:this.options.ghostClass,!1),Pt($t,this.options.chosenClass,!1),Jt({sortable:this,name:"unchoose",toEl:Zt,newIndex:null,newDraggableIndex:null,originalEvent:e}),en!==Zt?(sn>=0&&(Jt({rootEl:Zt,name:"add",toEl:Zt,fromEl:en,originalEvent:e}),Jt({sortable:this,name:"remove",toEl:Zt,originalEvent:e}),Jt({rootEl:Zt,name:"sort",toEl:Zt,fromEl:en,originalEvent:e}),Jt({sortable:this,name:"sort",toEl:Zt,originalEvent:e})),dn&&dn.save()):sn!==an&&sn>=0&&(Jt({sortable:this,name:"update",toEl:Zt,originalEvent:e}),Jt({sortable:this,name:"sort",toEl:Zt,originalEvent:e})),qn.active&&(null!=sn&&-1!==sn||(sn=an,un=ln),Jt({sortable:this,name:"end",toEl:Zt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Vt("nulling",this),en=$t=Zt=Kt=tn=rn=nn=on=fn=hn=yn=sn=un=an=ln=bn=wn=dn=cn=qn.dragged=qn.ghost=qn.clone=qn.active=null,Bn.forEach((function(e){e.checked=!0})),Bn.length=pn=gn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":$t&&(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,o=n.length,i=this.options;r { if (response.type === API_ACCESS_GOOD) { this.token = response.token; @@ -55,12 +58,18 @@ export default class FipamoAdminAPI { } /** * Method for retrieving user authorizing user login - * @param {object} data - json object that contains data for set up * @property {string} handle - handle for site user * @property {string} password - password for site user + * @param {object} data - json object that contains data for set up */ login(data) { return new Promise((resolve, reject) => { + if (this.baseURL) { + data.key = this.key; + data.remote = true; + } else { + data.remote = false; + } this._request( this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN, AUTH_STATUS, @@ -319,3 +328,5 @@ export default class FipamoAdminAPI { //pass element to display request progress } } + +export { FipamoAdminAPI as default }; diff --git a/src/libraries/FipamoContentAPI.js b/src/libraries/FipamoContentAPI.js index 8c33f56..b968ad9 100644 --- a/src/libraries/FipamoContentAPI.js +++ b/src/libraries/FipamoContentAPI.js @@ -20,13 +20,15 @@ export const TASK_GET_CONTENT = "retrieveContent"; /** * Fipamo Content API - * class for retrieving page data from install + * A bag of methods for getting page info from an install. + * To use remotely, include url of install and user key found in settings. */ -export default class FipamoAPI { +class FipamoContentAPI { /** * @constructor * @param {string} baseURL - url of site; uses local when empty * @param {string} key - user api key + * @author Ro */ constructor(baseURL = null, key = null) { this.baseURL = null; @@ -34,13 +36,16 @@ export default class FipamoAPI { if (key) this.key = key; if (baseURL) this.baseURL = baseURL; } - //-------------------------- - // methods - //-------------------------- /** - * Method for retrieving page data - * @param {string} type - type of pages being retrieved; defaults to published + * Promise method for retrieving page data + * @param {string} type - type of pages being retrieved; null value defaults to published + * @example + * api.pages('published').then(pages=>{ + * console.log("Pages Object", pages); + * }) + * @returns {object} json object that contains pages of requested type + * */ pages(type = null) { //set url based on request type @@ -71,8 +76,13 @@ export default class FipamoAPI { }); } /** - * Method for retrieving single page + * Promise method for retrieving single page * @param {string} id - uuid of desired page + * @example + * api.page("a-uuid-for-a-page").then(page=>{ + console.log("Page Object", page); + * }) + * @returns {object} json object that contains data for requested page */ page(id) { return new Promise((resolve, reject) => { @@ -93,7 +103,12 @@ export default class FipamoAPI { } /** - * Method for retrieving all tags used by pages + * Promise method for retrieving all tags used by pages + * @example + * api.tags().then(tags=>{ + console.log("Tags Object", tags); + * }) + * @returns {object} json object that contains tags used by pages */ tags() { return new Promise((resolve, reject) => { @@ -164,3 +179,5 @@ export default class FipamoAPI { //pass element to display request progress } } + +export { FipamoContentAPI as default }; diff --git a/src/libraries/FipamoUtilityAPI.js b/src/libraries/FipamoUtilityAPI.js index ac5defe..93cd775 100644 --- a/src/libraries/FipamoUtilityAPI.js +++ b/src/libraries/FipamoUtilityAPI.js @@ -28,16 +28,23 @@ export const TASK_UPLOAD_FILES = "uploadFiles"; /** * Fipamo Utility API - * Maintenance methods + * A tub of methods for creating/restoring installs, resetting passwords and uploading images. */ -export default class FipamoUtilityAPI { +class FipamoUtilityAPI { /** * @constructor + * @param {string} baseURL - url of site; uses local when empty + * @param {string} key - user api key */ - constructor() {} + constructor(baseURL = null, key = null) { + this.baseURL = null; + this.key = null; + if (key) this.key = key; + if (baseURL) this.baseURL = baseURL; + } /** - * Method used create new site + * Promise method used create new site from scratch. For local use only. * @param {object} data - json object that contains data for set up * @property {string} new_member_handle - handle for new user * @property {string} new_member_email - email for new user @@ -62,7 +69,7 @@ export default class FipamoUtilityAPI { }); } /** - * Method for restoring site from backup + * Promise method for restoring site from a previous back up. For local use only. * @param {object} form - form object that contains restore data and files * @property {string} restore_member_handle - handle for site user * @property {string} restore_member_pass - password for site user @@ -87,7 +94,7 @@ export default class FipamoUtilityAPI { }); } /** - * Method for creating a backup zip + * Promise method for creating a zip back up of current site. For local use only. */ backup() { @@ -111,7 +118,7 @@ export default class FipamoUtilityAPI { } /** - * Method for retrieving user secret key + * Promise method for retrieving user secret key. For local use only. * @param {object} data - json object that contains data for set up * @property {string} email - email for site user */ @@ -134,7 +141,7 @@ export default class FipamoUtilityAPI { }); } /** - * Method for resetting password for user + * Promise method for resetting password for user. For local use only. * @param {object} data - json object that contains data for set up * @property {string} new_password - password for user * @property {string} new_password2 - confirm password for user @@ -160,7 +167,7 @@ export default class FipamoUtilityAPI { } /** - * Method for uploading images [todo: change to uploading files] + * Promise method for uploading images [todo: change to uploading files] * @param {string} type - type of upload * @param {input} files - form input containing files */ @@ -179,6 +186,14 @@ export default class FipamoUtilityAPI { break; } var imageData = new FormData(); + + if (this.baseURL) { + imageData.append("key", this.key); + imageData.append("remote", true); + } else { + imageData.append("remote", false); + } + for (var i = 0; i < files.length; i++) { var file = files[i]; // Check the file type. @@ -266,3 +281,5 @@ export default class FipamoUtilityAPI { //pass element to display request progress } } + +export { FipamoUtilityAPI as default }; diff --git a/src/package-lock.json b/src/package-lock.json index 236d761..729ca42 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -374,7 +374,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -391,6 +390,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -434,6 +438,14 @@ "resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz", "integrity": "sha512-cOIiBS1SjzXg+LXSiQAzGg89dHDKq/y4c30+tB5hkVN7GbtXh1BNypOmjti4LwAWQrvP4y+bNG7RJFxLGoL3bA==" }, + "catharsis": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "requires": { + "lodash": "^4.17.15" + } + }, "chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", @@ -571,6 +583,11 @@ "ansi-colors": "^4.1.1" } }, + "entities": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==" + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -835,6 +852,11 @@ "type-fest": "^0.20.2" } }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -920,6 +942,42 @@ "esprima": "^4.0.0" } }, + "js2xmlparser": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.1.tgz", + "integrity": "sha512-KrPTolcw6RocpYjdC7pL7v62e55q7qOMHvLX1UCLc5AAS8qeJ6nukarEJAF2KL2PZxlbGueEbINqZR2bDe/gUw==", + "requires": { + "xmlcreate": "^2.0.3" + } + }, + "jsdoc": { + "version": "3.6.7", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.7.tgz", + "integrity": "sha512-sxKt7h0vzCd+3Y81Ey2qinupL6DpRSZJclS04ugHDNmRUXGzqicMJ6iwayhSA0S0DwwX30c5ozyUthr1QKF6uw==", + "requires": { + "@babel/parser": "^7.9.4", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.1", + "klaw": "^3.0.0", + "markdown-it": "^10.0.0", + "markdown-it-anchor": "^5.2.7", + "marked": "^2.0.3", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "taffydb": "2.6.2", + "underscore": "~1.13.1" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + } + } + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -945,6 +1003,14 @@ "minimist": "^1.2.5" } }, + "klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "requires": { + "graceful-fs": "^4.1.9" + } + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -955,6 +1021,19 @@ "type-check": "~0.4.0" } }, + "linkify-it": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", + "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "requires": { + "uc.micro": "^1.0.1" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -982,6 +1061,38 @@ "yallist": "^4.0.0" } }, + "markdown-it": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", + "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", + "requires": { + "argparse": "^1.0.7", + "entities": "~2.0.0", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + } + }, + "markdown-it-anchor": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz", + "integrity": "sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==" + }, + "marked": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-2.1.2.tgz", + "integrity": "sha512-ueJhIvklJJw04qxQbGIAu63EXwwOCYc7yKMBjgagTM4rjC5QtWyqSNgW7jCosV1/Km/1TUfs5qEpAqcGG0Mo5g==" + }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=" + }, + "minami": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/minami/-/minami-1.2.3.tgz", + "integrity": "sha1-mbbc37LwpU2hycj3qjoyd4eq+fg=" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -996,6 +1107,11 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1086,6 +1202,14 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, + "requizzle": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", + "integrity": "sha512-YanoyJjykPxGHii0fZP0uUPEXpvqfBDxWV7s6GKAiiOsiqhX6vHNyW3Qzdmqp/iq/ExbhaGbVrjB4ruEVSM4GQ==", + "requires": { + "lodash": "^4.17.14" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -1180,8 +1304,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "string-width": { "version": "4.2.2", @@ -1206,8 +1329,7 @@ "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" }, "supports-color": { "version": "5.5.0", @@ -1251,6 +1373,11 @@ } } }, + "taffydb": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", + "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -1277,6 +1404,16 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" + }, + "underscore": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", + "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -1313,6 +1450,11 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "xmlcreate": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.3.tgz", + "integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==" + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/src/package.json b/src/package.json index e268aaf..d4676a8 100644 --- a/src/package.json +++ b/src/package.json @@ -13,6 +13,8 @@ "animejs": "^3.2.1", "bulma": "^0.9.2", "caret-pos": "^2.0.0", + "jsdoc": "^3.6.7", + "minami": "^1.2.3", "sortablejs": "^1.13.0" }, "devDependencies": { From 2785ef69825da3557083c0ff9d4b7840bdc2559d Mon Sep 17 00:00:00 2001 From: Ro Date: Sun, 27 Jun 2021 13:48:17 -0700 Subject: [PATCH 7/8] updated AdminAPI for remote use, removed UtilityAPI from public library (methods should only be local) --- public/assets/scripts/dash.min.js | 8 +++--- src/com/Base.js | 21 +++++++-------- .../controllers/MaintenanceManager.js} | 1 - src/com/controllers/PageEditor.js | 7 +++-- src/libraries/FipamoAdminAPI.js | 26 ++++++++++++------- 5 files changed, 33 insertions(+), 30 deletions(-) rename src/{libraries/FipamoUtilityAPI.js => com/controllers/MaintenanceManager.js} (99%) diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 0e4ec63..172ffd3 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,o&&(this.key=o),r&&(this.baseURL=r),this._request(c).then((function(e){e.type===y&&(n.token=e.token)}))}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t.baseURL?(e.key=t.key,e.remote=!0):e.remote=!1,t._request(t.baseURL?t.baseURL+d:d,"getAuthStatus",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/sync",f,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/publish",h,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,i=this;switch(e){case p:n="/api/v1/page/create",r=p,o=u;break;case g:n="/api/v1/page/write",r=g,o=u;break;case m:n="/api/v1/page/delete",r=m,o=l}return new Promise((function(e,a){i._request(n,r,s,o,t).then((function(t){e(t)})).catch((function(e){a(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/nav-sync",f,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/mailer","sendMail",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"reindexPages",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/reindex",v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var d=new XMLHttpRequest;if(d.upload.onprogress=i.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);a(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==f&&t!==g&&t!==m&&t!==h&&t!==v||d.setRequestHeader("fipamo-access-token",i.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),w="POST",E="json",I="x-www-form-urlencoded",k=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",w,E,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}var a=new FormData;n.baseURL?(a.append("key",n.key),a.append("remote",!0)):a.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:E,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==w)switch(r){case E:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case I:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),S=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),T="requestLame",x="postUpdated";new function t(){e(this,t)};var D=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 D).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),_="editorDelete",B="editorUploadImage",A="editorSave",C="editorUpdate";new function t(){e(this,t)};var O=["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"],M=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&O.push("width"),O.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function N(e){return(N="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 L=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}},R=function(e){return"object"===N(e)&&null!==e},H=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=M(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},F=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):H(e,t)},U=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;R(t)&&(r=t,t=null);var o=L(r),i=F(e,o);return t||0===t?i.setPos(t):i.getPosition()},X=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=U(e.textEditor).pos;t.refresh(),U(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case x: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((function(){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 B:var n,r;U(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=U(this.textEditor).pos,this.emitEvent(B);break;case"submit-save":case"edit-save":this.emitEvent(A);break;case"submit-update":case"edit-update":this.emitEvent(C);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(_)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function Q(e,t){return e.apply(null,t)}var V={arr:function(e){return Array.isArray(e)},obj:function(e){return G(Object.prototype.toString.call(e),"Object")},pth:function(e){return V.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||V.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 V.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 V.hex(e)||V.rgb(e)||V.hsl(e)},key:function(e){return!q.hasOwnProperty(e)&&!Y.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function J(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function $(e,t){var n=J(e),r=z(V.und(n[0])?1:n[0],.1,100),o=z(V.und(n[1])?100:n[1],.1,100),i=z(V.und(n[2])?10:n[2],.1,100),a=z(V.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=W.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=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(z(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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+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=z(e,1,10),r=z(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(V.fnc(e))return e;var n=e.split("(")[0],r=ne[n],o=J(e);switch(n){case"spring":return $(e,t);case"cubicBezier":return Q(te,o);case"steps":return Q(Z,o);default:return Q(r,o)}}function oe(e){try{return document.querySelectorAll(e)}catch(e){return}}function ie(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function he(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 pe(e,t){return V.fnc(e)?e(t.target,t.id,t.total):e}function ge(e,t){return e.getAttribute(t)}function me(e,t,n){if(le([n,"deg","rad","turn"],he(t)))return t;var r=W.CSS[t+n];if(!V.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*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(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?me(e,o,n):o}}function ye(e,t){return V.dom(e)&&!V.inp(e)&&(!V.nil(ge(e,t))||V.svg(e)&&e[t])?"attribute":V.dom(e)&&le(j,t)?"transform":V.dom(e)&&"transform"!==t&&ve(e,t)?"css":null!=e[t]?"object":void 0}function be(e){if(V.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function we(e,t,n,r){var o=G(t,"scale")?1:0+function(e){return G(e,"translate")||"perspective"===e?"px":G(e,"rotate")||G(e,"skew")?"deg":void 0}(t),i=be(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?me(e,i,r):i}function Ee(e,t,n,r){switch(ye(e,t)){case"transform":return we(e,t,r,n);case"css":return ve(e,t,n);case"attribute":return ge(e,t);default:return e[t]||0}}function Ie(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=he(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function ke(e,t){if(V.col(e))return fe(e);if(/\s/g.test(e))return e;var n=he(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 Te(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Se(t,i)),t=i}return r}function xe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ge(e,"r")}(e);case"rect":return function(e){return 2*ge(e,"width")+2*ge(e,"height")}(e);case"line":return function(e){return Se({x:ge(e,"x1"),y:ge(e,"y1")},{x:ge(e,"x2"),y:ge(e,"y2")})}(e);case"polyline":return Te(e);case"polygon":return function(e){var t=e.points;return Te(e)+Se(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function De(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;V.svg(t)&&V.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=ge(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Pe(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 o=De(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function _e(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=ke(V.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:V.str(e)||t?r.split(n):[]}}function Be(e){return ie(e?ae(V.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ae(e){var t=Be(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:be(e)}}}))}function Ce(e,t){var n=ue(t);if(/^spring/.test(n.easing)&&(n.duration=$(n.easing)),V.arr(e)){var r=e.length;2===r&&!V.obj(e[0])?e={value:e}:V.fnc(t.duration)||(n.duration=t.duration/r)}var o=V.arr(e)?e:[e];return o.map((function(e,n){var r=V.obj(e)&&!V.pth(e)?e:{value:e};return V.und(r.delay)&&(r.delay=n?0:t.delay),V.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return de(e,n)}))}function Oe(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=de(function(e){for(var t=ie(ae(e.map((function(e){return Object.keys(e)}))),(function(e){return V.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)V.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ye.suspendWhenDocumentHidden&&(qe()?e=cancelAnimationFrame(e):(Ue.forEach((function(e){return e._onDocumentVisibility()})),Xe()))})),function(){e||qe()&&Ye.suspendWhenDocumentHidden||!(Ue.length>0)||(e=requestAnimationFrame(t))}}();function qe(){return!!document&&document.hidden}function Ye(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ce(q,e),n=ce(Y,e),r=Oe(n,e),o=Ae(e.targets),i=Re(o,r),a=He(i,n),s=Fe;return Fe++,de(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Ye.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Le(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ye.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Ue.push(l),d(),Xe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){We(Be(e),l)},l.reset(),l.autoplay&&l.play(),l}function je(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;je(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;je(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ye.version="3.2.1",Ye.speed=1,Ye.suspendWhenDocumentHidden=!0,Ye.running=Ue,Ye.remove=function(e){for(var t=Be(e),n=Ue.length;n--;){We(t,Ue[n])}},Ye.get=Ee,Ye.set=Le,Ye.convertPx=me,Ye.path=function(e,t){var n=V.str(e)?oe(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:De(n),totalLength:xe(n)*(r/100)}}},Ye.setDashoffset=function(e){var t=xe(e);return e.setAttribute("stroke-dasharray",t),t},Ye.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?re(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=V.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=he(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&Ue.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;Ke.alert("Uploading Image",null),(new k).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(B,e.url),Ke.alert("Image Added to Entry",!0)})).catch((function(){Ke.alert("Uh oh. Image not added",!1)}))}}]),t}();et.uploadFiles=[];var tt=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new et}}}]),t}(),nt=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,o&&(this.key=o),r&&(this.baseURL=r),this._request(c).then((function(e){e.type===k&&(n.token=e.token)}))}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t.baseURL?(e.key=t.key,e.remote=!0):e.remote=!1,t._request(t.baseURL?t.baseURL+m:m,"getAuthStatus",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+d:d,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+f:f,y,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,i=this;switch(e){case b:n="/api/v1/page/create",r=b,o=u;break;case w:n="/api/v1/page/write",r=w,o=u;break;case E:n="/api/v1/page/delete",r=E,o=l}return new Promise((function(e,a){i._request(i.baseURL?i.baseURL+n:n,r,s,o,t).then((function(t){e(t)})).catch((function(e){a(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+h:h,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+g:g,"sendMail",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"reindexPages",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+p:p,I,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var d=new XMLHttpRequest;if(d.upload.onprogress=i.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);a(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==v&&t!==w&&t!==E&&t!==y&&t!==I||d.setRequestHeader("fipamo-access-token",i.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",x="json",D="x-www-form-urlencoded",P=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}var a=new FormData;n.baseURL?(a.append("key",n.key),a.append("remote",!0)):a.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case x:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case D:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B="requestLame",A="postUpdated";new function t(){e(this,t)};var C=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 C).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),M="editorDelete",L="editorUploadImage",N="editorSave",R="editorUpdate";new function t(){e(this,t)};var U=["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"],H=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&U.push("width"),U.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function F(e){return(F="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 X=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}},q=function(e){return"object"===F(e)&&null!==e},Y=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=H(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},j=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):Y(e,t)},W=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;q(t)&&(r=t,t=null);var o=X(r),i=j(e,o);return t||0===t?i.setPos(t):i.getPosition()},z=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=W(e.textEditor).pos;t.refresh(),W(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case A: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((function(){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 L:var n,r;W(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=W(this.textEditor).pos,this.emitEvent(L);break;case"submit-save":case"edit-save":this.emitEvent(N);break;case"submit-update":case"edit-update":this.emitEvent(R);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(M)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function K(e,t){return e.apply(null,t)}var ee={arr:function(e){return Array.isArray(e)},obj:function(e){return Z(Object.prototype.toString.call(e),"Object")},pth:function(e){return ee.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||ee.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 ee.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 ee.hex(e)||ee.rgb(e)||ee.hsl(e)},key:function(e){return!G.hasOwnProperty(e)&&!Q.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function te(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ne(e,t){var n=te(e),r=$(ee.und(n[0])?1:n[0],.1,100),o=$(ee.und(n[1])?100:n[1],.1,100),i=$(ee.und(n[2])?10:n[2],.1,100),a=$(ee.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=J.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return J.springs[e]=i,i}}function re(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var oe,ie,ae=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),se=(oe={linear:function(){return function(e){return e}}},ie={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){ie[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ie).forEach((function(e){var t=ie[e];oe["easeIn"+e]=t,oe["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},oe["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}},oe["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}}})),oe);function le(e,t){if(ee.fnc(e))return e;var n=e.split("(")[0],r=se[n],o=te(e);switch(n){case"spring":return ne(e,t);case"cubicBezier":return K(ae,o);case"steps":return K(re,o);default:return K(r,o)}}function ue(e){try{return document.querySelectorAll(e)}catch(e){return}}function ce(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function ye(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 be(e,t){return ee.fnc(e)?e(t.target,t.id,t.total):e}function we(e,t){return e.getAttribute(t)}function Ee(e,t,n){if(he([n,"deg","rad","turn"],ye(t)))return t;var r=J.CSS[t+n];if(!ee.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return J.CSS[t+n]=s,s}function Ie(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?Ee(e,o,n):o}}function ke(e,t){return ee.dom(e)&&!ee.inp(e)&&(!ee.nil(we(e,t))||ee.svg(e)&&e[t])?"attribute":ee.dom(e)&&he(V,t)?"transform":ee.dom(e)&&"transform"!==t&&Ie(e,t)?"css":null!=e[t]?"object":void 0}function Se(e){if(ee.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function Te(e,t,n,r){var o=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=Se(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?Ee(e,i,r):i}function xe(e,t,n,r){switch(ke(e,t)){case"transform":return Te(e,t,r,n);case"css":return Ie(e,t,n);case"attribute":return we(e,t);default:return e[t]||0}}function De(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=ye(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Pe(e,t){if(ee.col(e))return ve(e);if(/\s/g.test(e))return e;var n=ye(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function _e(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Be(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=_e(t,i)),t=i}return r}function Ae(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*we(e,"r")}(e);case"rect":return function(e){return 2*we(e,"width")+2*we(e,"height")}(e);case"line":return function(e){return _e({x:we(e,"x1"),y:we(e,"y1")},{x:we(e,"x2"),y:we(e,"y2")})}(e);case"polyline":return Be(e);case"polygon":return function(e){var t=e.points;return Be(e)+_e(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Ce(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;ee.svg(t)&&ee.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=we(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Oe(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 o=Ce(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Me(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Pe(ee.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:ee.str(e)||t?r.split(n):[]}}function Le(e){return ce(e?de(ee.arr(e)?e.map(fe):fe(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ne(e){var t=Le(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Se(e)}}}))}function Re(e,t){var n=pe(t);if(/^spring/.test(n.easing)&&(n.duration=ne(n.easing)),ee.arr(e)){var r=e.length;2===r&&!ee.obj(e[0])?e={value:e}:ee.fnc(t.duration)||(n.duration=t.duration/r)}var o=ee.arr(e)?e:[e];return o.map((function(e,n){var r=ee.obj(e)&&!ee.pth(e)?e:{value:e};return ee.und(r.delay)&&(r.delay=n?0:t.delay),ee.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return me(e,n)}))}function Ue(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=me(function(e){for(var t=ce(de(e.map((function(e){return Object.keys(e)}))),(function(e){return ee.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)ee.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Qe.suspendWhenDocumentHidden&&(Ge()?e=cancelAnimationFrame(e):(We.forEach((function(e){return e._onDocumentVisibility()})),ze()))})),function(){e||Ge()&&Qe.suspendWhenDocumentHidden||!(We.length>0)||(e=requestAnimationFrame(t))}}();function Ge(){return!!document&&document.hidden}function Qe(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ge(G,e),n=ge(Q,e),r=Ue(n,e),o=Ne(e.targets),i=qe(o,r),a=Ye(i,n),s=je;return je++,me(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Qe.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Xe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Qe.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,We.push(l),d(),ze())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Je(Le(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ve(e,t){for(var n=t.length;n--;)he(e,t[n].animatable.target)&&t.splice(n,1)}function Je(e,t){var n=t.animations,r=t.children;Ve(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ve(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Qe.version="3.2.1",Qe.speed=1,Qe.suspendWhenDocumentHidden=!0,Qe.running=We,Qe.remove=function(e){for(var t=Le(e),n=We.length;n--;){Je(t,We[n])}},Qe.get=xe,Qe.set=Xe,Qe.convertPx=Ee,Qe.path=function(e,t){var n=ee.str(e)?ue(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Ce(n),totalLength:Ae(n)*(r/100)}}},Qe.setDashoffset=function(e){var t=Ae(e);return e.setAttribute("stroke-dasharray",t),t},Qe.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?le(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=ee.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=ye(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&We.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;ot.alert("Uploading Image",null),(new P).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(L,e.url),ot.alert("Image Added to Entry",!0)})).catch((function(){ot.alert("Uh oh. Image not added",!1)}))}}]),t}();it.uploadFiles=[];var at=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new it}}}]),t}(),st=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function lt(e){return(lt="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 ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ct(){return(ct=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ht(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var pt=ht(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),gt=ht(/Edge/i),mt=ht(/firefox/i),vt=ht(/safari/i)&&!ht(/chrome/i)&&!ht(/android/i),yt=ht(/iP(ad|od|hone)/i),bt=ht(/chrome/i)&&ht(/android/i),wt={capture:!1,passive:!1};function Et(e,t,n){e.addEventListener(t,n,!pt&&wt)}function It(e,t,n){e.removeEventListener(t,n,!pt&&wt)}function kt(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 St(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&&kt(e,t):kt(e,t))||r&&e===n)return e;if(e===n)break}while(e=St(e))}return null}var xt,Dt=/\s+/g;function Pt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Dt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Dt," ")}}function _t(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 Bt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=_t(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function At(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Ct())break;r=Ft(r,!1)}return!1}function Nt(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=ft(n,["evt"]);Qt.pluginEvent.bind(qn)(e,t,dt({dragEl:$t,parentEl:Zt,ghostEl:Kt,rootEl:en,nextEl:tn,lastDownEl:nn,cloneEl:rn,cloneHidden:on,dragStarted:yn,putSortable:dn,activeSortable:qn.active,originalEvent:r,oldIndex:an,oldDraggableIndex:ln,newIndex:sn,newDraggableIndex:un,hideGhostForTarget:Hn,unhideGhostForTarget:Fn,cloneNowHidden:function(){on=!0},cloneNowShown:function(){on=!1},dispatchSortableEvent:function(e){Jt({sortable:t,name:e,originalEvent:r})}},o))};function Jt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[jt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||pt||gt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=dt({},p,Qt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(dt({putSortable:dn,cloneEl:rn,targetEl:$t,rootEl:en,oldIndex:an,oldDraggableIndex:ln,newIndex:sn,newDraggableIndex:un},e))}var $t,Zt,Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn=!1,Sn=!1,Tn=[],xn=!1,Dn=!1,Pn=[],_n=!1,Bn=[],An="undefined"!=typeof document,Cn=yt,On=gt||pt?"cssFloat":"float",Mn=An&&!bt&&!yt&&"draggable"in document.createElement("div"),Nn=function(){if(An){if(pt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ln=function(e,t){var n=_t(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Nt(e,0,t),i=Nt(e,1,t),a=o&&_t(o),s=i&&_t(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ot(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ot(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[On]||i&&"none"===n[On]&&l+u>r)?"vertical":"horizontal"},Rn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==lt(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},Hn=function(){!Nn&&Kt&&_t(Kt,"display","none")},Fn=function(){!Nn&&Kt&&_t(Kt,"display","")};An&&document.addEventListener("click",(function(e){if(Sn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Sn=!1,!1}),!0);var Un=function(e){if($t){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Tn.some((function(e){if(!Lt(e)){var t=Ot(e),n=e[jt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[jt]._onDragOver(n)}}var o,i,a},Xn=function(e){$t&&$t.parentNode[jt]._isOutsideThisEl(e.target)};function qn(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=ct({},t),e[jt]=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 Ln(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!==qn.supportPointer&&"PointerEvent"in window&&!vt,emptyInsertThreshold:5};for(var r in Qt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Rn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Mn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Et(e,"pointerdown",this._onTapStart):(Et(e,"mousedown",this._onTapStart),Et(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Et(e,"dragover",this),Et(e,"dragenter",this)),Tn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ct(this,Wt())}function Yn(e,t,n,r,o,i,a,s){var l,u,c=e[jt],d=c.options.onMove;return!window.CustomEvent||pt||gt?(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=o||t,l.relatedRect=i||Ot(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function jn(e){e.draggable=!1}function Wn(){_n=!1}function zn(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 Gn(e){return setTimeout(e,0)}function Qn(e){return clearTimeout(e)}qn.prototype={constructor:qn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(bn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,$t):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Bn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Bn.push(r)}}(n),!$t&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!vt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Tt(s,r.draggable,n,!1))&&s.animated||nn===s)){if(an=Rt(s),ln=Rt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Jt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Vt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Tt(l,r.trim(),n,!1))return Jt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Vt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Tt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!$t&&n.parentNode===i){var l=Ot(n);if(en=i,Zt=($t=n).parentNode,tn=$t.nextSibling,nn=n,cn=a.group,qn.dragged=$t,fn={target:$t,clientX:(t||e).clientX,clientY:(t||e).clientY},mn=fn.clientX-l.left,vn=fn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,$t.style["will-change"]="all",r=function(){Vt("delayEnded",o,{evt:e}),qn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!mt&&o.nativeDraggable&&($t.draggable=!0),o._triggerDragStart(e,t),Jt({sortable:o,name:"choose",originalEvent:e}),Pt($t,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){At($t,e.trim(),jn)})),Et(s,"dragover",Un),Et(s,"mousemove",Un),Et(s,"touchmove",Un),Et(s,"mouseup",o._onDrop),Et(s,"touchend",o._onDrop),Et(s,"touchcancel",o._onDrop),mt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$t.draggable=!0),Vt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(gt||pt))r();else{if(qn.eventCanceled)return void this._onDrop();Et(s,"mouseup",o._disableDelayedDrag),Et(s,"touchend",o._disableDelayedDrag),Et(s,"touchcancel",o._disableDelayedDrag),Et(s,"mousemove",o._delayedDragTouchMoveHandler),Et(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&Et(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){$t&&jn($t),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;It(e,"mouseup",this._disableDelayedDrag),It(e,"touchend",this._disableDelayedDrag),It(e,"touchcancel",this._disableDelayedDrag),It(e,"mousemove",this._delayedDragTouchMoveHandler),It(e,"touchmove",this._delayedDragTouchMoveHandler),It(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Et(document,"pointermove",this._onTouchMove):Et(document,t?"touchmove":"mousemove",this._onTouchMove):(Et($t,"dragend",this),Et(en,"dragstart",this._onDragStart));try{document.selection?Gn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(kn=!1,en&&$t){Vt("dragStarted",this,{evt:t}),this.nativeDraggable&&Et(document,"dragover",Xn);var n=this.options;!e&&Pt($t,n.dragClass,!1),Pt($t,n.ghostClass,!0),qn.active=this,e&&this._appendGhost(),Jt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(hn){this._lastX=hn.clientX,this._lastY=hn.clientY,Hn();for(var e=document.elementFromPoint(hn.clientX,hn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(hn.clientX,hn.clientY))!==t;)t=e;if($t.parentNode[jt]._isOutsideThisEl(e),t)do{if(t[jt]){if(t[jt]._onDragOver({clientX:hn.clientX,clientY:hn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Fn()}},_onTouchMove:function(e){if(fn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=Kt&&Bt(Kt,!0),a=Kt&&i&&i.a,s=Kt&&i&&i.d,l=Cn&&In&&Ht(In),u=(o.clientX-fn.clientX+r.x)/(a||1)+(l?l[0]-Pn[0]:0)/(a||1),c=(o.clientY-fn.clientY+r.y)/(s||1)+(l?l[1]-Pn[1]:0)/(s||1);if(!qn.active&&!kn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===$t)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ot(a)),!1!==Yn(en,i,$t,t,a,n,e,!!a))return _(),i.appendChild($t),Zt=i,A(),B(!0)}else if(a.parentNode===i){n=Ot(a);var m,v,y,b=$t.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}($t.animated&&$t.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Mt(a,"top","top")||Mt($t,"top","top"),k=I?I.scrollTop:void 0;if(bn!==a&&(v=n[E],xn=!1,Dn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&Enc+u*i/2:ld-En)return-wn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Dn,bn===a))){var S=Rt($t);do{S-=m,y=Zt.children[S]}while(y&&("none"===_t(y,"display")||y===Kt))}if(0===m||y===a)return B(!1);bn=a,wn=m;var T=a.nextElementSibling,x=!1,D=Yn(en,i,$t,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),_n=!0,setTimeout(Wn,30),_(),x&&!T?i.appendChild($t):a.parentNode.insertBefore($t,x?T:a),I&&qt(I,0,k-I.scrollTop),Zt=$t.parentNode,void 0===v||Dn||(En=Math.abs(v-Ot(a)[E])),A(),B(!0)}if(i.contains($t))return B(!1)}return!1}function P(s,l){Vt(s,h,dt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Yn(en,i,$t,t,n,Ot(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Pt($t,dn?dn.options.ghostClass:u.options.ghostClass,!1),Pt($t,s.ghostClass,!0)),dn!==h&&h!==qn.active?dn=h:h===qn.active&&dn&&(dn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===$t&&!$t.animated||a===i&&!a.animated)&&(bn=null),s.dragoverBubble||e.rootEl||a===document||($t.parentNode[jt]._isOutsideThisEl(e.target),!t&&Un(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){sn=Rt($t),un=Rt($t,s.draggable),Jt({sortable:h,name:"change",toEl:i,newIndex:sn,newDraggableIndex:un,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){It(document,"mousemove",this._onTouchMove),It(document,"touchmove",this._onTouchMove),It(document,"pointermove",this._onTouchMove),It(document,"dragover",Un),It(document,"mousemove",Un),It(document,"touchmove",Un)},_offUpEvents:function(){var e=this.el.ownerDocument;It(e,"mouseup",this._onDrop),It(e,"touchend",this._onDrop),It(e,"pointerup",this._onDrop),It(e,"touchcancel",this._onDrop),It(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;sn=Rt($t),un=Rt($t,n.draggable),Vt("drop",this,{evt:e}),Zt=$t&&$t.parentNode,sn=Rt($t),un=Rt($t,n.draggable),qn.eventCanceled||(kn=!1,Dn=!1,xn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Qn(this.cloneId),Qn(this._dragStartId),this.nativeDraggable&&(It(document,"drop",this),It(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),vt&&_t(document.body,"user-select",""),_t($t,"transform",""),e&&(yn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Kt&&Kt.parentNode&&Kt.parentNode.removeChild(Kt),(en===Zt||dn&&"clone"!==dn.lastPutMode)&&rn&&rn.parentNode&&rn.parentNode.removeChild(rn),$t&&(this.nativeDraggable&&It($t,"dragend",this),jn($t),$t.style["will-change"]="",yn&&!kn&&Pt($t,dn?dn.options.ghostClass:this.options.ghostClass,!1),Pt($t,this.options.chosenClass,!1),Jt({sortable:this,name:"unchoose",toEl:Zt,newIndex:null,newDraggableIndex:null,originalEvent:e}),en!==Zt?(sn>=0&&(Jt({rootEl:Zt,name:"add",toEl:Zt,fromEl:en,originalEvent:e}),Jt({sortable:this,name:"remove",toEl:Zt,originalEvent:e}),Jt({rootEl:Zt,name:"sort",toEl:Zt,fromEl:en,originalEvent:e}),Jt({sortable:this,name:"sort",toEl:Zt,originalEvent:e})),dn&&dn.save()):sn!==an&&sn>=0&&(Jt({sortable:this,name:"update",toEl:Zt,originalEvent:e}),Jt({sortable:this,name:"sort",toEl:Zt,originalEvent:e})),qn.active&&(null!=sn&&-1!==sn||(sn=an,un=ln),Jt({sortable:this,name:"end",toEl:Zt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Vt("nulling",this),en=$t=Zt=Kt=tn=rn=nn=on=fn=hn=yn=sn=un=an=ln=bn=wn=dn=cn=qn.dragged=qn.ghost=qn.clone=qn.active=null,Bn.forEach((function(e){e.checked=!0})),Bn.length=pn=gn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":$t&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function yt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var bt=yt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),wt=yt(/Edge/i),Et=yt(/firefox/i),It=yt(/safari/i)&&!yt(/chrome/i)&&!yt(/android/i),kt=yt(/iP(ad|od|hone)/i),St=yt(/chrome/i)&&yt(/android/i),Tt={capture:!1,passive:!1};function xt(e,t,n){e.addEventListener(t,n,!bt&&Tt)}function Dt(e,t,n){e.removeEventListener(t,n,!bt&&Tt)}function Pt(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 _t(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Bt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Pt(e,t):Pt(e,t))||r&&e===n)return e;if(e===n)break}while(e=_t(e))}return null}var At,Ct=/\s+/g;function Ot(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Ct," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Ct," ")}}function Mt(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=Mt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Nt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Rt())break;r=jt(r,!1)}return!1}function Ft(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=vt(n,["evt"]);Kt.pluginEvent.bind(Gn)(e,t,mt({dragEl:nn,parentEl:rn,ghostEl:on,rootEl:an,nextEl:sn,lastDownEl:ln,cloneEl:un,cloneHidden:cn,dragStarted:kn,putSortable:mn,activeSortable:Gn.active,originalEvent:r,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn,hideGhostForTarget:Yn,unhideGhostForTarget:jn,cloneNowHidden:function(){cn=!0},cloneNowShown:function(){cn=!1},dispatchSortableEvent:function(e){tn({sortable:t,name:e,originalEvent:r})}},o))};function tn(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Vt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||bt||wt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=mt({},p,Kt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(mt({putSortable:mn,cloneEl:un,targetEl:nn,rootEl:an,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn},e))}var nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,xn,Dn,Pn=!1,_n=!1,Bn=[],An=!1,Cn=!1,On=[],Mn=!1,Ln=[],Nn="undefined"!=typeof document,Rn=kt,Un=wt||bt?"cssFloat":"float",Hn=Nn&&!St&&!kt&&"draggable"in document.createElement("div"),Fn=function(){if(Nn){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Xn=function(e,t){var n=Mt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ft(e,0,t),i=Ft(e,1,t),a=o&&Mt(o),s=i&&Mt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ut(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ut(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Un]||i&&"none"===n[Un]&&l+u>r)?"vertical":"horizontal"},qn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==ht(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},Yn=function(){!Fn&&on&&Mt(on,"display","none")},jn=function(){!Fn&&on&&Mt(on,"display","")};Nn&&document.addEventListener("click",(function(e){if(_n)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),_n=!1,!1}),!0);var Wn=function(e){if(nn){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Bn.some((function(e){if(!Xt(e)){var t=Ut(e),n=e[Vt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Vt]._onDragOver(n)}}var o,i,a},zn=function(e){nn&&nn.parentNode[Vt]._isOutsideThisEl(e.target)};function Gn(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=gt({},t),e[Vt]=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 Xn(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!==Gn.supportPointer&&"PointerEvent"in window&&!It,emptyInsertThreshold:5};for(var r in Kt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in qn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Hn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?xt(e,"pointerdown",this._onTapStart):(xt(e,"mousedown",this._onTapStart),xt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(e,"dragover",this),xt(e,"dragenter",this)),Bn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Jt())}function Qn(e,t,n,r,o,i,a,s){var l,u,c=e[Vt],d=c.options.onMove;return!window.CustomEvent||bt||wt?(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=o||t,l.relatedRect=i||Ut(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function Vn(e){e.draggable=!1}function Jn(){Mn=!1}function $n(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 Zn(e){return setTimeout(e,0)}function Kn(e){return clearTimeout(e)}Gn.prototype={constructor:Gn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Sn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,nn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Ln.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Ln.push(r)}}(n),!nn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!It||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Bt(s,r.draggable,n,!1))&&s.animated||ln===s)){if(dn=qt(s),hn=qt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return tn({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),en("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Bt(l,r.trim(),n,!1))return tn({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),en("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Bt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!nn&&n.parentNode===i){var l=Ut(n);if(an=i,rn=(nn=n).parentNode,sn=nn.nextSibling,ln=n,gn=a.group,Gn.dragged=nn,vn={target:nn,clientX:(t||e).clientX,clientY:(t||e).clientY},En=vn.clientX-l.left,In=vn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,nn.style["will-change"]="all",r=function(){en("delayEnded",o,{evt:e}),Gn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!Et&&o.nativeDraggable&&(nn.draggable=!0),o._triggerDragStart(e,t),tn({sortable:o,name:"choose",originalEvent:e}),Ot(nn,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Nt(nn,e.trim(),Vn)})),xt(s,"dragover",Wn),xt(s,"mousemove",Wn),xt(s,"touchmove",Wn),xt(s,"mouseup",o._onDrop),xt(s,"touchend",o._onDrop),xt(s,"touchcancel",o._onDrop),Et&&this.nativeDraggable&&(this.options.touchStartThreshold=4,nn.draggable=!0),en("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(wt||bt))r();else{if(Gn.eventCanceled)return void this._onDrop();xt(s,"mouseup",o._disableDelayedDrag),xt(s,"touchend",o._disableDelayedDrag),xt(s,"touchcancel",o._disableDelayedDrag),xt(s,"mousemove",o._delayedDragTouchMoveHandler),xt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&xt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){nn&&Vn(nn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._disableDelayedDrag),Dt(e,"touchend",this._disableDelayedDrag),Dt(e,"touchcancel",this._disableDelayedDrag),Dt(e,"mousemove",this._delayedDragTouchMoveHandler),Dt(e,"touchmove",this._delayedDragTouchMoveHandler),Dt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,t?"touchmove":"mousemove",this._onTouchMove):(xt(nn,"dragend",this),xt(an,"dragstart",this._onDragStart));try{document.selection?Zn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Pn=!1,an&&nn){en("dragStarted",this,{evt:t}),this.nativeDraggable&&xt(document,"dragover",zn);var n=this.options;!e&&Ot(nn,n.dragClass,!1),Ot(nn,n.ghostClass,!0),Gn.active=this,e&&this._appendGhost(),tn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(yn){this._lastX=yn.clientX,this._lastY=yn.clientY,Yn();for(var e=document.elementFromPoint(yn.clientX,yn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(yn.clientX,yn.clientY))!==t;)t=e;if(nn.parentNode[Vt]._isOutsideThisEl(e),t)do{if(t[Vt]){if(t[Vt]._onDragOver({clientX:yn.clientX,clientY:yn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);jn()}},_onTouchMove:function(e){if(vn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=on&&Lt(on,!0),a=on&&i&&i.a,s=on&&i&&i.d,l=Rn&&Dn&&Yt(Dn),u=(o.clientX-vn.clientX+r.x)/(a||1)+(l?l[0]-On[0]:0)/(a||1),c=(o.clientY-vn.clientY+r.y)/(s||1)+(l?l[1]-On[1]:0)/(s||1);if(!Gn.active&&!Pn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===nn)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ut(a)),!1!==Qn(an,i,nn,t,a,n,e,!!a))return _(),i.appendChild(nn),rn=i,A(),B(!0)}else if(a.parentNode===i){n=Ut(a);var m,v,y,b=nn.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(nn.animated&&nn.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ht(a,"top","top")||Ht(nn,"top","top"),k=I?I.scrollTop:void 0;if(Sn!==a&&(v=n[E],An=!1,Cn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&xnc+u*i/2:ld-xn)return-Tn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Cn,Sn===a))){var S=qt(nn);do{S-=m,y=rn.children[S]}while(y&&("none"===Mt(y,"display")||y===on))}if(0===m||y===a)return B(!1);Sn=a,Tn=m;var T=a.nextElementSibling,x=!1,D=Qn(an,i,nn,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Mn=!0,setTimeout(Jn,30),_(),x&&!T?i.appendChild(nn):a.parentNode.insertBefore(nn,x?T:a),I&&Gt(I,0,k-I.scrollTop),rn=nn.parentNode,void 0===v||Cn||(xn=Math.abs(v-Ut(a)[E])),A(),B(!0)}if(i.contains(nn))return B(!1)}return!1}function P(s,l){en(s,h,mt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Qn(an,i,nn,t,n,Ut(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Ot(nn,mn?mn.options.ghostClass:u.options.ghostClass,!1),Ot(nn,s.ghostClass,!0)),mn!==h&&h!==Gn.active?mn=h:h===Gn.active&&mn&&(mn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===nn&&!nn.animated||a===i&&!a.animated)&&(Sn=null),s.dragoverBubble||e.rootEl||a===document||(nn.parentNode[Vt]._isOutsideThisEl(e.target),!t&&Wn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){fn=qt(nn),pn=qt(nn,s.draggable),tn({sortable:h,name:"change",toEl:i,newIndex:fn,newDraggableIndex:pn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Dt(document,"mousemove",this._onTouchMove),Dt(document,"touchmove",this._onTouchMove),Dt(document,"pointermove",this._onTouchMove),Dt(document,"dragover",Wn),Dt(document,"mousemove",Wn),Dt(document,"touchmove",Wn)},_offUpEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._onDrop),Dt(e,"touchend",this._onDrop),Dt(e,"pointerup",this._onDrop),Dt(e,"touchcancel",this._onDrop),Dt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;fn=qt(nn),pn=qt(nn,n.draggable),en("drop",this,{evt:e}),rn=nn&&nn.parentNode,fn=qt(nn),pn=qt(nn,n.draggable),Gn.eventCanceled||(Pn=!1,Cn=!1,An=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Kn(this.cloneId),Kn(this._dragStartId),this.nativeDraggable&&(Dt(document,"drop",this),Dt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),It&&Mt(document.body,"user-select",""),Mt(nn,"transform",""),e&&(kn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),on&&on.parentNode&&on.parentNode.removeChild(on),(an===rn||mn&&"clone"!==mn.lastPutMode)&&un&&un.parentNode&&un.parentNode.removeChild(un),nn&&(this.nativeDraggable&&Dt(nn,"dragend",this),Vn(nn),nn.style["will-change"]="",kn&&!Pn&&Ot(nn,mn?mn.options.ghostClass:this.options.ghostClass,!1),Ot(nn,this.options.chosenClass,!1),tn({sortable:this,name:"unchoose",toEl:rn,newIndex:null,newDraggableIndex:null,originalEvent:e}),an!==rn?(fn>=0&&(tn({rootEl:rn,name:"add",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"remove",toEl:rn,originalEvent:e}),tn({rootEl:rn,name:"sort",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),mn&&mn.save()):fn!==dn&&fn>=0&&(tn({sortable:this,name:"update",toEl:rn,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),Gn.active&&(null!=fn&&-1!==fn||(fn=dn,pn=hn),tn({sortable:this,name:"end",toEl:rn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){en("nulling",this),an=nn=rn=on=sn=un=ln=cn=vn=yn=kn=fn=pn=dn=hn=Sn=Tn=mn=gn=Gn.dragged=Gn.ghost=Gn.clone=Gn.active=null,Ln.forEach((function(e){e.checked=!0})),Ln.length=bn=wn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":nn&&(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,o=n.length,i=this.options;r { if (response.type === DataEvent.API_INIT_LAME) { self.processing = false; @@ -117,11 +117,10 @@ export default class Base { let self = this; e.stopPropagation(); e.preventDefault(); - let api = new FipamoUtilityAPI(); + let mm = new Maintenance(); var form = document.getElementById("init-restore"); this.processing = true; - api - .restore(form) + mm.restore(form) .then((response) => { if (response.type === DataEvent.REQUEST_LAME) { self.processing = false; @@ -144,15 +143,14 @@ export default class Base { e.stopPropagation(); e.preventDefault(); let self = this; - let api = new FipamoUtilityAPI(); + let mm = new Maintenance(); if (e.target.id == "get-secret-btn") { let data = { email: document.getElementById("email").value, task: "retrieveSecret" }; this.processing = true; - api - .secret(data) + mm.secret(data) .then((response) => { self.processing = false; if (response.secret) { @@ -176,8 +174,7 @@ export default class Base { newPassConfirm: document.getElementById("new_password2").value, secret: document.getElementById("secret").value }; - api - .newPass(data) + mm.newPass(data) .then((response) => { self.processing = false; if (response.type == "passNotCreated") { diff --git a/src/libraries/FipamoUtilityAPI.js b/src/com/controllers/MaintenanceManager.js similarity index 99% rename from src/libraries/FipamoUtilityAPI.js rename to src/com/controllers/MaintenanceManager.js index 93cd775..8c4d8bb 100644 --- a/src/libraries/FipamoUtilityAPI.js +++ b/src/com/controllers/MaintenanceManager.js @@ -27,7 +27,6 @@ export const TASK_RESET_PASS = "resetPassword"; export const TASK_UPLOAD_FILES = "uploadFiles"; /** - * Fipamo Utility API * A tub of methods for creating/restoring installs, resetting passwords and uploading images. */ class FipamoUtilityAPI { diff --git a/src/com/controllers/PageEditor.js b/src/com/controllers/PageEditor.js index 8f5d393..27625bf 100644 --- a/src/com/controllers/PageEditor.js +++ b/src/com/controllers/PageEditor.js @@ -4,7 +4,7 @@ import FipamoAdminAPI, { TASK_PAGE_EDIT, TASK_PAGE_DELETE } from "../../libraries/FipamoAdminAPI"; -import FipamoUtilityAPI from "../../libraries/FipamoUtilityAPI"; +import Maintenance from "MaintenanceManager"; import * as DataEvent from "../events/DataEvent"; import PageActions from "../actions/PageActions"; import * as EditorEvent from "../events/EditorEvent"; @@ -250,9 +250,8 @@ export default class PostEditor { handleImageUpload(type, files) { let self = this; notify.alert("Uploading Image", null); - let utils = new FipamoUtilityAPI(); - utils - .imageUpload(type, files) + let mm = new Maintenance(); + mm.imageUpload(type, files) .then((r) => { if (r.type == DataEvent.POST_IMAGE_ADDED) self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url); diff --git a/src/libraries/FipamoAdminAPI.js b/src/libraries/FipamoAdminAPI.js index 8f6f111..eb54740 100644 --- a/src/libraries/FipamoAdminAPI.js +++ b/src/libraries/FipamoAdminAPI.js @@ -32,13 +32,14 @@ export const API_ACCESS_GOOD = "apiConnected"; export const API_ACCESS_BAD = "apiNotConnected"; /** - * Fipamo Administration API - * A pocket full of methods used to edit install settings, navigation pages. + * A can of methods used to edit install settings, navigation pages. */ class FipamoAdminAPI { /** * @constructor + * @param {string} baseURL - url of site; uses local when empty + * @param {string} key - user api key */ constructor(baseURL = null, key = null) { this.percentComplete = 0; //for later @@ -58,9 +59,9 @@ class FipamoAdminAPI { } /** * Method for retrieving user authorizing user login + * @param {object} data - json object that contains data for set up * @property {string} handle - handle for site user * @property {string} password - password for site user - * @param {object} data - json object that contains data for set up */ login(data) { return new Promise((resolve, reject) => { @@ -108,7 +109,7 @@ class FipamoAdminAPI { syncSettings(data) { return new Promise((resolve, reject) => { this._request( - API_SETTINGS_SYNC, + this.baseURL ? this.baseURL + API_SETTINGS_SYNC : API_SETTINGS_SYNC, TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, @@ -131,7 +132,8 @@ class FipamoAdminAPI { publishSite(data) { return new Promise((resolve, reject) => { this._request( - API_PUBLISH_PAGES, + //API_PUBLISH_PAGES, + this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES, TASK_PUBLISH_SITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, @@ -189,7 +191,13 @@ class FipamoAdminAPI { } return new Promise((resolve, reject) => { - this._request(url, event, REQUEST_TYPE_POST, content, data) + this._request( + this.baseURL ? this.baseURL + url : url, + event, + REQUEST_TYPE_POST, + content, + data + ) .then((result) => { resolve(result); }) @@ -210,7 +218,7 @@ class FipamoAdminAPI { syncNav(data) { return new Promise((resolve, reject) => { this._request( - API_NAV_SYNC, + this.baseURL ? this.baseURL + API_NAV_SYNC : API_NAV_SYNC, TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, @@ -232,7 +240,7 @@ class FipamoAdminAPI { sendMail(message) { return new Promise((resolve, reject) => { this._request( - API_SEND_MAIL, + this.baseURL ? this.baseURL + API_SEND_MAIL : API_SEND_MAIL, TASK_SEND_MAIL, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, @@ -253,7 +261,7 @@ class FipamoAdminAPI { reindexPages(data) { return new Promise((resolve, reject) => { this._request( - API_REINDEX_PAGES, + this.baseURL ? this.baseURL + API_REINDEX_PAGES : API_REINDEX_PAGES, TASK_REINDEX_PAGE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, From ab40219d9b9d4c382c899d8283a457797a069d3b Mon Sep 17 00:00:00 2001 From: Ro Date: Mon, 28 Jun 2021 13:47:06 -0700 Subject: [PATCH 8/8] added key check to use AdminAPI, updated front end classes --- brain/controller/APIControl.inc.php | 10 +++++++- brain/data/Auth.inc.php | 2 +- public/assets/scripts/dash.min.js | 8 +++---- src/com/controllers/NavIndex.js | 5 +++- src/com/controllers/PageEditor.js | 5 +++- src/com/controllers/SettingsIndex.js | 5 +++- src/libraries/FipamoAdminAPI.js | 35 +++++++++++++++++----------- src/libraries/FipamoContentAPI.js | 2 +- 8 files changed, 49 insertions(+), 23 deletions(-) diff --git a/brain/controller/APIControl.inc.php b/brain/controller/APIControl.inc.php index 9c8562e..821f7ef 100644 --- a/brain/controller/APIControl.inc.php +++ b/brain/controller/APIControl.inc.php @@ -20,7 +20,15 @@ class APIControl switch (isset($args["third"]) ? $args["third"] : "none") { case "status": - $result = AuthAPI::status(); + if (Member::verifyKey($_GET["key"])) { + $result = AuthAPI::status(); + } else { + $result = [ + "message" => "Valid key required. API access denied, homie", + "type" => "API_ERROR", + ]; + } + break; case "page": //echo diff --git a/brain/data/Auth.inc.php b/brain/data/Auth.inc.php index 136e9b0..0f67e3c 100644 --- a/brain/data/Auth.inc.php +++ b/brain/data/Auth.inc.php @@ -48,7 +48,7 @@ class Auth ]; $token = Token::create( - $found["id"], + $found["key"], $found["secret"], time() + 3600, "localhost" diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 172ffd3..5fb45cf 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,o&&(this.key=o),r&&(this.baseURL=r),this._request(c).then((function(e){e.type===k&&(n.token=e.token)}))}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t.baseURL?(e.key=t.key,e.remote=!0):e.remote=!1,t._request(t.baseURL?t.baseURL+m:m,"getAuthStatus",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+d:d,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+f:f,y,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,i=this;switch(e){case b:n="/api/v1/page/create",r=b,o=u;break;case w:n="/api/v1/page/write",r=w,o=u;break;case E:n="/api/v1/page/delete",r=E,o=l}return new Promise((function(e,a){i._request(i.baseURL?i.baseURL+n:n,r,s,o,t).then((function(t){e(t)})).catch((function(e){a(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+h:h,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+g:g,"sendMail",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"reindexPages",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+p:p,I,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var d=new XMLHttpRequest;if(d.upload.onprogress=i.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);a(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==v&&t!==w&&t!==E&&t!==y&&t!==I||d.setRequestHeader("fipamo-access-token",i.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",x="json",D="x-www-form-urlencoded",P=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}var a=new FormData;n.baseURL?(a.append("key",n.key),a.append("remote",!0)):a.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case x:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case D:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B="requestLame",A="postUpdated";new function t(){e(this,t)};var C=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 C).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),M="editorDelete",L="editorUploadImage",N="editorSave",R="editorUpdate";new function t(){e(this,t)};var U=["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"],H=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&U.push("width"),U.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function F(e){return(F="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 X=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}},q=function(e){return"object"===F(e)&&null!==e},Y=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=H(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},j=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):Y(e,t)},W=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;q(t)&&(r=t,t=null);var o=X(r),i=j(e,o);return t||0===t?i.setPos(t):i.getPosition()},z=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=W(e.textEditor).pos;t.refresh(),W(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case A: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((function(){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 L:var n,r;W(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=W(this.textEditor).pos,this.emitEvent(L);break;case"submit-save":case"edit-save":this.emitEvent(N);break;case"submit-update":case"edit-update":this.emitEvent(R);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(M)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function K(e,t){return e.apply(null,t)}var ee={arr:function(e){return Array.isArray(e)},obj:function(e){return Z(Object.prototype.toString.call(e),"Object")},pth:function(e){return ee.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||ee.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 ee.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 ee.hex(e)||ee.rgb(e)||ee.hsl(e)},key:function(e){return!G.hasOwnProperty(e)&&!Q.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function te(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ne(e,t){var n=te(e),r=$(ee.und(n[0])?1:n[0],.1,100),o=$(ee.und(n[1])?100:n[1],.1,100),i=$(ee.und(n[2])?10:n[2],.1,100),a=$(ee.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=J.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return J.springs[e]=i,i}}function re(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var oe,ie,ae=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),se=(oe={linear:function(){return function(e){return e}}},ie={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){ie[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ie).forEach((function(e){var t=ie[e];oe["easeIn"+e]=t,oe["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},oe["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}},oe["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}}})),oe);function le(e,t){if(ee.fnc(e))return e;var n=e.split("(")[0],r=se[n],o=te(e);switch(n){case"spring":return ne(e,t);case"cubicBezier":return K(ae,o);case"steps":return K(re,o);default:return K(r,o)}}function ue(e){try{return document.querySelectorAll(e)}catch(e){return}}function ce(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function ye(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 be(e,t){return ee.fnc(e)?e(t.target,t.id,t.total):e}function we(e,t){return e.getAttribute(t)}function Ee(e,t,n){if(he([n,"deg","rad","turn"],ye(t)))return t;var r=J.CSS[t+n];if(!ee.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return J.CSS[t+n]=s,s}function Ie(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?Ee(e,o,n):o}}function ke(e,t){return ee.dom(e)&&!ee.inp(e)&&(!ee.nil(we(e,t))||ee.svg(e)&&e[t])?"attribute":ee.dom(e)&&he(V,t)?"transform":ee.dom(e)&&"transform"!==t&&Ie(e,t)?"css":null!=e[t]?"object":void 0}function Se(e){if(ee.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function Te(e,t,n,r){var o=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=Se(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?Ee(e,i,r):i}function xe(e,t,n,r){switch(ke(e,t)){case"transform":return Te(e,t,r,n);case"css":return Ie(e,t,n);case"attribute":return we(e,t);default:return e[t]||0}}function De(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=ye(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Pe(e,t){if(ee.col(e))return ve(e);if(/\s/g.test(e))return e;var n=ye(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function _e(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Be(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=_e(t,i)),t=i}return r}function Ae(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*we(e,"r")}(e);case"rect":return function(e){return 2*we(e,"width")+2*we(e,"height")}(e);case"line":return function(e){return _e({x:we(e,"x1"),y:we(e,"y1")},{x:we(e,"x2"),y:we(e,"y2")})}(e);case"polyline":return Be(e);case"polygon":return function(e){var t=e.points;return Be(e)+_e(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Ce(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;ee.svg(t)&&ee.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=we(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Oe(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 o=Ce(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Me(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Pe(ee.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:ee.str(e)||t?r.split(n):[]}}function Le(e){return ce(e?de(ee.arr(e)?e.map(fe):fe(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ne(e){var t=Le(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Se(e)}}}))}function Re(e,t){var n=pe(t);if(/^spring/.test(n.easing)&&(n.duration=ne(n.easing)),ee.arr(e)){var r=e.length;2===r&&!ee.obj(e[0])?e={value:e}:ee.fnc(t.duration)||(n.duration=t.duration/r)}var o=ee.arr(e)?e:[e];return o.map((function(e,n){var r=ee.obj(e)&&!ee.pth(e)?e:{value:e};return ee.und(r.delay)&&(r.delay=n?0:t.delay),ee.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return me(e,n)}))}function Ue(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=me(function(e){for(var t=ce(de(e.map((function(e){return Object.keys(e)}))),(function(e){return ee.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)ee.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Qe.suspendWhenDocumentHidden&&(Ge()?e=cancelAnimationFrame(e):(We.forEach((function(e){return e._onDocumentVisibility()})),ze()))})),function(){e||Ge()&&Qe.suspendWhenDocumentHidden||!(We.length>0)||(e=requestAnimationFrame(t))}}();function Ge(){return!!document&&document.hidden}function Qe(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ge(G,e),n=ge(Q,e),r=Ue(n,e),o=Ne(e.targets),i=qe(o,r),a=Ye(i,n),s=je;return je++,me(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Qe.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Xe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Qe.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,We.push(l),d(),ze())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Je(Le(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ve(e,t){for(var n=t.length;n--;)he(e,t[n].animatable.target)&&t.splice(n,1)}function Je(e,t){var n=t.animations,r=t.children;Ve(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ve(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Qe.version="3.2.1",Qe.speed=1,Qe.suspendWhenDocumentHidden=!0,Qe.running=We,Qe.remove=function(e){for(var t=Le(e),n=We.length;n--;){Je(t,We[n])}},Qe.get=xe,Qe.set=Xe,Qe.convertPx=Ee,Qe.path=function(e,t){var n=ee.str(e)?ue(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Ce(n),totalLength:Ae(n)*(r/100)}}},Qe.setDashoffset=function(e){var t=Ae(e);return e.setAttribute("stroke-dasharray",t),t},Qe.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?le(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=ee.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=ye(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&We.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;ot.alert("Uploading Image",null),(new P).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(L,e.url),ot.alert("Image Added to Entry",!0)})).catch((function(){ot.alert("Uh oh. Image not added",!1)}))}}]),t}();it.uploadFiles=[];var at=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new it}}}]),t}(),st=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,o&&(this.key=o),r&&(this.baseURL=r),this._request(this.baseURL?this.baseURL+c+"?key="+this.key:c+"?key="+this.key).then((function(e){e.type===k&&(n.token=e.token)}))}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t.baseURL?e.remote=!0:e.remote=!1,t.key?e.key=t.key:e.key=null,t._request(t.baseURL?t.baseURL+m:m,"getAuthStatus",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+d+"?key="+t.key:d+"?key="+t.key,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+f:f,y,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,i=this;switch(e){case b:n="/api/v1/page/create",r=b,o=u;break;case w:n="/api/v1/page/write",r=w,o=u;break;case E:n="/api/v1/page/delete",r=E,o=l}return this.baseURL?(t.key=this.key,t.remote=!0):t.remote=!1,new Promise((function(e,a){i._request(i.baseURL?i.baseURL+n:n,r,s,o,t).then((function(t){e(t)})).catch((function(e){a(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+h:h,v,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+g:g,"sendMail",s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"reindexPages",value:function(e){var t=this;return new Promise((function(n,r){t._request(t.baseURL?t.baseURL+p:p,I,s,l,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(a,c){var d=new XMLHttpRequest;if(d.upload.onprogress=i.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);a(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==v&&t!==w&&t!==E&&t!==y&&t!==I||d.setRequestHeader("fipamo-access-token",i.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),T="POST",x="json",D="x-www-form-urlencoded",P=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"restore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"backup",value:function(){var e=this;return new Promise((function(t,n){var r;r={task:"create_backup"},e._request("/api/v1/backup","createBackup","POST","json",r).then((function(e){t(e)})).catch((function(e){n(e)}))}))}},{key:"secret",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/get-secret","retrieveSecret",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"newPass",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/reset-password","resetPassword",T,x,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var i="";switch(e){case"avatar-upload":i="/api/v1/settings/add-avatar";break;case"background-upload":i="/api/v1/settings/add-feature-background";break;default:i="/api/v1/page/add-entry-image"}var a=new FormData;n.baseURL?(a.append("key",n.key),a.append("remote",!0)):a.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=this;return new Promise((function(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==T)switch(r){case x:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case D:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),_=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),B="requestLame",A="postUpdated";new function t(){e(this,t)};var C=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r]*>/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 C).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var a=document.getElementById("featured-image").src;null!=a||null!=a?r.append("feature_image",a):r.append("feature_image",null)}t(r)}))}}]),t}(),L="editorDelete",M="editorUploadImage",N="editorSave",R="editorUpdate";new function t(){e(this,t)};var U=["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"],H=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&U.push("width"),U.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function F(e){return(F="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 X=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}},q=function(e){return"object"===F(e)&&null!==e},Y=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,a=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=H(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),i=r.documentElement,a=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:o.top+s,left:o.left+a}}(e),i=r(n);return{top:o.top+i.top+t.document.body.scrollTop,left:o.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},j=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(),o={height:0,left:0,right:0};if(!n)return o;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var a=n.cloneRange(),s=i?t.customPos:n.endOffset;a.setStart(n.endContainer,s-1<0?0:s-1),a.setEnd(n.endContainer,s);var l=a.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},a.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var u=n.cloneRange(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),u.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,i=!1;!function e(a,s){for(var l=0;l=a){i=!0;var c=t.document.createRange();c.setStart(u,a-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=o(),a=e.getBoundingClientRect(),s=a.top+t.document.body.scrollTop,l=a.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):Y(e,t)},W=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;q(t)&&(r=t,t=null);var o=X(r),i=j(e,o);return t||0===t?i.setPos(t):i.getPosition()},z=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(i,t);var r=a(i);function i(t,n){var o;return e(this,i),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=W(e.textEditor).pos;t.refresh(),W(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case A: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((function(){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 M:var n,r;W(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode(""+r+""));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=W(this.textEditor).pos,this.emitEvent(M);break;case"submit-save":case"edit-save":this.emitEvent(N);break;case"submit-update":case"edit-update":this.emitEvent(R);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(L)}this.refresh()}}]),i}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r-1}function K(e,t){return e.apply(null,t)}var ee={arr:function(e){return Array.isArray(e)},obj:function(e){return Z(Object.prototype.toString.call(e),"Object")},pth:function(e){return ee.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||ee.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 ee.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 ee.hex(e)||ee.rgb(e)||ee.hsl(e)},key:function(e){return!G.hasOwnProperty(e)&&!Q.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function te(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function ne(e,t){var n=te(e),r=$(ee.und(n[0])?1:n[0],.1,100),o=$(ee.und(n[1])?100:n[1],.1,100),i=$(ee.und(n[2])?10:n[2],.1,100),a=$(ee.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=i/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-a)/u:-a+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=J.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return J.springs[e]=i,i}}function re(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var oe,ie,ae=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 o(e,o,i){return((t(o,i)*e+n(o,i))*e+r(o))*e}function i(e,o,i){return 3*t(o,i)*e*e+2*n(o,i)*e+r(o)}return function(t,n,r,a){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==a)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===a||0===e||1===e?e:o(u(e),n,a)}}function u(n){for(var a=0,l=1;10!==l&&s[l]<=n;++l)a+=e;--l;var u=a+(n-s[l])/(s[l+1]-s[l])*e,c=i(u,t,r);return c>=.001?function(e,t,n,r){for(var a=0;a<4;++a){var s=i(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}(n,u,t,r):0===c?u:function(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}(n,a,a+e,t,r)}}}(),se=(oe={linear:function(){return function(e){return e}}},ie={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){ie[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ie).forEach((function(e){var t=ie[e];oe["easeIn"+e]=t,oe["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},oe["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}},oe["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}}})),oe);function le(e,t){if(ee.fnc(e))return e;var n=e.split("(")[0],r=se[n],o=te(e);switch(n){case"spring":return ne(e,t);case"cubicBezier":return K(ae,o);case"steps":return K(re,o);default:return K(r,o)}}function ue(e){try{return document.querySelectorAll(e)}catch(e){return}}function ce(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(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==a)t=n=r=s;else{var c=s<.5?s*(1+a):s+a-s*a,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function ye(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 be(e,t){return ee.fnc(e)?e(t.target,t.id,t.total):e}function we(e,t){return e.getAttribute(t)}function Ee(e,t,n){if(he([n,"deg","rad","turn"],ye(t)))return t;var r=J.CSS[t+n];if(!ee.und(r))return r;var o=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(o),o.style.position="absolute",o.style.width=100+n;var a=100/o.offsetWidth;i.removeChild(o);var s=a*parseFloat(t);return J.CSS[t+n]=s,s}function Ie(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?Ee(e,o,n):o}}function ke(e,t){return ee.dom(e)&&!ee.inp(e)&&(!ee.nil(we(e,t))||ee.svg(e)&&e[t])?"attribute":ee.dom(e)&&he(V,t)?"transform":ee.dom(e)&&"transform"!==t&&Ie(e,t)?"css":null!=e[t]?"object":void 0}function Se(e){if(ee.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function Te(e,t,n,r){var o=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=Se(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?Ee(e,i,r):i}function xe(e,t,n,r){switch(ke(e,t)){case"transform":return Te(e,t,r,n);case"css":return Ie(e,t,n);case"attribute":return we(e,t);default:return e[t]||0}}function De(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=ye(e)||0,o=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+i+r;case"-":return o-i+r;case"*":return o*i+r}}function Pe(e,t){if(ee.col(e))return ve(e);if(/\s/g.test(e))return e;var n=ye(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function _e(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Be(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=_e(t,i)),t=i}return r}function Ae(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*we(e,"r")}(e);case"rect":return function(e){return 2*we(e,"width")+2*we(e,"height")}(e);case"line":return function(e){return _e({x:we(e,"x1"),y:we(e,"y1")},{x:we(e,"x2"),y:we(e,"y2")})}(e);case"polyline":return Be(e);case"polygon":return function(e){var t=e.points;return Be(e)+_e(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Ce(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;ee.svg(t)&&ee.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=we(r,"viewBox"),a=o.width,s=o.height,l=n.viewBox||(i?i.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a,h:s,vW:l[2],vH:l[3]}}function Oe(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 o=Ce(e.el,e.svg),i=r(),a=r(-1),s=r(1),l=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(e.property){case"x":return(i.x-o.x)*l;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-a.y,s.x-a.x)/Math.PI}}function Le(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Pe(ee.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:ee.str(e)||t?r.split(n):[]}}function Me(e){return ce(e?de(ee.arr(e)?e.map(fe):fe(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ne(e){var t=Me(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Se(e)}}}))}function Re(e,t){var n=pe(t);if(/^spring/.test(n.easing)&&(n.duration=ne(n.easing)),ee.arr(e)){var r=e.length;2===r&&!ee.obj(e[0])?e={value:e}:ee.fnc(t.duration)||(n.duration=t.duration/r)}var o=ee.arr(e)?e:[e];return o.map((function(e,n){var r=ee.obj(e)&&!ee.pth(e)?e:{value:e};return ee.und(r.delay)&&(r.delay=n?0:t.delay),ee.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return me(e,n)}))}function Ue(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=me(function(e){for(var t=ce(de(e.map((function(e){return Object.keys(e)}))),(function(e){return ee.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)ee.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Qe.suspendWhenDocumentHidden&&(Ge()?e=cancelAnimationFrame(e):(We.forEach((function(e){return e._onDocumentVisibility()})),ze()))})),function(){e||Ge()&&Qe.suspendWhenDocumentHidden||!(We.length>0)||(e=requestAnimationFrame(t))}}();function Ge(){return!!document&&document.hidden}function Qe(e){void 0===e&&(e={});var t,n=0,r=0,o=0,i=0,a=null;function s(e){var t=window.Promise&&new Promise((function(e){return a=e}));return e.finished=t,t}var l=function(e){var t=ge(G,e),n=ge(Q,e),r=Ue(n,e),o=Ne(e.targets),i=qe(o,r),a=Ye(i,n),s=je;return je++,me(t,{id:s,children:[],animatables:o,animations:i,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(e);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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/Qe.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(a(),s(l)))))}return s(l),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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Xe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Qe.speed)},l.seek=function(e){g(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,We.push(l),d(),ze())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Je(Me(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ve(e,t){for(var n=t.length;n--;)he(e,t[n].animatable.target)&&t.splice(n,1)}function Je(e,t){var n=t.animations,r=t.children;Ve(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Ve(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Qe.version="3.2.1",Qe.speed=1,Qe.suspendWhenDocumentHidden=!0,Qe.running=We,Qe.remove=function(e){for(var t=Me(e),n=We.length;n--;){Je(t,We[n])}},Qe.get=xe,Qe.set=Xe,Qe.convertPx=Ee,Qe.path=function(e,t){var n=ee.str(e)?ue(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Ce(n),totalLength:Ae(n)*(r/100)}}},Qe.setDashoffset=function(e){var t=Ae(e);return e.setAttribute("stroke-dasharray",t),t},Qe.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?le(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=ee.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=ye(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(a=0),l&&(a=(v-1)/2),u&&(a=v-1),!g.length){for(var y=0;y-1&&We.splice(o,1);for(var s=0;s'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;ot.alert("Uploading Image",null),(new P).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(M,e.url),ot.alert("Image Added to Entry",!0)})).catch((function(){ot.alert("Uh oh. Image not added",!1)}))}}]),t}();it.uploadFiles=[];var at=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new it}}}]),t}(),st=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,i=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function ht(e){return(ht="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 pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gt(){return(gt=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function yt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var bt=yt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),wt=yt(/Edge/i),Et=yt(/firefox/i),It=yt(/safari/i)&&!yt(/chrome/i)&&!yt(/android/i),kt=yt(/iP(ad|od|hone)/i),St=yt(/chrome/i)&&yt(/android/i),Tt={capture:!1,passive:!1};function xt(e,t,n){e.addEventListener(t,n,!bt&&Tt)}function Dt(e,t,n){e.removeEventListener(t,n,!bt&&Tt)}function Pt(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 _t(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Bt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Pt(e,t):Pt(e,t))||r&&e===n)return e;if(e===n)break}while(e=_t(e))}return null}var At,Ct=/\s+/g;function Ot(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Ct," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Ct," ")}}function Mt(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=Mt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Nt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Rt())break;r=jt(r,!1)}return!1}function Ft(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=vt(n,["evt"]);Kt.pluginEvent.bind(Gn)(e,t,mt({dragEl:nn,parentEl:rn,ghostEl:on,rootEl:an,nextEl:sn,lastDownEl:ln,cloneEl:un,cloneHidden:cn,dragStarted:kn,putSortable:mn,activeSortable:Gn.active,originalEvent:r,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn,hideGhostForTarget:Yn,unhideGhostForTarget:jn,cloneNowHidden:function(){cn=!0},cloneNowShown:function(){cn=!1},dispatchSortableEvent:function(e){tn({sortable:t,name:e,originalEvent:r})}},o))};function tn(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Vt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||bt||wt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=mt({},p,Kt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(mt({putSortable:mn,cloneEl:un,targetEl:nn,rootEl:an,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn},e))}var nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,xn,Dn,Pn=!1,_n=!1,Bn=[],An=!1,Cn=!1,On=[],Mn=!1,Ln=[],Nn="undefined"!=typeof document,Rn=kt,Un=wt||bt?"cssFloat":"float",Hn=Nn&&!St&&!kt&&"draggable"in document.createElement("div"),Fn=function(){if(Nn){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Xn=function(e,t){var n=Mt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ft(e,0,t),i=Ft(e,1,t),a=o&&Mt(o),s=i&&Mt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ut(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ut(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Un]||i&&"none"===n[Un]&&l+u>r)?"vertical":"horizontal"},qn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==ht(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},Yn=function(){!Fn&&on&&Mt(on,"display","none")},jn=function(){!Fn&&on&&Mt(on,"display","")};Nn&&document.addEventListener("click",(function(e){if(_n)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),_n=!1,!1}),!0);var Wn=function(e){if(nn){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Bn.some((function(e){if(!Xt(e)){var t=Ut(e),n=e[Vt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Vt]._onDragOver(n)}}var o,i,a},zn=function(e){nn&&nn.parentNode[Vt]._isOutsideThisEl(e.target)};function Gn(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=gt({},t),e[Vt]=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 Xn(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!==Gn.supportPointer&&"PointerEvent"in window&&!It,emptyInsertThreshold:5};for(var r in Kt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in qn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Hn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?xt(e,"pointerdown",this._onTapStart):(xt(e,"mousedown",this._onTapStart),xt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(e,"dragover",this),xt(e,"dragenter",this)),Bn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Jt())}function Qn(e,t,n,r,o,i,a,s){var l,u,c=e[Vt],d=c.options.onMove;return!window.CustomEvent||bt||wt?(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=o||t,l.relatedRect=i||Ut(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function Vn(e){e.draggable=!1}function Jn(){Mn=!1}function $n(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 Zn(e){return setTimeout(e,0)}function Kn(e){return clearTimeout(e)}Gn.prototype={constructor:Gn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Sn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,nn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Ln.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Ln.push(r)}}(n),!nn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!It||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Bt(s,r.draggable,n,!1))&&s.animated||ln===s)){if(dn=qt(s),hn=qt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return tn({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),en("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Bt(l,r.trim(),n,!1))return tn({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),en("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Bt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!nn&&n.parentNode===i){var l=Ut(n);if(an=i,rn=(nn=n).parentNode,sn=nn.nextSibling,ln=n,gn=a.group,Gn.dragged=nn,vn={target:nn,clientX:(t||e).clientX,clientY:(t||e).clientY},En=vn.clientX-l.left,In=vn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,nn.style["will-change"]="all",r=function(){en("delayEnded",o,{evt:e}),Gn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!Et&&o.nativeDraggable&&(nn.draggable=!0),o._triggerDragStart(e,t),tn({sortable:o,name:"choose",originalEvent:e}),Ot(nn,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Nt(nn,e.trim(),Vn)})),xt(s,"dragover",Wn),xt(s,"mousemove",Wn),xt(s,"touchmove",Wn),xt(s,"mouseup",o._onDrop),xt(s,"touchend",o._onDrop),xt(s,"touchcancel",o._onDrop),Et&&this.nativeDraggable&&(this.options.touchStartThreshold=4,nn.draggable=!0),en("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(wt||bt))r();else{if(Gn.eventCanceled)return void this._onDrop();xt(s,"mouseup",o._disableDelayedDrag),xt(s,"touchend",o._disableDelayedDrag),xt(s,"touchcancel",o._disableDelayedDrag),xt(s,"mousemove",o._delayedDragTouchMoveHandler),xt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&xt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){nn&&Vn(nn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._disableDelayedDrag),Dt(e,"touchend",this._disableDelayedDrag),Dt(e,"touchcancel",this._disableDelayedDrag),Dt(e,"mousemove",this._delayedDragTouchMoveHandler),Dt(e,"touchmove",this._delayedDragTouchMoveHandler),Dt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,t?"touchmove":"mousemove",this._onTouchMove):(xt(nn,"dragend",this),xt(an,"dragstart",this._onDragStart));try{document.selection?Zn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Pn=!1,an&&nn){en("dragStarted",this,{evt:t}),this.nativeDraggable&&xt(document,"dragover",zn);var n=this.options;!e&&Ot(nn,n.dragClass,!1),Ot(nn,n.ghostClass,!0),Gn.active=this,e&&this._appendGhost(),tn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(yn){this._lastX=yn.clientX,this._lastY=yn.clientY,Yn();for(var e=document.elementFromPoint(yn.clientX,yn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(yn.clientX,yn.clientY))!==t;)t=e;if(nn.parentNode[Vt]._isOutsideThisEl(e),t)do{if(t[Vt]){if(t[Vt]._onDragOver({clientX:yn.clientX,clientY:yn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);jn()}},_onTouchMove:function(e){if(vn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=on&&Lt(on,!0),a=on&&i&&i.a,s=on&&i&&i.d,l=Rn&&Dn&&Yt(Dn),u=(o.clientX-vn.clientX+r.x)/(a||1)+(l?l[0]-On[0]:0)/(a||1),c=(o.clientY-vn.clientY+r.y)/(s||1)+(l?l[1]-On[1]:0)/(s||1);if(!Gn.active&&!Pn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===nn)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ut(a)),!1!==Qn(an,i,nn,t,a,n,e,!!a))return _(),i.appendChild(nn),rn=i,A(),B(!0)}else if(a.parentNode===i){n=Ut(a);var m,v,y,b=nn.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(nn.animated&&nn.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ht(a,"top","top")||Ht(nn,"top","top"),k=I?I.scrollTop:void 0;if(Sn!==a&&(v=n[E],An=!1,Cn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&xnc+u*i/2:ld-xn)return-Tn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Cn,Sn===a))){var S=qt(nn);do{S-=m,y=rn.children[S]}while(y&&("none"===Mt(y,"display")||y===on))}if(0===m||y===a)return B(!1);Sn=a,Tn=m;var T=a.nextElementSibling,x=!1,D=Qn(an,i,nn,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Mn=!0,setTimeout(Jn,30),_(),x&&!T?i.appendChild(nn):a.parentNode.insertBefore(nn,x?T:a),I&&Gt(I,0,k-I.scrollTop),rn=nn.parentNode,void 0===v||Cn||(xn=Math.abs(v-Ut(a)[E])),A(),B(!0)}if(i.contains(nn))return B(!1)}return!1}function P(s,l){en(s,h,mt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Qn(an,i,nn,t,n,Ut(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Ot(nn,mn?mn.options.ghostClass:u.options.ghostClass,!1),Ot(nn,s.ghostClass,!0)),mn!==h&&h!==Gn.active?mn=h:h===Gn.active&&mn&&(mn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===nn&&!nn.animated||a===i&&!a.animated)&&(Sn=null),s.dragoverBubble||e.rootEl||a===document||(nn.parentNode[Vt]._isOutsideThisEl(e.target),!t&&Wn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){fn=qt(nn),pn=qt(nn,s.draggable),tn({sortable:h,name:"change",toEl:i,newIndex:fn,newDraggableIndex:pn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Dt(document,"mousemove",this._onTouchMove),Dt(document,"touchmove",this._onTouchMove),Dt(document,"pointermove",this._onTouchMove),Dt(document,"dragover",Wn),Dt(document,"mousemove",Wn),Dt(document,"touchmove",Wn)},_offUpEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._onDrop),Dt(e,"touchend",this._onDrop),Dt(e,"pointerup",this._onDrop),Dt(e,"touchcancel",this._onDrop),Dt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;fn=qt(nn),pn=qt(nn,n.draggable),en("drop",this,{evt:e}),rn=nn&&nn.parentNode,fn=qt(nn),pn=qt(nn,n.draggable),Gn.eventCanceled||(Pn=!1,Cn=!1,An=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Kn(this.cloneId),Kn(this._dragStartId),this.nativeDraggable&&(Dt(document,"drop",this),Dt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),It&&Mt(document.body,"user-select",""),Mt(nn,"transform",""),e&&(kn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),on&&on.parentNode&&on.parentNode.removeChild(on),(an===rn||mn&&"clone"!==mn.lastPutMode)&&un&&un.parentNode&&un.parentNode.removeChild(un),nn&&(this.nativeDraggable&&Dt(nn,"dragend",this),Vn(nn),nn.style["will-change"]="",kn&&!Pn&&Ot(nn,mn?mn.options.ghostClass:this.options.ghostClass,!1),Ot(nn,this.options.chosenClass,!1),tn({sortable:this,name:"unchoose",toEl:rn,newIndex:null,newDraggableIndex:null,originalEvent:e}),an!==rn?(fn>=0&&(tn({rootEl:rn,name:"add",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"remove",toEl:rn,originalEvent:e}),tn({rootEl:rn,name:"sort",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),mn&&mn.save()):fn!==dn&&fn>=0&&(tn({sortable:this,name:"update",toEl:rn,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),Gn.active&&(null!=fn&&-1!==fn||(fn=dn,pn=hn),tn({sortable:this,name:"end",toEl:rn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){en("nulling",this),an=nn=rn=on=sn=un=ln=cn=vn=yn=kn=fn=pn=dn=hn=Sn=Tn=mn=gn=Gn.dragged=Gn.ghost=Gn.clone=Gn.active=null,Ln.forEach((function(e){e.checked=!0})),Ln.length=bn=wn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":nn&&(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,o=n.length,i=this.options;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function yt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var bt=yt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),wt=yt(/Edge/i),Et=yt(/firefox/i),It=yt(/safari/i)&&!yt(/chrome/i)&&!yt(/android/i),kt=yt(/iP(ad|od|hone)/i),St=yt(/chrome/i)&&yt(/android/i),Tt={capture:!1,passive:!1};function xt(e,t,n){e.addEventListener(t,n,!bt&&Tt)}function Dt(e,t,n){e.removeEventListener(t,n,!bt&&Tt)}function Pt(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 _t(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Bt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Pt(e,t):Pt(e,t))||r&&e===n)return e;if(e===n)break}while(e=_t(e))}return null}var At,Ct=/\s+/g;function Ot(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Ct," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Ct," ")}}function Lt(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 Mt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Lt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Nt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Rt())break;r=jt(r,!1)}return!1}function Ft(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=vt(n,["evt"]);Kt.pluginEvent.bind(Gn)(e,t,mt({dragEl:nn,parentEl:rn,ghostEl:on,rootEl:an,nextEl:sn,lastDownEl:ln,cloneEl:un,cloneHidden:cn,dragStarted:kn,putSortable:mn,activeSortable:Gn.active,originalEvent:r,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn,hideGhostForTarget:Yn,unhideGhostForTarget:jn,cloneNowHidden:function(){cn=!0},cloneNowShown:function(){cn=!1},dispatchSortableEvent:function(e){tn({sortable:t,name:e,originalEvent:r})}},o))};function tn(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Vt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||bt||wt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=mt({},p,Kt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(mt({putSortable:mn,cloneEl:un,targetEl:nn,rootEl:an,oldIndex:dn,oldDraggableIndex:hn,newIndex:fn,newDraggableIndex:pn},e))}var nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,xn,Dn,Pn=!1,_n=!1,Bn=[],An=!1,Cn=!1,On=[],Ln=!1,Mn=[],Nn="undefined"!=typeof document,Rn=kt,Un=wt||bt?"cssFloat":"float",Hn=Nn&&!St&&!kt&&"draggable"in document.createElement("div"),Fn=function(){if(Nn){if(bt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Xn=function(e,t){var n=Lt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ft(e,0,t),i=Ft(e,1,t),a=o&&Lt(o),s=i&&Lt(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ut(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Ut(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(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Un]||i&&"none"===n[Un]&&l+u>r)?"vertical":"horizontal"},qn=function(e){function t(e,n){return function(r,o,i,a){var s=r.options.group.name&&o.options.group.name&&r.options.group.name===o.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,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==ht(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},Yn=function(){!Fn&&on&&Lt(on,"display","none")},jn=function(){!Fn&&on&&Lt(on,"display","")};Nn&&document.addEventListener("click",(function(e){if(_n)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),_n=!1,!1}),!0);var Wn=function(e){if(nn){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,Bn.some((function(e){if(!Xt(e)){var t=Ut(e),n=e[Vt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&r&&s?a=e:void 0}})),a);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[Vt]._onDragOver(n)}}var o,i,a},zn=function(e){nn&&nn.parentNode[Vt]._isOutsideThisEl(e.target)};function Gn(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=gt({},t),e[Vt]=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 Xn(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!==Gn.supportPointer&&"PointerEvent"in window&&!It,emptyInsertThreshold:5};for(var r in Kt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in qn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Hn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?xt(e,"pointerdown",this._onTapStart):(xt(e,"mousedown",this._onTapStart),xt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(e,"dragover",this),xt(e,"dragenter",this)),Bn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Jt())}function Qn(e,t,n,r,o,i,a,s){var l,u,c=e[Vt],d=c.options.onMove;return!window.CustomEvent||bt||wt?(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=o||t,l.relatedRect=i||Ut(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function Vn(e){e.draggable=!1}function Jn(){Ln=!1}function $n(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 Zn(e){return setTimeout(e,0)}function Kn(e){return clearTimeout(e)}Gn.prototype={constructor:Gn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Sn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,nn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Mn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Mn.push(r)}}(n),!nn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!It||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=Bt(s,r.draggable,n,!1))&&s.animated||ln===s)){if(dn=qt(s),hn=qt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return tn({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),en("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=Bt(l,r.trim(),n,!1))return tn({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),en("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Bt(l,r.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,s=i.ownerDocument;if(n&&!nn&&n.parentNode===i){var l=Ut(n);if(an=i,rn=(nn=n).parentNode,sn=nn.nextSibling,ln=n,gn=a.group,Gn.dragged=nn,vn={target:nn,clientX:(t||e).clientX,clientY:(t||e).clientY},En=vn.clientX-l.left,In=vn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,nn.style["will-change"]="all",r=function(){en("delayEnded",o,{evt:e}),Gn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!Et&&o.nativeDraggable&&(nn.draggable=!0),o._triggerDragStart(e,t),tn({sortable:o,name:"choose",originalEvent:e}),Ot(nn,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Nt(nn,e.trim(),Vn)})),xt(s,"dragover",Wn),xt(s,"mousemove",Wn),xt(s,"touchmove",Wn),xt(s,"mouseup",o._onDrop),xt(s,"touchend",o._onDrop),xt(s,"touchcancel",o._onDrop),Et&&this.nativeDraggable&&(this.options.touchStartThreshold=4,nn.draggable=!0),en("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(wt||bt))r();else{if(Gn.eventCanceled)return void this._onDrop();xt(s,"mouseup",o._disableDelayedDrag),xt(s,"touchend",o._disableDelayedDrag),xt(s,"touchcancel",o._disableDelayedDrag),xt(s,"mousemove",o._delayedDragTouchMoveHandler),xt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&xt(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.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(){nn&&Vn(nn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._disableDelayedDrag),Dt(e,"touchend",this._disableDelayedDrag),Dt(e,"touchcancel",this._disableDelayedDrag),Dt(e,"mousemove",this._delayedDragTouchMoveHandler),Dt(e,"touchmove",this._delayedDragTouchMoveHandler),Dt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,t?"touchmove":"mousemove",this._onTouchMove):(xt(nn,"dragend",this),xt(an,"dragstart",this._onDragStart));try{document.selection?Zn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Pn=!1,an&&nn){en("dragStarted",this,{evt:t}),this.nativeDraggable&&xt(document,"dragover",zn);var n=this.options;!e&&Ot(nn,n.dragClass,!1),Ot(nn,n.ghostClass,!0),Gn.active=this,e&&this._appendGhost(),tn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(yn){this._lastX=yn.clientX,this._lastY=yn.clientY,Yn();for(var e=document.elementFromPoint(yn.clientX,yn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(yn.clientX,yn.clientY))!==t;)t=e;if(nn.parentNode[Vt]._isOutsideThisEl(e),t)do{if(t[Vt]){if(t[Vt]._onDragOver({clientX:yn.clientX,clientY:yn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);jn()}},_onTouchMove:function(e){if(vn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=on&&Mt(on,!0),a=on&&i&&i.a,s=on&&i&&i.d,l=Rn&&Dn&&Yt(Dn),u=(o.clientX-vn.clientX+r.x)/(a||1)+(l?l[0]-On[0]:0)/(a||1),c=(o.clientY-vn.clientY+r.y)/(s||1)+(l?l[1]-On[1]:0)/(s||1);if(!Gn.active&&!Pn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))r.right+o||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+o}(e,o,this)&&!g.animated){if(g===nn)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Ut(a)),!1!==Qn(an,i,nn,t,a,n,e,!!a))return _(),i.appendChild(nn),rn=i,A(),B(!0)}else if(a.parentNode===i){n=Ut(a);var m,v,y,b=nn.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===s||r+i/2===a+l/2}(nn.animated&&nn.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ht(a,"top","top")||Ht(nn,"top","top"),k=I?I.scrollTop:void 0;if(Sn!==a&&(v=n[E],An=!1,Cn=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!a)if(s&&xnc+u*i/2:ld-xn)return-Tn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Cn,Sn===a))){var S=qt(nn);do{S-=m,y=rn.children[S]}while(y&&("none"===Lt(y,"display")||y===on))}if(0===m||y===a)return B(!1);Sn=a,Tn=m;var T=a.nextElementSibling,x=!1,D=Qn(an,i,nn,t,a,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),Ln=!0,setTimeout(Jn,30),_(),x&&!T?i.appendChild(nn):a.parentNode.insertBefore(nn,x?T:a),I&&Gt(I,0,k-I.scrollTop),rn=nn.parentNode,void 0===v||Cn||(xn=Math.abs(v-Ut(a)[E])),A(),B(!0)}if(i.contains(nn))return B(!1)}return!1}function P(s,l){en(s,h,mt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Qn(an,i,nn,t,n,Ut(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Ot(nn,mn?mn.options.ghostClass:u.options.ghostClass,!1),Ot(nn,s.ghostClass,!0)),mn!==h&&h!==Gn.active?mn=h:h===Gn.active&&mn&&(mn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===nn&&!nn.animated||a===i&&!a.animated)&&(Sn=null),s.dragoverBubble||e.rootEl||a===document||(nn.parentNode[Vt]._isOutsideThisEl(e.target),!t&&Wn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){fn=qt(nn),pn=qt(nn,s.draggable),tn({sortable:h,name:"change",toEl:i,newIndex:fn,newDraggableIndex:pn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Dt(document,"mousemove",this._onTouchMove),Dt(document,"touchmove",this._onTouchMove),Dt(document,"pointermove",this._onTouchMove),Dt(document,"dragover",Wn),Dt(document,"mousemove",Wn),Dt(document,"touchmove",Wn)},_offUpEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._onDrop),Dt(e,"touchend",this._onDrop),Dt(e,"pointerup",this._onDrop),Dt(e,"touchcancel",this._onDrop),Dt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;fn=qt(nn),pn=qt(nn,n.draggable),en("drop",this,{evt:e}),rn=nn&&nn.parentNode,fn=qt(nn),pn=qt(nn,n.draggable),Gn.eventCanceled||(Pn=!1,Cn=!1,An=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Kn(this.cloneId),Kn(this._dragStartId),this.nativeDraggable&&(Dt(document,"drop",this),Dt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),It&&Lt(document.body,"user-select",""),Lt(nn,"transform",""),e&&(kn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),on&&on.parentNode&&on.parentNode.removeChild(on),(an===rn||mn&&"clone"!==mn.lastPutMode)&&un&&un.parentNode&&un.parentNode.removeChild(un),nn&&(this.nativeDraggable&&Dt(nn,"dragend",this),Vn(nn),nn.style["will-change"]="",kn&&!Pn&&Ot(nn,mn?mn.options.ghostClass:this.options.ghostClass,!1),Ot(nn,this.options.chosenClass,!1),tn({sortable:this,name:"unchoose",toEl:rn,newIndex:null,newDraggableIndex:null,originalEvent:e}),an!==rn?(fn>=0&&(tn({rootEl:rn,name:"add",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"remove",toEl:rn,originalEvent:e}),tn({rootEl:rn,name:"sort",toEl:rn,fromEl:an,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),mn&&mn.save()):fn!==dn&&fn>=0&&(tn({sortable:this,name:"update",toEl:rn,originalEvent:e}),tn({sortable:this,name:"sort",toEl:rn,originalEvent:e})),Gn.active&&(null!=fn&&-1!==fn||(fn=dn,pn=hn),tn({sortable:this,name:"end",toEl:rn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){en("nulling",this),an=nn=rn=on=sn=un=ln=cn=vn=yn=kn=fn=pn=dn=hn=Sn=Tn=mn=gn=Gn.dragged=Gn.ghost=Gn.clone=Gn.active=null,Mn.forEach((function(e){e.checked=!0})),Mn.length=bn=wn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":nn&&(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,o=n.length,i=this.options;r { + //if key is valid, checks to see if a session is active and returns + this._request( + this.baseURL + ? this.baseURL + API_STATUS + "?key=" + this.key + : API_STATUS + "?key=" + this.key + ).then((response) => { if (response.type === API_ACCESS_GOOD) { this.token = response.token; } else { //don't set token + //console.log("NO TOKEN"); } }); } /** - * Method for retrieving user authorizing user login + * Promise method for checking credentials. Must login to use Admin API. * @param {object} data - json object that contains data for set up * @property {string} handle - handle for site user * @property {string} password - password for site user */ login(data) { return new Promise((resolve, reject) => { - if (this.baseURL) { - data.key = this.key; - data.remote = true; - } else { - data.remote = false; - } + this.baseURL ? (data.remote = true) : (data.remote = false); + this.key ? (data.key = this.key) : (data.key = null); this._request( this.baseURL ? this.baseURL + API_LOGIN : API_LOGIN, AUTH_STATUS, @@ -109,7 +110,9 @@ class FipamoAdminAPI { syncSettings(data) { return new Promise((resolve, reject) => { this._request( - this.baseURL ? this.baseURL + API_SETTINGS_SYNC : API_SETTINGS_SYNC, + this.baseURL + ? this.baseURL + API_SETTINGS_SYNC + "?key=" + this.key + : API_SETTINGS_SYNC + "?key=" + this.key, TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, @@ -190,6 +193,13 @@ class FipamoAdminAPI { break; } + if (this.baseURL) { + data.key = this.key; + data.remote = true; + } else { + data.remote = false; + } + return new Promise((resolve, reject) => { this._request( this.baseURL ? this.baseURL + url : url, @@ -292,7 +302,6 @@ class FipamoAdminAPI { request.open(requestType, requestURL, true); request.onload = () => { if (request.status == 200) { - //console.log("RESPONSE", request); let response = JSON.parse(request["response"]); resolve(response); } else { diff --git a/src/libraries/FipamoContentAPI.js b/src/libraries/FipamoContentAPI.js index b968ad9..00ba453 100644 --- a/src/libraries/FipamoContentAPI.js +++ b/src/libraries/FipamoContentAPI.js @@ -21,7 +21,7 @@ export const TASK_GET_CONTENT = "retrieveContent"; /** * Fipamo Content API * A bag of methods for getting page info from an install. - * To use remotely, include url of install and user key found in settings. + * To use remotely, include url of install and user key found in settings in the Dashboard. */ class FipamoContentAPI { /**