admin-page-columns.js 54.2 KB
!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=47)}([function(e,t,n){"use strict";var s=n(14),i=Object.prototype.toString;function r(e){return"[object Array]"===i.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===i.call(e)}function u(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:r,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:function(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:l,isUndefined:o,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:u,merge:function e(){var t={};function n(n,s){l(t[s])&&l(n)?t[s]=e(t[s],n):l(n)?t[s]=e({},n):r(n)?t[s]=n.slice():t[s]=n}for(var s=0,i=arguments.length;s<i;s++)u(arguments[s],n);return t},extend:function(e,t,n){return u(t,(function(t,i){e[i]=n&&"function"==typeof t?s(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t){e.exports=jQuery},function(e,t,n){var s=n(23),i=n(24),r=n(8);function o(e){if(!(this instanceof o))return new o(e);this._name=e||"nanobus",this._starListeners=[],this._listeners={}}e.exports=o,o.prototype.emit=function(e){r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.emit: eventName should be type string or symbol");for(var t=[],n=1,s=arguments.length;n<s;n++)t.push(arguments[n]);var o=i(this._name+"('"+e.toString()+"')"),a=this._listeners[e];return a&&a.length>0&&this._emit(this._listeners[e],t),this._starListeners.length>0&&this._emit(this._starListeners,e,t,o.uuid),o(),this},o.prototype.on=o.prototype.addListener=function(e,t){return r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.on: eventName should be type string or symbol"),r.equal(typeof t,"function","nanobus.on: listener should be type function"),"*"===e?this._starListeners.push(t):(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)),this},o.prototype.prependListener=function(e,t){return r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.prependListener: eventName should be type string or symbol"),r.equal(typeof t,"function","nanobus.prependListener: listener should be type function"),"*"===e?this._starListeners.unshift(t):(this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].unshift(t)),this},o.prototype.once=function(e,t){r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.once: eventName should be type string or symbol"),r.equal(typeof t,"function","nanobus.once: listener should be type function");var n=this;return this.on(e,(function s(){t.apply(n,arguments),n.removeListener(e,s)})),this},o.prototype.prependOnceListener=function(e,t){r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.prependOnceListener: eventName should be type string or symbol"),r.equal(typeof t,"function","nanobus.prependOnceListener: listener should be type function");var n=this;return this.prependListener(e,(function s(){t.apply(n,arguments),n.removeListener(e,s)})),this},o.prototype.removeListener=function(e,t){return r.ok("string"==typeof e||"symbol"==typeof e,"nanobus.removeListener: eventName should be type string or symbol"),r.equal(typeof t,"function","nanobus.removeListener: listener should be type function"),"*"===e?(this._starListeners=this._starListeners.slice(),n(this._starListeners,t)):(void 0!==this._listeners[e]&&(this._listeners[e]=this._listeners[e].slice()),n(this._listeners[e],t));function n(e,t){if(e){var n=e.indexOf(t);return-1!==n?(s(e,n,1),!0):void 0}}},o.prototype.removeAllListeners=function(e){return e?"*"===e?this._starListeners=[]:this._listeners[e]=[]:(this._starListeners=[],this._listeners={}),this},o.prototype.listeners=function(e){var t="*"!==e?this._listeners[e]:this._starListeners,n=[];if(t)for(var s=t.length,i=0;i<s;i++)n.push(t[i]);return n},o.prototype._emit=function(e,t,n,s){if(void 0!==e&&0!==e.length){void 0===n&&(n=t,t=null),t&&(n=void 0!==s?[t].concat(n,s):[t].concat(n));for(var i=e.length,r=0;r<i;r++){var o=e[r];o.apply(o,n)}}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));const s={TABLE:{READY:"Table.Ready"},SETTINGS:{FORM:{LOADED:"Settings.Form.Loaded",READY:"Settings.Form.Ready",SAVING:"Settings.Form.Saving",SAVED:"Settings.Form.Saved"},COLUMN:{INIT:"Settings.Column.Init",SWITCH:"Settings.Column.SwitchToType",REFRESHED:"Settings.Column.Refreshed"}}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));const s=e=>i.create(e);class i{constructor(e){this.element=e instanceof HTMLElement?e:document.createElement(e)}static create(e){return new i(e)}addId(e){return this.element.id=e,this}addClass(e){return this.element.classList.add(e),this}addClasses(...e){return e.forEach(e=>this.addClass(e)),this}setAttribute(e,t){return this.element.setAttribute(e,t),this}setAttributes(e){return Object.keys(e).forEach(t=>this.setAttribute(t,e[t])),this}addHtml(e){return this.element.innerHTML=e,this}append(e){return this.element.appendChild(e),this}css(e,t){return this.element.style[e]=t,this}insertAfter(e){try{this.element.parentElement.insertBefore(e,this.element.nextElementSibling)}catch(e){console.error("Not able to insert element after current node",this.element)}}insertSelfBefore(e){try{e.parentElement.insertBefore(this.element,e)}catch(e){console.error("Not able to insert element before current node",this.element)}return this}insertBefore(e){try{this.element.parentElement.insertBefore(e,this.element)}catch(e){console.error("Not able to insert element before current node",this.element)}return this}addEventListener(e,t){return this.element.addEventListener(e,t),this}addEventListeners(e,t){return e.forEach(e=>this.addEventListener(e,t)),this}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r}));const s=(e,t=100,n=null,s="block")=>{e.style.display=s,e.style.transition=`opacity ${t}ms`,e.style.opacity="0",setTimeout(()=>{e.style.opacity="1"},100),n&&e.addEventListener("transitionend",()=>{n.call(void 0)},{once:!0})},i=(e,t=100,n=null,s="none")=>{e.style.transition=`opacity ${t}ms`,e.style.opacity="1",setTimeout(()=>{e.style.opacity="0"},100),e.addEventListener("transitionend",()=>{e.style.display=s,n&&n.call(void 0)},{once:!0})},r=(e,t,n={})=>{let s=Object.assign({},{offset:0},n);const i=e.offsetTop+s.offset,r=window.pageYOffset,o=i-r;let a;window.requestAnimationFrame((function e(n){a||(a=n);let s=n-a,i=Math.min(s/t,1);window.scrollTo(0,r+o*i),s<t&&window.requestAnimationFrame(e)}))}},function(e,t,n){e.exports=n(26)},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return i}));const s=()=>{document.querySelectorAll("[data-ac-tip]").forEach(e=>{new i(e)})};class i{constructor(e,t=""){this.element=e,this.content=t||e.dataset.acTip,this.tip=r(this.content),this.initEvents()}initEvents(){"1"!==this.element.dataset.acTooltipInit&&(this.element.dataset.acTooltipInit="1",document.body.appendChild(this.tip),this.element.addEventListener("mouseenter",()=>{const e=document.body.getBoundingClientRect(),t=this.element.getBoundingClientRect();this.tip.style.left=t.left-e.left+this.element.offsetWidth/2+"px",this.tip.style.top=t.top-e.top+this.element.offsetHeight+"px",this.tip.classList.add("hover")}),this.element.addEventListener("mouseleave",()=>{this.tip.classList.remove("hover")}))}}const r=e=>{let t=document.createElement("div");return t.classList.add("ac-tooltip"),t.innerHTML=e,t}},function(e,t){function n(e,t){if(!e)throw new Error(t||"AssertionError")}n.notEqual=function(e,t,s){n(e!=t,s)},n.notOk=function(e,t){n(!e,t)},n.equal=function(e,t,s){n(e==t,s)},n.ok=n,e.exports=n},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));const s=(e,t)=>{if(!t.includes("?"))return null;return new URLSearchParams(t.split("?")[1]).get(e)},i=(e,t=null)=>(t||(t=new FormData),Object.keys(e).forEach(n=>{r(t,e[n],n)}),t),r=(e,t,n=null)=>{if(!t||"object"!=typeof t||t instanceof Date||t instanceof File){const s=null==t?"":t;e.append(n,s)}else Object.keys(t).forEach(s=>{r(e,t[s],n?`${n}[${s}]`:s)})}},function(e,t,n){"use strict";var s=n(7);t.a=class{constructor(){this.init()}init(){Object(s.b)()}}},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return r}));var s=n(4);const i=(e,t)=>{t.parentNode.insertBefore(e,t.nextSibling)},r=(e,t="div")=>s.b.create(t).addHtml(e).element},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return r}));const s=(e,t,n,s=null)=>{(s||document).addEventListener(e,e=>{let s=document.querySelectorAll(t);if(s){for(var i=e.target,r=-1;i&&-1===(r=Array.prototype.indexOf.call(s,i));)i=i.parentElement;r>-1&&n.call(i,e)}})},i=(e,t,n)=>{e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n)},r=(e,t,n)=>{t.forEach(t=>e.addEventListener(t,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));class s{constructor(e){e&&(this.el=e,this.dialog=e.querySelector(".ac-modal__dialog"),this.initEvents())}getElement(){return this.el}initEvents(){let e=this;document.addEventListener("keydown",e=>{const t=e.key;this.isOpen()&&"Escape"===t&&this.close()});let t=this.el.querySelectorAll('[data-dismiss="modal"], .ac-modal__dialog__close');t.length>0&&t.forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),e.close()})}),this.el.addEventListener("click",t=>{t.target.classList.contains("ac-modal")&&e.close()})}isOpen(){return this.el.classList.contains("-active")}close(){this.onClose(),this.el.classList.remove("-active")}open(){setTimeout(()=>{this.onOpen(),this.el.removeAttribute("style"),this.el.classList.add("-active")})}destroy(){this.el.remove()}onClose(){}onOpen(){}}},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),s=0;s<n.length;s++)n[s]=arguments[s];return e.apply(t,n)}}},function(e,t,n){"use strict";var s=n(0);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(s.isURLSearchParams(t))r=t.toString();else{var o=[];s.forEach(t,(function(e,t){null!=e&&(s.isArray(e)?t+="[]":e=[e],s.forEach(e,(function(e){s.isDate(e)?e=e.toISOString():s.isObject(e)&&(e=JSON.stringify(e)),o.push(i(t)+"="+i(e))})))})),r=o.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){var s=n(0),i=n(32),r={"Content-Type":"application/x-www-form-urlencoded"};function o(e,t){!s.isUndefined(e)&&s.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,l={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(a=n(18)),a),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),s.isFormData(e)||s.isArrayBuffer(e)||s.isBuffer(e)||s.isStream(e)||s.isFile(e)||s.isBlob(e)?e:s.isArrayBufferView(e)?e.buffer:s.isURLSearchParams(e)?(o(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):s.isObject(e)?(o(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},s.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),s.forEach(["post","put","patch"],(function(e){l.headers[e]=s.merge(r)})),e.exports=l}).call(this,n(31))},function(e,t,n){"use strict";var s=n(0),i=n(33),r=n(35),o=n(15),a=n(36),l=n(39),c=n(40),u=n(19);e.exports=function(e){return new Promise((function(t,n){var h=e.data,d=e.headers;s.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var f=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(f+":"+m)}var g=a(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),o(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var s="getAllResponseHeaders"in p?l(p.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:s,config:e,request:p};i(t,n,r),p=null}},p.onabort=function(){p&&(n(u("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(u("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(u(t,e,"ECONNABORTED",p)),p=null},s.isStandardBrowserEnv()){var v=(e.withCredentials||c(g))&&e.xsrfCookieName?r.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in p&&s.forEach(d,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),s.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),h||(h=null),p.send(h)}))}},function(e,t,n){"use strict";var s=n(34);e.exports=function(e,t,n,i,r){var o=new Error(e);return s(o,t,n,i,r)}},function(e,t,n){"use strict";var s=n(0);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],r=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(e,t){return s.isPlainObject(e)&&s.isPlainObject(t)?s.merge(e,t):s.isPlainObject(t)?s.merge({},t):s.isArray(t)?t.slice():t}function c(i){s.isUndefined(t[i])?s.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(e[i],t[i])}s.forEach(i,(function(e){s.isUndefined(t[e])||(n[e]=l(void 0,t[e]))})),s.forEach(r,c),s.forEach(o,(function(i){s.isUndefined(t[i])?s.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(void 0,t[i])})),s.forEach(a,(function(s){s in t?n[s]=l(e[s],t[s]):s in e&&(n[s]=l(void 0,e[s]))}));var u=i.concat(r).concat(o).concat(a),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===u.indexOf(e)}));return s.forEach(h,c),n}},function(e,t,n){"use strict";function s(e){this.message=e}s.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},s.prototype.__CANCEL__=!0,e.exports=s},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(10);const i=n(1);class r{constructor(e){this.element=e,this.settings=this.getDefaults(),this.init(),this.setInitialized()}setInitialized(){o.add(this.element)}getDefaults(){return{width:this.element.getAttribute("data-width")?this.element.getAttribute("data-width"):250,noclick:!!this.element.getAttribute("data-noclick")&&this.element.getAttribute("data-noclick"),position:this.getPosition()}}isInitialized(){return o.isInitialized(this.element)}init(){this.isInitialized()||(i(this.element).pointer({content:this.getRelatedHTML(),position:this.settings.position,pointerWidth:this.settings.width,pointerClass:this.getPointerClass()}),this.initEvents())}getPosition(){let e={at:"left top",my:"right top",edge:"right"},t=this.element.getAttribute("data-pos"),n=this.element.getAttribute("data-pos_edge");return"right"===t&&(e={at:"right middle",my:"left middle",edge:"left"}),"right_bottom"===t&&(e={at:"right middle",my:"left bottom",edge:"none"}),"left"===t&&(e={at:"left middle",my:"right middle",edge:"right"}),n&&(e.edge=n),e}getPointerClass(){let e=["ac-wp-pointer","wp-pointer","wp-pointer-"+this.settings.position.edge];return this.settings.noclick&&e.push("noclick"),e.join(" ")}getRelatedHTML(){let e=document.getElementById(this.element.getAttribute("rel"));return e?e.innerHTML:""}initEvents(){let e=i(this.element);this.settings.noclick||e.click((function(){e.hasClass("open")?e.removeClass("open"):e.addClass("open")})),e.click((function(){e.pointer("open")})),e.mouseenter((function(){e.pointer("open"),setTimeout(()=>{e.pointer("open")},2)})),e.mouseleave((function(){setTimeout(()=>{e.hasClass("open")||0!==i(".ac-wp-pointer.hover").length||e.pointer("close")},1)})),e.on("close",()=>{setTimeout(()=>{e.hasClass("open")||e.pointer("close")})})}}class o{static isInitialized(e){return this.initElements.filter(t=>t===e).length>0}static add(e){this.initElements.push(e)}}o.initElements=[];const a=(e=null)=>{e||(e=document.querySelectorAll(".ac-pointer")),e.forEach(e=>{new r(e)}),i(".ac-wp-pointer").hover((function(){i(this).addClass("hover")}),(function(){i(this).removeClass("hover"),i(".ac-pointer").trigger("close")})).on("click",".close",(function(){i(".ac-pointer").removeClass("open")})),new s.a}},function(e,t,n){"use strict";e.exports=function(e,t,n){var s,i=e.length;if(!(t>=i||0===n)){var r=i-(n=t+n>i?i-t:n);for(s=t;s<r;++s)e[s]=e[s+n];e.length=r}}},function(e,t,n){var s,i=n(25)(),r=n(8);o.disabled=!0;try{s=window.performance,o.disabled="true"===window.localStorage.DISABLE_NANOTIMING||!s.mark}catch(e){}function o(e){if(r.equal(typeof e,"string","nanotiming: name should be type string"),o.disabled)return a;var t=(1e4*s.now()).toFixed()%Number.MAX_SAFE_INTEGER,n="start-"+t+"-"+e;function l(r){var o="end-"+t+"-"+e;s.mark(o),i.push((function(){var i=null;try{var a=e+" ["+t+"]";s.measure(a,n,o),s.clearMarks(n),s.clearMarks(o)}catch(e){i=e}r&&r(i,e)}))}return s.mark(n),l.uuid=t,l}function a(e){e&&i.push((function(){e(new Error("nanotiming: performance API unavailable"))}))}e.exports=o},function(e,t,n){var s=n(8),i="undefined"!=typeof window;function r(e){this.hasWindow=e,this.hasIdle=this.hasWindow&&window.requestIdleCallback,this.method=this.hasIdle?window.requestIdleCallback.bind(window):this.setTimeout,this.scheduled=!1,this.queue=[]}r.prototype.push=function(e){s.equal(typeof e,"function","nanoscheduler.push: cb should be type function"),this.queue.push(e),this.schedule()},r.prototype.schedule=function(){if(!this.scheduled){this.scheduled=!0;var e=this;this.method((function(t){for(;e.queue.length&&t.timeRemaining()>0;)e.queue.shift()(t);e.scheduled=!1,e.queue.length&&e.schedule()}))}},r.prototype.setTimeout=function(e){setTimeout(e,0,{timeRemaining:function(){return 1}})},e.exports=function(){var e;return i?(window._nanoScheduler||(window._nanoScheduler=new r(!0)),e=window._nanoScheduler):e=new r,e}},function(e,t,n){"use strict";var s=n(0),i=n(14),r=n(27),o=n(20);function a(e){var t=new r(e),n=i(r.prototype.request,t);return s.extend(n,r.prototype,t),s.extend(n,t),n}var l=a(n(17));l.Axios=r,l.create=function(e){return a(o(l.defaults,e))},l.Cancel=n(21),l.CancelToken=n(41),l.isCancel=n(16),l.all=function(e){return Promise.all(e)},l.spread=n(42),l.isAxiosError=n(43),e.exports=l,e.exports.default=l},function(e,t,n){"use strict";var s=n(0),i=n(15),r=n(28),o=n(29),a=n(20);function l(e){this.defaults=e,this.interceptors={request:new r,response:new r}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[o,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},s.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),s.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,s){return this.request(a(s||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var s=n(0);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){s.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var s=n(0),i=n(30),r=n(16),o=n(17);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=s.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),s.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return a(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return r(t)||(a(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var s=n(0);e.exports=function(e,t,n){return s.forEach(n,(function(n){e=n(e,t)})),e}},function(e,t){var n,s,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(e){n=r}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var l,c=[],u=!1,h=-1;function d(){u&&l&&(u=!1,l.length?c=l.concat(c):h=-1,c.length&&p())}function p(){if(!u){var e=a(d);u=!0;for(var t=c.length;t;){for(l=c,c=[];++h<t;)l&&l[h].run();h=-1,t=c.length}l=null,u=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";var s=n(0);e.exports=function(e,t){s.forEach(e,(function(n,s){s!==t&&s.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[s])}))}},function(e,t,n){"use strict";var s=n(19);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(s("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";e.exports=function(e,t,n,s,i){return e.config=t,n&&(e.code=n),e.request=s,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var s=n(0);e.exports=s.isStandardBrowserEnv()?{write:function(e,t,n,i,r,o){var a=[];a.push(e+"="+encodeURIComponent(t)),s.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),s.isString(i)&&a.push("path="+i),s.isString(r)&&a.push("domain="+r),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var s=n(37),i=n(38);e.exports=function(e,t){return e&&!s(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var s=n(0),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,r,o={};return e?(s.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=s.trim(e.substr(0,r)).toLowerCase(),n=s.trim(e.substr(r+1)),t){if(o[t]&&i.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}},function(e,t,n){"use strict";var s=n(0);e.exports=s.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var s=e;return t&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=s.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var s=n(21);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new s(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var s=n(13);class i{constructor(){this.modals={},this.number=0,this.defaults={modal:s.a},this.initGlobalEvents()}register(e,t=""){return t||(t="m"+this.number),this.modals[t]=e,this.number++,e}get(e){return this.modals.hasOwnProperty(e)?this.modals[e]:null}open(e){this.get(e)&&this.get(e).open()}close(e){this.get(e)&&this.get(e).close()}closeAll(){for(let e in this.modals)this.close(e)}initGlobalEvents(){document.addEventListener("click",e=>{let t=e.target;t.dataset.acModal&&(e.preventDefault(),this.open(t.dataset.acModal))})}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var s=n(2),i=n.n(s),r=n(4);class o{constructor(){this.services={},this.events=new i.a,this.$=r.a}registerService(e,t){return this.services[e]=t,this}getService(e){return this.hasService(e)?this.services[e]:null}hasService(e){return this.services.hasOwnProperty(e)}addListener(e,t){this.events.addListener(e,t)}emitEvent(e,t){this.events.emit(e,t)}}const a=()=>(window.AC_SERVICES||(window.AC_SERVICES=new o),window.AC_SERVICES)},,function(e,t,n){e.exports=n(50)},,,function(e,t,n){"use strict";n.r(t);var s=n(3),i=n(1),r=n.n(i),o=n(2),a=n.n(o);const l=n(6),c=(e,t=null)=>(t||(t=new FormData),Object.keys(e).forEach(n=>{t.append(n,e[n])}),t);var u=n(11),h=n(5);const d=(e="",t=!1)=>{let n=(Date.now()/1e3).toString(16).split(".").join("");for(;n.length<14;)n+="0";let s="";return t&&(s=".",s+=Math.round(1e8*Math.random())),e+n+s},p="closed",f="open",m="remove",g="clone";class v{constructor(e,t,n){this.events=new a.a,this.name=t,this.element=e,this.state=p,this.services=n,this.setPropertiesByElement(e),this.init()}setPropertiesByElement(e){return this.type=e.dataset.type,this.original="1"===e.dataset.original,this.disabled=e.classList.contains("disabled"),e.dataset.columnName=this.name,this}getName(){return this.name}getType(){return this.type}isOriginal(){return this.original}getElement(){return this.element}isDisabled(){return this.element.classList.contains("disabled")}disable(){return this.element.classList.add("disabled"),this}setLoading(e){return e?this.getElement().classList.add("loading"):this.getElement().classList.remove("loading"),this}enable(){return this.element.classList.remove("disabled"),this}init(){return this.services.emitEvent(s.a.SETTINGS.COLUMN.INIT,this),this}destroy(){this.element.remove()}remove(e=350){this.events.emit(m,this),Object(h.b)(this.getElement(),e,()=>{this.destroy()})}getState(){return this.state}toggle(e=150){this.getState()===f?this.close(e):this.open(e)}close(e=0){this.getElement().classList.remove("opened"),r()(this.getElement()).find(".ac-column-body").slideUp(e),this.state=p}open(e=0){this.getElement().classList.add("opened"),r()(this.getElement()).find(".ac-column-body").slideDown(e),this.state=f}isOpen(){return this.state===f}showMessage(e){let t=this.getElement().querySelector(".ac-column-setting--type .msg");t&&(t.innerHTML=e,t.style.display="block")}getJson(){let e=new FormData(this.getElement());e.set("name",this.getName());var t={};for(var n of e.entries()){let e=n[0],s=n[1];if(this.fieldSupportsMultipleValues(e)){let n=t.hasOwnProperty(e)?t[e]:[];n.push(s),t[e]=n}else t[e]=s}return t}switchToType(e){this.setLoading(!0),((e,t=AC.list_screen)=>l.post(ajaxurl,c({_ajax_nonce:AC._ajax_nonce,action:"ac-columns",current_original_columns:JSON.stringify(AC_SERVICES.getService("Form").getOriginalColumns().map(e=>e.getName())),id:"select",list_screen:t,type:e})))(e).then(e=>{if(e.data.success){let t=Object(u.a)(e.data.data.trim()).firstChild;this.name=d(),this.reinitColumnFromElement(t).open()}else this.showMessage(e.data.data.error)}).catch(()=>{this.showMessage(AC.i18n.errors.loading_column)}).finally(()=>this.setLoading(!1))}refresh(){this.setLoading(!0),((e,t,n=AC.list_screen)=>l.post(ajaxurl,c({_ajax_nonce:AC._ajax_nonce,action:"ac-columns",column_name:e,data:t,id:"refresh",list_screen:n})))(this.getName(),JSON.stringify(this.getJson())).then(e=>{e.data.success?(this.reinitColumnFromElement(Object(u.a)(e.data.data.trim()).firstChild),this.services.emitEvent(s.a.SETTINGS.COLUMN.REFRESHED,this),this.isOpen()&&this.open()):this.showMessage(AC.i18n.errors.loading_column)}).finally(()=>this.setLoading(!1))}fieldSupportsMultipleValues(e){let t=this.getElement().elements[e];return t&&"SELECT"===t.tagName&&t.hasAttribute("multiple")}reinitColumnFromElement(e){return this.getElement().parentNode.replaceChild(e,this.getElement()),this.element=e,this.setPropertiesByElement(e).init(),this}}var y=n(4);class E{constructor(e,t){this.form=e,this.services=t,this.columns=[],this.services.emitEvent(s.a.SETTINGS.FORM.LOADED,this),this.init()}init(){this.initColumns(),this.isDisabled()&&(this.disableFields(),this.disableColumns()),this.services.emitEvent(s.a.SETTINGS.FORM.READY,this)}getElement(){return this.form}getColumns(){return this.columns}getSortedColumns(){let e=[];return this.getElement().querySelectorAll("form.ac-column").forEach(t=>{let n=this.columns.find(e=>e.getName()===t.dataset.columnName);n&&e.push(n)}),e}placeColumn(e,t=null){return t?Object(u.b)(e.getElement(),t):this.getElement().querySelector(".ac-columns").append(e.getElement()),setTimeout(()=>{Object(h.c)(e.getElement(),300,{offset:-18})},300),this}createNewColumn(){let e=b(this.services);return this.columns.push(e),this.placeColumn(e),this.bindColumnEvents(e),e.open(300),e}isDisabled(){return this.form.classList.contains("-disabled")}getOriginalColumns(){return this.columns.filter(e=>e.isOriginal())}disableColumns(){this.columns.forEach(e=>e.disable())}initColumns(){this.getElement().querySelectorAll(".ac-column").forEach(e=>{let t=new v(e,e.dataset.columnName,this.services);this.columns.push(t),this.bindColumnEvents(t)})}bindColumnEvents(e){e.events.addListener(m,()=>{this.removeColumn(e.getName())}),e.events.addListener(g,()=>{let t=new v(e.getElement().cloneNode(!0),d(),this.services);this.columns.push(t),this.placeColumn(t,e.getElement()).bindColumnEvents(t),e.isOpen()?t.open():t.close(),Object(h.a)(t.getElement(),300)})}resetColumns(){this.columns.forEach(e=>{e.destroy()}),this.columns=[]}getFormData(){let e={},t=this.getElement().querySelector("input[name=title]");return this.getSortedColumns().forEach(t=>{e[t.getName()]=t.getJson()}),{title:t?t.value:"",list_screen:AC.list_screen,list_screen_id:AC.layout,columns:e,settings:this.getPreferences()}}disableFields(){this.getElement().querySelectorAll("input, select, button").forEach(e=>{e.setAttribute("readonly","readonly"),e.setAttribute("disabled","disabled")})}submitForm(){var e;this.services.emitEvent(s.a.SETTINGS.FORM.SAVING,this),(e=this.getFormData(),l.post(ajaxurl,c({action:"ac-columns",id:"save",_ajax_nonce:AC._ajax_nonce,data:JSON.stringify(e)}))).then(e=>{if(e.data.success)this.showMessage(e.data.data.message,"updated"),AC.layout=e.data.data.list_id;else if(e.data){let t=e.data;this.showMessage(t.data.message,"notice notice-warning")}}).catch(()=>{this.showMessage(AC.i18n.error.save_settings)}).finally(()=>{this.services.emitEvent(s.a.SETTINGS.FORM.SAVED,this)})}showMessage(e,t="updated"){let n=y.b.create("div").addClass("ac-message").addClasses(...t.split(" ")).addHtml(`<p>${e}</p>`).element,s=document.querySelector(".ac-admin__main");s.querySelectorAll(".ac-message").forEach(e=>e.remove()),s.insertAdjacentElement("afterbegin",n),Object(h.a)(n,600)}removeColumn(e){this.columns.forEach((t,n)=>{e===t.getName()&&this.columns.splice(n,1)})}getPreferences(){let e={};return document.querySelectorAll("form[data-form-part=preferences]").forEach(t=>{let n=new FormData(t);for(let s of n.entries()){let i=s[0],r=s[1],o=t.elements[i];e[i]="SELECT"===o.tagName&&o.hasAttribute("multiple")?n.getAll(i):e[i]=r}}),e}}const b=e=>{let t=document.querySelector("#add-new-column-template .ac-column").cloneNode(!0);const n=d();return t.querySelectorAll("label[for]").forEach(e=>{let s=e.getAttribute("for");if(s){let i=t.querySelector("#"+s);if(i){const t=s+n;e.setAttribute("for",t),i.id=t}}}),new v(t,n,e)};var S=n(45);const w=(e,t)=>{let n=e?"on":"off";t.forEach(e=>{e.value===n&&(e.checked=!0,e.dispatchEvent(new Event("change")),e.dispatchEvent(new Event("click")))})};var A=n(12);const _=(e,t)=>{let n=e.closest(".col-label").querySelector("div.tooltip");n&&(n.style.display=t)},L=(e,t)=>{t.getElement().querySelectorAll("[data-column-label]").forEach(t=>t.innerHTML=e.value)};var q=n(13);class C{constructor(e,t){this.column=e,this.setting=t,this.field=this.setting.querySelector(".ac-setting-input_label"),e.getElement().querySelector(".-iconpicker")&&(this.modal=new x(e.getElement().querySelector(".-iconpicker")),this.modal.setIconSelection(this.getDashIconFromValue()),this.initEvents())}initEvents(){this.column.getElement().querySelectorAll(".ac-setting-label-icon").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),this.modal.open()})}),this.modal.onSubmit(()=>{this.setLabel(this.modal.getDashIconMarkup()),this.modal.close()})}getDashIconFromValue(){let e=document.createRange().createContextualFragment(this.getValue()).querySelector(".dashicons"),t=null;return e?(e.classList.forEach(e=>{0===e.indexOf("dashicons-")&&(t=e.replace("dashicons-",""))}),t):t}getValue(){return this.field.value}setLabel(e){this.field&&(this.field.value=e,this.field.dispatchEvent(new Event("change")))}}class x extends q.a{constructor(e){super(e),this.events=new a.a,this.dashIcon=null}initEvents(){super.initEvents(),this.getElement().querySelectorAll('[data-action="submit"]').forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),this.events.emit("submit")})}),this.getIconElements().forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),this.setIconSelection(e.dataset.dashicon),this.getIconElements().forEach(e=>e.classList.remove("active")),e.classList.add("active")})})}getIconElements(){return this.getElement().querySelectorAll(".ac-ipicker__icon")}onSubmit(e){this.events.on("submit",e)}getDashIconMarkup(){return`<span class="dashicons dashicons-${this.dashIcon}"></span>`}setIconSelection(e){let t=this.getElement().querySelector(".ac-ipicker__selection");this.dashIcon=e,t.innerHTML=this.getDashIconMarkup(),t.style.visibility="visible"}}class O{constructor(e,t){this.column=e,this.setting=t,this.field=this.setting.querySelector(".ac-setting-input select"),this.initState(),this.bindEvents()}getValue(){return this.field.value}bindEvents(){this.field.addEventListener("change",()=>this.initState())}initState(){this.toggleSubSettings("cpac-custom"===this.getValue())}toggleSubSettings(e=!0){this.setting.querySelectorAll(".ac-column-setting").forEach(t=>t.style.display=e?"table":"none")}}const T=n(6);class k{constructor(e,t){this.column=e,this.setting=t,this.bindEvents()}bindEvents(){this.refreshPreview(),this.setting.querySelectorAll("input").forEach(e=>{e.addEventListener("change",()=>this.refreshPreview())})}refreshPreview(){this.getExampleRequest().then(e=>{this.setting.querySelectorAll("[data-preview]").forEach(t=>t.textContent=e.data.data)})}getValue(){let e=this.setting.querySelector(".ac-setting-input_number_decimals"),t=this.setting.querySelector(".ac-setting-input_number_decimal_point"),n=this.setting.querySelector(".ac-setting-input_number_thousands_separator");return{decimals:e?e.value:"",decimal_point:t?t.value:"",thousands_point:n?n.value:""}}getExampleRequest(){const e=this.getValue();let t=new FormData;return t.set("action","ac_number_format"),t.set("number","7500"),t.set("decimals",e.decimals),t.set("decimal_point",e.decimal_point),t.set("thousands_sep",e.thousands_point),T.post(ajaxurl,t,{})}}function j(e,t){if(""===jQuery.trim(e.term))return t;if(void 0===t.children)return null;var n=[];if(jQuery.each(t.children,(function(t,s){s.text.toUpperCase().indexOf(e.term.toUpperCase())>-1&&n.push(s)})),n.length){var s=jQuery.extend({},t,!0);return s.children=n,s}return null}class N{constructor(e,t){this.column=e,this.setting=t,this.bindEvents()}bindEvents(){const e=this.setting.querySelector(".ac-setting-input_type");e&&(e.removeAttribute("data-select2-id"),this.setting.querySelectorAll(".select2").forEach(e=>{e.remove()}),r()(e).ac_select2({theme:"acs2",width:"100%",dropdownCssClass:"-type-selector",escapeMarkup:function(e){return e},templateResult:function(e){let t=e.text;return e.hasOwnProperty("id")&&e.id.includes("placeholder-")&&(t+='<span style="background-color:#FE3D6C; color:#fff; font-size: 10px; margin-top: -1px; padding: 1px 5px; border-radius: 2px; text-transform: uppercase;float: right; margin-right 10px;">PRO</span>'),t},matcher:j}))}}class I{constructor(e,t){this.column=e,this.setting=t,this.events=new a.a,this.indicator=new R(e.getElement().querySelector(".ac-column-heading-setting--width")),this.widthInput=this.setting.querySelector("[data-width-input]"),this.unitInput=this.setting.querySelectorAll("[data-unit-input] input"),this.init()}getWidth(){let e=this.widthInput.value;return e?parseInt(e):null}setWidth(e){this.widthInput.value=e?e.toString():null,this.updateIndicator()}updateUnit(){this.setting.querySelector(".description .unit").innerHTML=this.getUnit()}getUnit(){let e=this.setting.querySelector("[data-unit-input] input:checked");return e?e.value:null}getValue(){return{width:this.getWidth(),unit:this.getUnit()}}validate(){let e=this.getWidth();(0===e||e<0)&&this.setWidth(null),"%"===this.getUnit()&&e>100&&this.setWidth(100)}init(){this.widthInput.addEventListener("keyup",()=>{this.updateIndicator(),this.initSlider(),this.validate()}),this.unitInput.forEach(e=>{e.addEventListener("change",()=>{this.initSlider(),this.updateIndicator(),this.updateUnit(),this.validate()})}),this.initSlider()}updateIndicator(){this.indicator.setValue(this.getWidth(),this.getUnit())}initSlider(){let e=this.column.getElement().querySelector(".width-slider");r()(e).slider({range:"min",min:0,max:"%"===this.getUnit()?100:500,value:this.getWidth(),slide:(e,t)=>{this.setWidth(t.value)}})}}class R{constructor(e){this.element=e,this.events=new a.a}setValue(e,t){if(null===e)return this.element.innerText="";this.element.innerText=`${e.toString()}${t}`}}const D=n(6);class M{constructor(e,t){this.column=e,this.setting=t,this.options=this.setting.querySelectorAll(".radio-labels input[type=radio]"),this.valueInput=this.setting.querySelector("[data-value-input]");let n=this.setting.querySelector(".radio-labels code");this.defaultFormat=n?n.textContent:"Y-m-d";let s=[...this.options].filter(e=>void 0!==e.dataset.custom);this.customOption=new F(s[0],this.setting.querySelector("[data-custom-date]"),this.setting.querySelector(".ac-setting-input-date__example"),this.valueInput),this.initEvents()}getOptionsAsArray(){return Array.from(this.options)}getSelectionOption(){let e=this.getOptionsAsArray().filter(e=>e.checked);return e?e[0]:null}initEvents(){this.options.forEach(e=>{e.addEventListener("change",()=>this.handleUpdate(e))}),this.setSelected(),this.customOption.updateExample()}setSelected(){let e=this.getOptionsAsArray().find(e=>e.value===this.getCurrentValue());e&&(e.checked=!0,e.dispatchEvent(new Event("change")))}handleUpdate(e){if(this.valueInput.value=e.value,this.customOption.toggle(void 0!==e.dataset.custom),this.setHelpText(this.getHelpTextFromType(e)),void 0===e.dataset.custom){switch(this.valueInput.value){case"custom":break;case"wp_default":case"diff":this.customOption.setExample("");break;default:this.customOption.setExample(this.valueInput.value)}this.customOption.updateExample()}}getCurrentValue(){return this.valueInput.value}setHelpText(e){let t=this.setting.querySelector(".help-msg");t.innerHTML=e,t.style.display="block"}getHelpTextFromType(e){let t=e.closest("label").querySelector("[data-help]");return t?t.innerHTML:null}}class F{constructor(e,t,n,s){this.radio=e,this.input=t,this.example=n,this.valueElement=s,this.timeout=null,this.input.addEventListener("change",()=>{this.updateExample(),e.checked&&(this.valueElement.value=this.input.value)}),this.input.addEventListener("keyup",()=>{e.checked&&(this.valueElement.value=this.input.value),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.updateExample(),500)})}setExample(e){this.input.value=e}updateExample(){this.getExample().then(e=>{this.example.innerHTML=e.data})}toggle(e=!0){e?this.input.removeAttribute("disabled"):this.input.setAttribute("disabled","disabled")}getExample(){let e=new FormData;return e.set("action","date_format"),e.set("date",this.input.value),D.post(ajaxurl,e,{})}}const P=n(6);class U{constructor(e,t){this.column=e,this.setting=t,this.select=t.querySelector(".custom_field"),this.bindEvents()}bindEvents(){const e=H(this.select.dataset.type,this.select.dataset.post_type),t=this.column.getElement().querySelectorAll('[data-setting="edit"][data-indicator-toggle]').length>0;this.select.querySelectorAll("optgroup").forEach(e=>{e.remove()}),this.select.removeAttribute("data-select2-id"),this.setting.querySelectorAll(".select2").forEach(e=>{e.remove()}),e.getOptions().then(e=>{r()(this.select).ac_select2({theme:"acs2",width:"100%",tags:t,dropdownCssClass:"-customfields",data:e})})}}class B{constructor(e,t){this.metaType=e,this.postType=t,this.loading=!1,this.data=null,this.events=new a.a}retrieveOptions(){this.loading=!0;let e=new FormData;return e.set("action","ac_custom_field_options"),e.set("post_type",this.postType),e.set("meta_type",this.metaType),e.set("_ajax_nonce",AC._ajax_nonce),P.post(ajaxurl,e)}getOptions(){return new Promise((e,t)=>{this.data?e(this.data):this.loading?this.events.on("loaded",()=>{e(this.data)}):this.retrieveOptions().then(n=>{n.data.success||t(),this.data=n.data.data.results,this.events.emit("loaded"),e(this.data)})})}}const H=(e,t)=>{const n=`custom_field_${e}_${t}`;return void 0===window.AC_Requests&&(window.AC_Requests={}),window.AC_Requests.hasOwnProperty(n)||(window.AC_Requests[n]=new B(e,t)),window.AC_Requests[n]};class V{constructor(e){this.element=e,this.inputs=e.querySelectorAll('.ac-setting-input input[type="radio"]'),this.subFields=e.querySelectorAll(".ac-column-setting"),this.initState(),this.initEvents()}initEvents(){this.inputs.forEach(e=>{e.addEventListener("change",()=>this.initState())})}initState(){this.isOptionEnabled()?this.subFields.forEach(e=>e.style.display="table"):this.subFields.forEach(e=>e.style.display="none")}isOptionEnabled(){let e=Array.from(this.inputs).filter(e=>e.checked);return!!e.length&&"on"===e[0].value}}class G{constructor(e,t){this.column=e,this.select=t,this.bindEvents()}bindEvents(){this.select.removeAttribute("data-select2-id"),this.select.parentElement.querySelectorAll(".select2").forEach(e=>{e.remove()}),r()(this.select).ac_select2({theme:"acs2",width:"100%",escapeMarkup:function(e){return e}})}}var $=class{constructor(e){this.element=e,this.init()}init(){this.element.querySelector("a.no").addEventListener("click",e=>{e.preventDefault(),Object(h.b)(this.element.querySelector("#feedback-choice"),300,()=>{Object(h.a)(this.element.querySelector("#feedback-support"),300)})}),this.element.querySelector("a.yes").addEventListener("click",e=>{e.preventDefault(),Object(h.b)(this.element.querySelector("#feedback-choice"),300,()=>{Object(h.a)(this.element.querySelector("#feedback-rate"),300)})})}},z=n(6),W=n.n(z),J=n(9);class X{constructor(e,t,n,s){this.name=e,this.input=t,this.toggleClass=n,this.container=s,this.initEvents()}initEvents(){this.input.addEventListener("change",()=>{this.input.checked?this.container.classList.add(this.toggleClass):this.container.classList.remove(this.toggleClass),this.persist()})}persist(){W.a.post(ajaxurl,Object(J.b)({action:"ac_admin_screen_options",_ajax_nonce:AC._ajax_nonce,option_name:this.name,option_value:this.input.checked?1:0}))}}var Y=n(7),Q=n(22);const K=n(6);class Z{constructor(e){this.listScreens=e,this.processed=[],this.errors=[],this.success=[],this.events=new a.a,this.run()}doAjaxCall(e){return K.get(e.screen_link)}run(){Object.values(this.listScreens).forEach(e=>this.processListScreen(e))}onFinish(){this.success.length===Object.keys(this.listScreens).length&&this.events.emit("success"),this.errors.length>0&&this.events.emit("error")}checkFinish(){this.processed.length===Object.keys(this.listScreens).length&&this.onFinish()}processListScreen(e){this.doAjaxCall(e).then(t=>{"ac_success"===t.data?this.success.push(e):this.errors.push(e)}).catch(()=>{this.errors.push(e)}).finally(()=>{this.processed.push(e),this.checkFinish()})}}var ee=n(44);let te=Object(S.a)();te.registerService("Modals",new ee.a),new class{constructor(e){e.addListener(s.a.SETTINGS.COLUMN.INIT,e=>{(e=>{e.getElement().querySelectorAll('[data-toggle="column"]').forEach(t=>{t.addEventListener("click",t=>e.toggle()),t.style.cursor="pointer"})})(e),(e=>{e.isDisabled()||e.getElement().querySelectorAll("[data-indicator-toggle]").forEach(t=>{let n=e.getElement().querySelectorAll(`.ac-column-setting[data-setting='${t.dataset.setting}'] .col-input .ac-setting-input:first-child input[type=radio]`);t.addEventListener("click",()=>{w(!t.classList.contains("on"),n)}),n.forEach(e=>{e.addEventListener("change",()=>{"off"===e.value?t.classList.remove("on"):t.classList.add("on")})})})})(e),(e=>{e.getElement().querySelectorAll("select.ac-setting-input_type").forEach(t=>{r()(t).on("change",()=>e.switchToType(t.value))})})(e),(e=>{e.getElement().querySelectorAll("[data-remove-column]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),e.remove()})})})(e),(e=>{e.getElement().querySelectorAll(".clone-button").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),e.isOriginal()||e.events.emit(g)})})})(e),(e=>{let t=e.getElement().querySelector(".ac-column-setting--label input");t&&Object(A.b)(t,["change","keyup"],()=>L(t,e))})(e),(e=>{e.getElement().querySelectorAll(".col-label .label").forEach(e=>{Object(A.c)(e,()=>_(e,"block"),()=>_(e,"none"))})})(e),(e=>{e.getElement().querySelectorAll('select[data-label="update"]').forEach(t=>{t.addEventListener("change",()=>{let n=e.getElement().querySelector("input.ac-setting-input_label"),s=t.selectedOptions.length>0?t.selectedOptions[0]:null;n&&s&&(n.value=s.innerHTML,n.dispatchEvent(new Event("change")))})}),setTimeout(()=>{e.getElement().querySelectorAll("[data-column-label]").forEach(t=>{t.offsetWidth<10&&(t.innerText=e.getType())})},50)})(e),(e=>{e.getElement().querySelectorAll('[data-refresh="column"], [data-refresh="column"] input').forEach(t=>{t.addEventListener("change",()=>{setTimeout(()=>e.refresh(),50)})})})(e),(e=>{e.getElement().querySelectorAll("select[multiple]").forEach(t=>{new G(e,t)})})(e),(e=>{let t=e.getElement().querySelector(".ac-column-setting--label");t&&new C(e,t)})(e),(e=>{let t=e.getElement().querySelector(".ac-column-setting--image");t&&new O(e,t)})(e),(e=>{e.getElement().querySelectorAll(".ac-column-setting--number_format").forEach(t=>{new k(e,t)})})(e),(e=>{e.getElement().querySelectorAll('[data-setting="type"]').forEach(t=>{new N(e,t)})})(e),(e=>{e.getElement().querySelectorAll('table[data-setting="width"]').forEach(t=>new I(e,t))})(e),(e=>{e.getElement().querySelectorAll("[data-setting=date]").forEach(t=>new M(e,t))})(e),(e=>{e.getElement().querySelectorAll(".ac-column-setting--pro").forEach(e=>{e.querySelectorAll("input").forEach(t=>{t.addEventListener("click",()=>r()(e).find("[data-ac-modal]").trigger("click"))})})})(e),(e=>{e.getElement().querySelectorAll("[data-setting=custom_field]").forEach(t=>new U(e,t))})(e),(e=>{e.getElement().querySelectorAll(".ac-column-setting--filter,.ac-column-setting--sort,.ac-column-setting--edit").forEach(e=>{new V(e)})})(e)})}}(te),document.addEventListener("DOMContentLoaded",()=>{ne(),document.querySelectorAll("#listscreen_settings").forEach(e=>{te.registerService("Form",new E(e,te))}),document.querySelectorAll("#ac-modal-pro").forEach(e=>{te.getService("Modals").register(new q.a(e),"pro")}),document.querySelectorAll("#ac_list_screen").forEach(e=>{e.addEventListener("change",()=>{document.querySelectorAll(".view-link").forEach(e=>e.style.display="none"),e.closest("form").submit(),e.disabled=!0,e.nextElementSibling.style.display="inline-block"})}),document.querySelectorAll("#direct-feedback").forEach(e=>new $(e)),AC.hasOwnProperty("uninitialized_list_screens")&&(e=>{if(Object.keys(e).length>0)if(e.hasOwnProperty(AC.list_screen)){const t=new Z({[AC.list_screen]:e[AC.list_screen]});t.events.on("error",()=>{document.querySelectorAll(".ac-loading-msg-wrapper").forEach(e=>e.remove()),document.querySelectorAll(".menu").forEach(e=>e.classList.remove("hidden"))}),t.events.on("success",()=>{window.location.href=`${location.href}&t=${Date.now()}`})}else new Z(e)})(AC.uninitialized_list_screens),document.querySelectorAll('[data-ac-screen-option="show_column_id"] input').forEach(e=>new X("show_column_id",e,"show-column-id",document.querySelector(".ac-boxes"))),document.querySelectorAll('[data-ac-screen-option="show_column_type"] input').forEach(e=>new X("show_column_type",e,"show-column-type",document.querySelector(".ac-boxes"))),document.querySelectorAll('[data-ac-screen-option="show_list_screen_id"] input').forEach(e=>new X("show_list_screen_id",e,"show-list-screen-id",document.querySelector(".ac-admin"))),document.querySelectorAll('[data-ac-screen-option="show_list_screen_type"] input').forEach(e=>new X("show_list_screen_type",e,"show-list-screen-type",document.querySelector(".ac-admin")))}),te.addListener(s.a.SETTINGS.FORM.LOADED,e=>{document.querySelectorAll(".add_column").forEach(t=>t.addEventListener("click",()=>e.createNewColumn())),document.querySelectorAll("a[data-clear-columns]").forEach(t=>t.addEventListener("click",()=>e.resetColumns()));let t=r()(e.getElement());t.hasClass("ui-sortable")?t.sortable("refresh"):t.sortable({items:".ac-column",handle:"[data-sort-handle]"})}),te.addListener(s.a.SETTINGS.FORM.SAVING,()=>{document.querySelector("#cpac .ac-admin").classList.add("saving")}),te.addListener(s.a.SETTINGS.FORM.SAVED,()=>{document.querySelector("#cpac .ac-admin").classList.remove("saving"),document.querySelector("#cpac .ac-admin").classList.add("stored")}),te.addListener(s.a.SETTINGS.COLUMN.INIT,e=>{Object(Y.b)(),Object(Q.a)(e.getElement().querySelectorAll(".ac-pointer"))});const ne=()=>{const e=document.querySelectorAll(".sidebox a.submit, .column-footer a.submit");te.addListener(s.a.SETTINGS.FORM.READY,t=>{e.forEach(n=>{n.addEventListener("click",n=>{n.preventDefault(),e.forEach(e=>e.setAttribute("disabled","disabled")),t.submitForm()})})}),te.addListener(s.a.SETTINGS.FORM.SAVED,()=>e.forEach(e=>e.removeAttribute("disabled")))}}]);