/
home
/
assocoweys
/
fiacat
/
administrator
/
components
/
com_sppagebuilder
/
assets
/
editor
/
dist
/
js
/
Upload File
HOME
/*! For license information please see 578.min.js.LICENSE.txt */ "use strict";(self.webpackChunkreact_typescript_webpack_backend_editor=self.webpackChunkreact_typescript_webpack_backend_editor||[]).push([[578],{626:(t,e,r)=>{r.r(e),r.d(e,{default:()=>Ae});var n=r(3871),o=r(7870),i=r(7264),a=r(1731),l=r(4353),c=r(8122),u=r(5350),s=r(7579),d=r(3039),f=r(7894),p=r(824),h=r(4185),y=r(917),v=r(5944);const b=function(t){var e=t.type,r=void 0===e?"primary":e,n=t.message,o=void 0===n?"":n;return(0,v.tZ)("div",{css:g.modalWrapper(r),children:(0,v.BX)("div",{css:g.content(r),children:[(0,v.tZ)(i.Z,{name:r,width:20,height:20}),o]})})};var g={modalWrapper:function(t){return(0,y.iv)("max-width:450px;min-height:30px;background:",p.qo.background[t],";border-radius:",p.E0[4],";;label:modalWrapper;")},content:function(t){return(0,y.iv)("padding:",p.W0[8]," ",p.W0[12],";",h.c.body()," color:",p.qo.text[t],";display:flex;align-items:center;gap:",p.W0[4],";;label:content;")}},E=r(7898),m=r(1234),_=r(2328),O=r(230),S=r(7294),w=r(1709),P=r(9781);function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function I(){I=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),l=new P(o||[]);return n(a,"_invoke",{value:_(t,r,l)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function f(){}function p(){}function h(){}var y={};c(y,i,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(A([])));b&&b!==e&&r.call(b,i)&&(y=b);var g=h.prototype=f.prototype=Object.create(y);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){function o(n,i,a,l){var c=s(t[n],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==L(d)&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(d).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,l)}))}l(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=O(a,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function A(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return p.prototype=h,n(g,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:p,configurable:!0}),p.displayName=c(h,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,l,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},E(m.prototype),c(m.prototype,a,(function(){return this})),t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(g),c(g,l,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=A,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;w(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){D(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function D(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==L(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===L(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function R(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){C(i,n,o,a,l,"next",t)}function l(t){C(i,n,o,a,l,"throw",t)}a(void 0)}))}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var G=function(t){var e,r,i=t.title,a=t.label,l=t.bulkAction,c=t.confirmButtonText,u=t.closeModal,s=t.mutationFn,d=t.invalidateKeys,f=t.skipMutation,p=void 0!==f&&f,h=t.payload,y=(0,m.$)(),g=(0,_.v)((function(t){return t.appConfig})),w={language:"languages",access:"access_levels",category:"categories"},L=(e=(0,S.useState)({label:(0,O.$K)(g[w[l]])&&g[w[l]].length>0?g[w[l]][0].label:"",value:(0,O.$K)(g[w[l]])&&g[w[l]].length>0?g[w[l]][0].value:""}),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),A=L[0],D=L[1],C=(0,E.A)({mutationFn:s,invalidateKeys:d});return(0,v.tZ)(P.Z,{onClose:function(){return u({action:"CLOSE"})},title:i,headerCss:B.modalHeaderCss,contentCss:B.modalContentCss,wrapperCss:B.modalWrapper,children:(0,v.BX)("div",{children:[(0,v.BX)("div",{css:B.content,children:[g[w[l]].length>0?(0,v.tZ)(b,{type:"primary",message:y("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_MODAL_INFO")}):(0,v.tZ)(b,{type:"warning",message:y("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_MODAL_WARNING")}),(0,v.tZ)(o.Z,{options:g[w[l]],value:A,label:a,onChange:function(t){D(t)},clearOption:function(){return D({label:"",value:""})}})]}),(0,v.BX)("div",{css:B.footerWrapper,children:[(0,v.tZ)(n.Z,{variant:"secondary",onClick:function(){return u({action:"CLOSE"})},children:y("COM_SPPAGEBUILDER_EDITOR_CANCEL")}),(0,v.tZ)(n.Z,{disabled:0===g[w[l]].length||""===A.value,onClick:R(I().mark((function t(){var e,r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!p){t.next=3;break}return u({action:"CONFIRM"}),t.abrupt("return");case 3:if(!h){t.next=11;break}return t.next=6,C.mutateAsync(T(T({},h),{},{value:A.value}));case 6:if(e=t.sent,r=e.data,!((0,O.$K)(r.status)?r.status:r)){t.next=11;break}return u({action:"CONFIRM"}),t.abrupt("return");case 11:u({action:"CLOSE"});case 12:case"end":return t.stop()}}),t)}))),loading:C.isLoading,children:c||y("COM_SPPAGEBUILDER_EDITOR_UPDATE")})]})]})})},B={modalWrapper:{name:"1utdhwa-modalWrapper",styles:"max-width:450px;label:modalWrapper;"},content:(0,y.iv)("display:flex;flex-direction:column;gap:",p.W0[16],";padding:",p.W0[16]," ",p.W0[24],";p{",h.c.body(),";};label:content;"),footerWrapper:(0,y.iv)("display:flex;justify-content:end;gap:",p.W0[8],";padding:",p.W0[12]," ",p.W0[16],";box-shadow:",p.AF.dividerTop,";;label:footerWrapper;"),modalHeaderCss:(0,y.iv)("padding:",p.W0[12]," ",p.W0[24],";;label:modalHeaderCss;"),modalContentCss:(0,y.iv)("background-color:",p.qo.background.white,";;label:modalContentCss;"),labelCss:(0,y.iv)("width:fit-content;",h.c.body("medium"),";;label:labelCss;")},j=r(5827),M=r(3816),k=r(9148),U=r(9085),Z=r(9313),N=r(4101),W=r(3579),F=r(1954),q=r(1921);function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Y=function(t){var e,r,n=t.value,o=t.options,a=t.onChange,l=void 0===a?O.ZT:a,c=t.label,u=t.disabled,s=(e=(0,S.useState)(!1),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=s[0],f=s[1],p=(0,F.l)({isOpen:d,isDropdown:!0}),h=p.triggerRef,y=p.triggerWidth,b=p.position,g=p.popoverRef,E=o.find((function(t){return t.value===n})),m={0:"unpublished",1:"published","-2":"trashed"};if(!(0,O.$K)(n)||(0,O.$K)(n)&&!(n in m))return null;var _=V[m[n]];return(0,v.BX)("div",{css:$.mainWrapper,children:[!!c&&(0,v.tZ)("div",{children:c}),(0,v.BX)("button",{type:"button",css:$.dropDownLabel({statusVariant:_,isOpen:d,isDisabled:u||!o.length}),onClick:function(){return f(!0)},ref:h,disabled:u,children:[(0,v.BX)("div",{children:[_.leftIcon,(0,v.tZ)("span",{children:(null==E?void 0:E.label)||""})]}),(0,v.tZ)(i.Z,{name:"chevronDown",width:12,height:8})]}),(0,v.tZ)(F.h,{isOpen:d,onClickOutside:function(){return f(!1)},children:(0,v.tZ)("div",{css:[$.optionsWrapper,{left:b.left,top:b.top,maxWidth:y},";label:StatusSelect;"],ref:g,children:(0,v.tZ)("ul",{css:$.options,children:o.map((function(t){return(0,v.tZ)("li",{css:$.optionItem({isSelected:n===t.value}),children:(0,v.tZ)(W.Z,{label:t.label,checked:n===t.value,onChange:function(){f(!1),l(t)},labelCss:$.radioLabel,disabled:t.disabled})},t.value)}))})})})]})};var X={name:"1f3qfry-dropDownLabel",styles:"pointer-events:none;label:dropDownLabel;"},K={name:"i3yy6i-dropDownLabel",styles:"transform:rotate(180deg);label:dropDownLabel;"},$={mainWrapper:{name:"e9i770-mainWrapper",styles:"width:100%;label:mainWrapper;"},dropDownLabel:function(t){var e=t.statusVariant,r=t.isOpen,n=void 0!==r&&r,o=t.isDisabled,i=void 0!==o&&o;return(0,y.iv)(q.iZ.resetButton," width:124px;display:flex;justify-content:space-between;align-items:center;border-radius:42px;height:24px;padding:0 ",p.W0[8]," 0 ",p.W0[6],";border:1px solid ",e.borderColor,";background-color:",e.backgroundColor,";position:relative;div{display:flex;gap:",p.W0[4],";align-items:center;span{color:",e.color,";}svg{height:16px;width:16px;color:",e.leftIconColor,";transform:none;}}& svg{width:12px;height:8px;color:",e.rightIconColor,";transition:transform 0.3s ease-in-out;",n&&K," ",i&&X,";}",i&&(0,y.iv)("background-color:",p.qo.background.disabled,";border:1px solid ",p.qo.stroke.disabled,";div{span{color:",p.qo.text.disabled,";}svg{color:",p.qo.icon.disabled,";}};label:dropDownLabel;"),";;label:dropDownLabel;")},optionsWrapper:{name:"1cmtbh-optionsWrapper",styles:"position:absolute;min-width:170px;width:100%;label:optionsWrapper;"},options:(0,y.iv)("z-index:",p.W5.dropdown,";background-color:",p.qo.base.white,";list-style-type:none;box-shadow:",p.AF.popover,";padding:",p.W0[4]," 0;margin:0;max-height:500px;overflow-y:auto;border-radius:",p.E0[6],";::-webkit-scrollbar{background-color:",p.qo.base.white,";width:10px;}::-webkit-scrollbar-thumb{background-color:",p.qo.base.secondary,";border-radius:",p.E0[6],";};label:options;"),optionItem:function(t){var e=t.isSelected;return(0,y.iv)(h.c.body(),";min-height:40px;transition:background-color 0.3s ease-in-out;:hover{background-color:",p.qo.background.hover,";}",e&&(0,y.iv)("background-color:",p.qo.background.active,";;label:optionItem;"),";;label:optionItem;")},radioLabel:(0,y.iv)("line-height:40px;padding-left:",p.W0[12],";;label:radioLabel;")},V={published:{backgroundColor:p.qo.background.success,borderColor:p.qo.stroke.success,color:p.qo.base.success,leftIconColor:p.qo.base.success,rightIconColor:p.qo.icon.success,leftIcon:(0,v.tZ)(i.Z,{name:"markCircle",width:16,height:16})},unpublished:{backgroundColor:p.qo.background.neutral,borderColor:p.qo.stroke.neutral,color:p.qo.text.neutral,leftIconColor:p.qo.icon.hints,rightIconColor:p.qo.icon.default,leftIcon:(0,v.tZ)(i.Z,{name:"circleCross",width:16,height:16})},trashed:{backgroundColor:p.qo.background.danger,borderColor:p.qo.stroke.danger,color:p.qo.text.error,leftIconColor:p.qo.icon.error,rightIconColor:p.qo.icon.error,leftIcon:(0,v.tZ)(i.Z,{name:"crossCircle",width:16,height:16})}},Q=r(935),z=r(802),J=r(6537),tt=r(6492),et=r(4469),rt=r(5501),nt=function(t){return rt.u.put(J.H.ADD_TO_MENU,t.data)},ot=r(7536);function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function lt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?at(Object(r),!0).forEach((function(e){ct(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ct(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==it(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===it(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ut(){ut=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),l=new P(o||[]);return n(a,"_invoke",{value:_(t,r,l)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function f(){}function p(){}function h(){}var y={};c(y,i,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(L([])));b&&b!==e&&r.call(b,i)&&(y=b);var g=h.prototype=f.prototype=Object.create(y);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){function o(n,i,a,l){var c=s(t[n],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==it(d)&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(d).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,l)}))}l(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=O(a,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,n(g,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:p,configurable:!0}),p.displayName=c(h,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,l,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},E(m.prototype),c(m.prototype,a,(function(){return this})),t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(g),c(g,l,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;w(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function st(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}const dt=function(t){var e,r=t.closeModal,o=t.title,i=t.id,l=(0,m.$)(),s=(0,z.O)({defaultValues:{page_id:i,menu_id:0,parent_id:1,menu_type:"mainmenu",title:"",alias:"",ordering:0}}),d=s.setValue,f=s.reset,p=s.getValues,h=s.watch,y=function(t){var e=(0,a.p)().showToast;return(0,tt.a)({queryKey:["MenuByPageId",t],queryFn:function(){return function(t){return rt.u.get(J.H.MENU_BY_PAGE_ID,{params:{id:t}})}(t).then((function(t){return t.data}))},onError:function(t){e({type:"danger",message:t.message})}})}(i),b=(e=(0,a.p)().showToast,(0,tt.a)({queryKey:["MenuList"],queryFn:function(){return rt.u.get(J.H.MENU_LIST).then((function(t){return t.data}))},onError:function(t){e({type:"danger",message:t.message})}})),g=function(t){var e=t.menutype,r=t.id,n=(0,a.p)().showToast;return(0,tt.a)({queryKey:["MenuParentItems",e,r],queryFn:function(){return function(t){var e=t.menutype,r=t.id;return rt.u.get(J.H.MENU_PARENT_ITEMS,{params:{menutype:e,id:r}})}({menutype:e,id:r}).then((function(t){return t.data}))},onError:function(t){n({type:"danger",message:t.message})}})}({menutype:h("menu_type"),id:p("menu_id")}),E=function(){var t=(0,a.p)().showToast,e=(0,m.$)();return(0,et.D)({mutationFn:nt,onSuccess:function(){t({type:"success",message:e("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_SUCCESS_MESSAGE")})},onError:function(e){t({type:"danger",message:e.message})}})}();return(0,S.useEffect)((function(){y.data&&f({menu_id:y.data.id,parent_id:y.data.parent_id,menu_type:y.data.menutype,title:y.data.title,alias:y.data.alias,ordering:y.data.id})}),[y.data,f]),y.isLoading||b.isLoading?(0,v.tZ)(Q.fz,{}):(0,v.tZ)(P.Z,{onClose:function(){return r({action:"CLOSE"})},title:o,wrapperCss:ft.wrapper,children:(0,v.BX)("form",{onSubmit:s.handleSubmit(function(){var t,e=(t=ut().mark((function t(e){return ut().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E.mutateAsync({id:i,data:e});case 2:t.sent.data&&r({action:"CONFIRM"});case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){st(i,n,o,a,l,"next",t)}function l(t){st(i,n,o,a,l,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),children:[(0,v.BX)("div",{css:ft.fieldWrapper,children:[(0,v.tZ)(ot.Qr,{name:"title",control:s.control,render:function(t){return(0,v.tZ)(u.Z,lt(lt({},t),{},{label:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_MENU_TITLE")}))}}),(0,v.tZ)(ot.Qr,{name:"alias",control:s.control,render:function(t){return(0,v.tZ)(u.Z,lt(lt({},t),{},{label:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_MENU_ALIAS")}))}}),(0,v.tZ)(ot.Qr,{name:"menu_type",control:s.control,render:function(t){var e;return(0,v.tZ)(c.Z,lt(lt({},t),{},{label:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_MENU"),options:null!==(e=b.data)&&void 0!==e?e:[],isClearable:!1,onChange:function(){d("parent_id",1)}}))}}),(0,v.tZ)(ot.Qr,{name:"parent_id",control:s.control,render:function(t){var e;return(0,v.tZ)(c.Z,lt(lt({},t),{},{label:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_MENU_PARENT"),options:null!==(e=g.data)&&void 0!==e?e:[],isClearable:!1}))}})]}),(0,v.BX)("div",{css:ft.buttonWrapper,children:[(0,v.tZ)(n.Z,{variant:"secondary",onClick:function(){return r({action:"CLOSE"})},children:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_CANCEL")}),(0,v.tZ)(n.Z,{type:"submit",loading:E.isLoading,children:l("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_SAVE_CHANGES")})]})]})})};var ft={wrapper:{name:"1vd4vqj-wrapper",styles:"max-width:500px;label:wrapper;"},fieldWrapper:(0,y.iv)("background-color:",p.qo.base.white,";padding:",p.W0[20],";display:flex;flex-direction:column;gap:",p.W0[12],";;label:fieldWrapper;"),buttonWrapper:(0,y.iv)("background-color:",p.qo.background.white,";box-shadow:",p.AF.dividerTop,";padding:",p.W0[12]," ",p.W0[16],";display:flex;justify-content:end;gap:",p.W0[8],";;label:buttonWrapper;")},pt=r(1974),ht=r(3106),yt=r(8138),vt=r(5587),bt=r(4285);function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Et=r(2811),mt=r(908),_t=r(9101),Ot=r(1073),St=r(7184),wt=r(7679),Pt=r(6680),Lt=r(9655);function It(t){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(t)}function At(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Tt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?At(Object(r),!0).forEach((function(e){Dt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):At(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Dt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==It(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==It(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===It(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ct(){Ct=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),l=new P(o||[]);return n(a,"_invoke",{value:_(t,r,l)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function f(){}function p(){}function h(){}var y={};c(y,i,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(L([])));b&&b!==e&&r.call(b,i)&&(y=b);var g=h.prototype=f.prototype=Object.create(y);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){function o(n,i,a,l){var c=s(t[n],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==It(d)&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(d).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,l)}))}l(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=O(a,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,n(g,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:p,configurable:!0}),p.displayName=c(h,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,l,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},E(m.prototype),c(m.prototype,a,(function(){return this})),t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(g),c(g,l,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;w(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function Rt(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function xt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Rt(i,n,o,a,l,"next",t)}function l(t){Rt(i,n,o,a,l,"throw",t)}a(void 0)}))}}function Gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Bt=function(t){var e,r,n,o=t.selectedItems,l=t.index,c=t.page,s=t.data,d=t.lastSelectedIndex,f=t.setLastSelectedIndex,y=t.setSelectedItems,b=t.columns,g=(0,m.$)(),E=function(){var t,e,r=(t=(0,S.useState)(!1),e=2,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],o=r[1],i=function(t){"shift"===t.key.toLowerCase()&&o(!0)},a=function(t){"shift"===t.key.toLowerCase()&&o(!1)};return(0,S.useEffect)((function(){return window.addEventListener("keydown",i),window.addEventListener("keyup",a),function(){window.removeEventListener("keydown",i),window.removeEventListener("keyup",a)}}),[]),n}(),P=(0,w.d)().showModal,L=(0,a.p)().showToast,I=(0,M.g)(),A=(r=(0,S.useState)(!1),n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return Gt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gt(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),T=A[0],D=A[1],C=(0,_.v)((function(t){return t.appConfig})),R=(0,wt.R4)(),x=(0,wt.es)(),G=(0,St.Xu)(),B=(0,Et.T)().closeSettingPanel,k=(0,Ot.j)((function(t){return t.setActiveAction})),Z=(0,j.L)(),N=(0,mt.Q)(),W=(0,z.O)({defaultValues:{title:c.title}}),F=(0,vt.nB)({id:c.id}),H=F.attributes,X=F.listeners,K=F.setNodeRef,$=F.transform,V=F.transition,Q=F.isDragging,J={transform:bt.ux.Transform.toString($),transition:V,zIndex:Q?p.W5.positive:p.W5.level,backgroundColor:Q?p.qo.background.hover:""};(0,S.useEffect)((function(){var t=function(t){"Escape"===t.key&&(D(!1),W.reset({title:c.title}))};return window.addEventListener("keydown",t),function(){window.removeEventListener("keydown",t)}}),[]);var tt=c.permissions.page.edit,et=N.edit_own&&c.created_by===C.user_id,rt=tt||et,nt=N.create&&rt,it=c.permissions.page.edit_state,at=c.permissions.page.delete,lt=[{id:"view",icon:"eye",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_VIEW"},{id:"rename",icon:"pencil",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_RENAME",isDisabled:!rt},{id:"duplicate",icon:"cloneLine",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_DUPLICATE",isDisabled:!nt},{id:"copyLink",icon:"link",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_COPY_LINK"},{id:"addToMenu",icon:"plus",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_ADD_TO_MENU",isDisabled:!rt},{id:"export",icon:"upload",title:"COM_SPPAGEBUILDER_EDITOR_PAGE_EXPORT",isDisabled:!rt},{id:"remove",icon:"trash",title:-2===c.published?"COM_SPPAGEBUILDER_EDITOR_PAGE_DELETE":"COM_SPPAGEBUILDER_EDITOR_PAGE_TRASH",variant:"critical",isDisabled:!at}],ct=[{label:g("COM_SPPAGEBUILDER_EDITOR_FILTER_PUBLISHED"),value:1,disabled:!it},{label:g("COM_SPPAGEBUILDER_EDITOR_FILTER_UNPUBLISHED"),value:0,disabled:!it},{label:g("COM_SPPAGEBUILDER_EDITOR_FILTER_TRASHED"),value:-2,disabled:!it||!at}],ut=function(){var t=xt(Ct().mark((function t(){var e,r,n;return Ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Z({title:g("COM_SPPAGEBUILDER_EDITOR_PAGE_EXPORT_TITLE")});case 2:e=t.sent,r=e.action,n=e.seoChecked,"CONFIRM"===r&&G.mutateAsync({pageId:String(c.id),isSeoChecked:n});case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return(0,v.BX)("tr",{css:Mt.bodyTr({isSelected:o.ids.includes(c.id),isShownFrontendButton:C.enable_frontend_editing&&rt}),ref:K,style:J,children:[(0,v.BX)("td",{css:Mt.checkboxWrapper,children:[(0,v.tZ)("div",Tt(Tt(Tt({css:Mt.dragPoint,"data-drag-point":!0},H),X),{},{children:(0,v.tZ)(i.Z,{name:"dragger",height:32,width:32})})),(0,v.tZ)(U.Z,{onChange:function(t){var e=(0,O.R5)({itemId:c.id,isShiftHolding:E,lastSelectedIndex:d,currentIndex:l,isChecked:t,selectedItemIds:o.ids,selectedItemsIndex:o.indexes,totalItemsList:s}),r=e.updatedItemIds,n=e.updatedItemIndexes;y({ids:r,indexes:n}),f(l)},checked:o.ids.includes(c.id)})]}),(0,v.tZ)("td",{children:(0,v.tZ)("div",{css:Mt.pageName,children:T?(0,v.tZ)("form",{onSubmit:W.handleSubmit((0,Pt.GI)(W,function(){var t=xt(Ct().mark((function t(e){var r;return Ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.title,t.next=3,R.mutateAsync({ids:c.id.toString(),type:"rename",value:r});case 3:D(!1);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),children:(0,v.tZ)(ot.Qr,{control:W.control,name:"title",render:function(t){return(0,v.tZ)(u.Z,Tt(Tt({},t),{},{hasAutoFocus:!0}))}})}):(0,v.BX)(v.HY,{children:[rt?(0,v.tZ)(Lt.rU,{css:Mt.titleButton({canEdit:rt}),to:yt.F.PageEditor.buildLink({id:c.id.toString(),type:""}),state:{prevPageName:ht.lr},onClick:function(){k(void 0),B()},children:c.title}):(0,v.tZ)("span",{css:Mt.titleButton({canEdit:rt}),children:c.title}),0!==c.checked_out&&(0,v.tZ)("button",{type:"button",css:Mt.lockButton,onClick:function(){R.mutate({type:"check-out",ids:c.id.toString()})},children:(0,v.tZ)(i.Z,{name:"lock",width:24,height:24})}),C.enable_frontend_editing&&rt&&(0,v.BX)("a",{"data-frontend-editor-button":!0,css:Mt.frontendEditorButton,href:c.url,target:"_blank",rel:"noopener noreferrer",children:[(0,v.tZ)(i.Z,{name:"parmaLink",width:16,height:16}),(0,v.tZ)("span",{children:g("COM_SPPAGEBUILDER_EDITOR_FRONTEND_EDITOR")})]})]})})}),b.includes("author")&&(0,v.tZ)("td",{css:Mt.widthStyles({width:200}),children:(0,v.tZ)("p",{children:c.author})}),b.includes("categories")&&(0,v.tZ)("td",{children:(0,v.tZ)("p",{children:c.category})}),b.includes("access")&&(0,v.tZ)("td",{css:Mt.access,children:(0,v.tZ)("p",{children:c.access_title})}),b.includes("id")&&(0,v.tZ)("td",{css:[h.c.body("medium"),q.iZ.textCenter,";label:PageListItem;"],children:(0,v.tZ)("p",{children:c.id})}),b.includes("hits")&&(0,v.tZ)("td",{css:[h.c.body("medium"),q.iZ.textCenter,";label:PageListItem;"],children:c.hits}),b.includes("language")&&(0,v.tZ)("td",{css:q.iZ.textCenter,children:(0,v.tZ)("p",{children:null!==(e=c.language_title)&&void 0!==e?e:g("COM_SPPAGEBUILDER_EDITOR_LANGUAGE_ALL")})}),(0,v.tZ)("td",{css:Mt.status,children:(0,v.tZ)(Y,{value:c.published,options:ct,onChange:function(t){R.mutate({type:{1:"published",0:"unpublished","-2":"trash"}[t.value],ids:c.id.toString()})},disabled:!it})}),(0,v.tZ)("td",{css:Mt.actionColumn,children:(0,v.tZ)(_t.Z,{actions:lt,triggerButtonContent:(0,v.tZ)(i.Z,{name:"ellipsisX",width:24,height:24,style:Mt.triggerIcon}),onSelect:function(){var t=xt(Ct().mark((function t(e){return Ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=e,t.next="remove"===t.t0?3:"addToMenu"===t.t0?12:"view"===t.t0?14:"copyLink"===t.t0?16:"duplicate"===t.t0?18:"export"===t.t0?20:"rename"===t.t0?22:25;break;case 3:if(-2===c.published){t.next=6;break}return R.mutate({type:"trash",ids:c.id.toString()}),t.abrupt("break",25);case 6:return t.next=8,I({title:g("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_TITLE"),confirmationMessage:g("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_MESSAGE_SINGLE_PAGE"),confirmButtonText:g("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_DELETE_BUTTON_TEXT_SINGLE_ITEM"),mutationFn:wt.hh,payload:{ids:c.id.toString(),type:"delete"},invalidateKeys:[["PageList"]]});case 8:return"CONFIRM"===t.sent.action&&L({type:"success",message:g("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_PERFORMED_SUCCESSFULLY")}),t.abrupt("break",25);case 12:return P({component:dt,props:{title:g("COM_SPPAGEBUILDER_EDITOR_ADD_TO_MENU_MODAL_TITLE"),id:c.id}}),t.abrupt("break",25);case 14:return window.open(c.preview,"_blank","noopener=true,noreferrer=true"),t.abrupt("break",25);case 16:return r="".concat(pt.Z.APPLICATION_ROOT,"index.php?option=com_sppagebuilder&view=page&id=").concat(c.id),n=void 0,(n=document.createElement("textarea")).value=r,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),L({type:"success",message:g("COM_SPPAGEBUILDER_EDITOR_PAGE_COPY_LINK_MESSAGE")}),t.abrupt("break",25);case 18:return x.mutate({id:c.id}),t.abrupt("break",25);case 20:return ut(),t.abrupt("break",25);case 22:return W.setValue("title",c.title),D(!0),t.abrupt("break",25);case 25:case"end":return t.stop()}var r,n}),t)})));return function(e){return t.apply(this,arguments)}}()})})]},c.id)};var jt={name:"1qe2gq2-bodyTr",styles:"[data-frontend-editor-button]{display:flex;};label:bodyTr;"},Mt={bodyTr:function(t){var e=t.isSelected,r=t.isShownFrontendButton;return(0,y.iv)("height:80px;border-bottom:1px solid ",p.qo.stroke.neutral,";position:relative;&:hover{background-color:",p.qo.background.hover,";",r&&jt," [data-drag-point]{opacity:1;}}",e&&(0,y.iv)("background-color:",p.qo.background.disabled,";;label:bodyTr;"),";;label:bodyTr;")},lockButton:(0,y.iv)(q.iZ.resetButton,";svg{color:",p.qo.icon.default,";};label:lockButton;"),titleButton:function(t){var e=t.canEdit;return(0,y.iv)(h.c.heading6(),";padding-inline:0;",e&&(0,y.iv)(":hover{color:",p.qo.text.primary,";};label:titleButton;")," ",!e&&(0,y.iv)("cursor:not-allowed;color:",p.qo.text.disabled,";;label:titleButton;"),";;label:titleButton;")},widthStyles:function(t){var e=t.width;return(0,y.iv)("width:",e,"px;;label:widthStyles;")},pageName:(0,y.iv)("position:relative;display:flex;gap:",p.W0[12],";align-items:center;max-width:400px;width:100%;;label:pageName;"),frontendEditorButton:(0,y.iv)(h.c.body(),";background-color:",p.qo.base.white,";border-radius:",p.E0[24],";padding:",p.W0[4]," ",p.W0[12]," ",p.W0[4]," ",p.W0[4],";width:fit-content;align-items:center;gap:",p.W0[8],";color:",p.qo.text.neutral,";display:none;position:absolute;left:100%;white-space:nowrap;svg{fill:none;}&:hover{color:",p.qo.text.hover,";}&::before,&::after{content:''!important;all:unset!important;};label:frontendEditorButton;"),checkboxWrapper:{name:"l0wqz3-checkboxWrapper",styles:"position:relative;label:checkboxWrapper;"},dragPoint:(0,y.iv)("position:absolute;top:0;left:0;height:100%;width:32px;display:flex;align-items:center;opacity:0;cursor:grab;svg{color:",p.qo.icon.default,";};label:dragPoint;"),access:{name:"sx074l-access",styles:"text-align:center;label:access;"},status:{name:"1n9i8ph-status",styles:"display:grid;place-content:center;height:inherit;label:status;"},triggerIcon:(0,y.iv)("color:",p.qo.icon.hints,";;label:triggerIcon;"),actionColumn:{name:"1m7ix2e-actionColumn",styles:"text-align:right;label:actionColumn;"}};const kt=function(t){var e=t.data,r=t.selectedItems,n=t.setSelectedItems,o=t.lastSelectedIndex,i=t.setLastSelectedIndex,a=t.isLoading,l=void 0!==a&&a,c=t.columns,u=(0,m.$)(),s=e.length,d=r.ids.length,f=c.length+3;return(0,v.tZ)("div",{css:Zt.tableContainer,children:(0,v.BX)("table",{css:Zt.table({selectedColumns:c.length}),children:[(0,v.tZ)("thead",{children:(0,v.BX)("tr",{css:Zt.headRow,children:[(0,v.tZ)("th",{css:Zt.widthStyles({width:70}),children:(0,v.tZ)(U.Z,{checked:d>0&&d===s,isIndeterminate:d>0&&d<s,onChange:function(){var t=d===s?[]:(0,O.x9)(e),r=d===s?[]:(0,O.w6)(s);n({ids:t,indexes:r}),i(-1)}})}),(0,v.tZ)("th",{css:Zt.widthStyles({width:250}),children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_PAGE_NAME")}),c.includes("author")&&(0,v.tZ)("th",{css:Zt.widthStyles({width:180}),children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_AUTHOR")}),c.includes("categories")&&(0,v.tZ)("th",{children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_CATEGORIES")}),c.includes("access")&&(0,v.tZ)("th",{css:Zt.textCenter,children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_ACCESS")}),c.includes("id")&&(0,v.tZ)("th",{css:Zt.textCenter,children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_ID")}),c.includes("hits")&&(0,v.tZ)("th",{css:Zt.textCenter,children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_HITS")}),c.includes("language")&&(0,v.tZ)("th",{css:Zt.textCenter,children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_LANGUAGE")}),(0,v.tZ)("th",{css:[Zt.widthStyles({width:160}),Zt.textCenter,";label:PageListTable;"],children:u("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_STATUS")}),(0,v.tZ)("th",{css:Zt.widthStyles({width:100})})]})}),(0,v.tZ)("tbody",{children:l?Array(10).fill(0).map((function(t,e){return(0,v.tZ)("tr",{css:Zt.skeletonWrapper,children:Array(f).fill(0).map((function(t,e){return(0,v.tZ)("td",{css:Zt.widthStyles({width:0===e?70:(0,O.sZ)(100,250)}),children:(0,v.tZ)(Z.Z,{animation:!0,height:20,width:"".concat(0===e?100:(0,O.sZ)(90,100),"%")})},e)}))},e)})):e.map((function(t,a){return(0,v.tZ)(Bt,{index:a,data:e,page:t,lastSelectedIndex:o,setLastSelectedIndex:function(t){return i(t)},selectedItems:r,setSelectedItems:function(t){n(t)},columns:c},t.id)}))})]})})};var Ut={name:"vq4tj-table",styles:"tr:hover{td{:nth-of-type(3)>*{display:none;}}};label:table;"},Zt={tableContainer:{name:"1c7p8s-tableContainer",styles:"display:block;width:100%;overflow-x:auto;label:tableContainer;"},table:function(t){var e=t.selectedColumns;return(0,y.iv)("width:100%;th{background-color:",(0,N.m4)(p.qo.base.primary,.15),";color:",p.qo.text.default,";height:49px;}th,td{",h.c.body(),";padding:",p.W0[16],";:first-of-type{padding-left:",p.W0[32],";}:last-of-type{padding-right:",p.W0[24],";}}",e>0&&Ut,";;label:table;")},headRow:(0,y.iv)("th{",h.c.body(),";};label:headRow;"),paginatorWrapper:(0,y.iv)("margin-top:",p.W0[32],";;label:paginatorWrapper;"),widthStyles:function(t){var e=t.width;return(0,y.iv)("width:",e,"px;;label:widthStyles;")},textCenter:{name:"lfnssf-textCenter",styles:"text-align:center;label:textCenter;"},skeletonWrapper:(0,y.iv)("border-bottom:1px solid ",p.qo.stroke.neutral,";height:80px;;label:skeletonWrapper;")},Nt=r(9752),Wt=r(36),Ft=r(4420);function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function Ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Yt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ht(Object(r),!0).forEach((function(e){Xt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Xt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==qt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===qt(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Kt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return $t(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$t(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Vt=(0,Ft.createEnumParam)(["asc","desc"]),Qt=r(2200),zt=r(8698),Jt=r(3425),te=r(6511);function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}function re(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ne(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?re(Object(r),!0).forEach((function(e){oe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function oe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==ee(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===ee(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const ie=function(t){var e=t.values,r=t.onChange,i=t.wrapperCss,a=t.clearButtonStatus,l=t.onClearFilter,c=(0,m.$)(),u=(0,_.v)((function(t){return t.appConfig})),s=e.status,d=e.access,f=e.category,p=e.language,h=[{label:c("COM_SPPAGEBUILDER_EDITOR_FILTER_PUBLISHED"),value:1},{label:c("COM_SPPAGEBUILDER_EDITOR_FILTER_UNPUBLISHED"),value:0},{label:c("COM_SPPAGEBUILDER_EDITOR_FILTER_TRASHED"),value:-2}];return(0,v.BX)("div",{css:[ae.wrapper,i,";label:FilterSelectGroup;"],children:[(0,v.tZ)(o.Z,{placeholder:c("COM_SPPAGEBUILDER_EDITOR_FILTER_PLACEHOLDER_STATUS"),wrapperStyle:ae.itemCss,value:h.find((function(t){return t.value===s})),options:h,clearOption:function(){r(ne(ne({},e),{},{status:null}))},onChange:function(t){r(ne(ne({},e),{},{status:t.value}))}}),(0,v.tZ)(o.Z,{placeholder:c("COM_SPPAGEBUILDER_EDITOR_FILTER_PLACEHOLDER_ACCESS"),wrapperStyle:ae.itemCss,value:u.access_levels.find((function(t){return t.value===d})),options:u.access_levels,clearOption:function(){r(ne(ne({},e),{},{access:null}))},onChange:function(t){r(ne(ne({},e),{},{access:t.value}))}}),(0,v.tZ)(o.Z,{placeholder:c("COM_SPPAGEBUILDER_EDITOR_FILTER_PLACEHOLDER_CATEGORY"),wrapperStyle:ae.itemCss,value:f?u.categories.find((function(t){return t.value===Number(f)})):void 0,options:u.categories,clearOption:function(){r(ne(ne({},e),{},{category:null}))},onChange:function(t){r(ne(ne({},e),{},{category:t.value}))}}),(0,v.tZ)(o.Z,{placeholder:c("COM_SPPAGEBUILDER_EDITOR_FILTER_PLACEHOLDER_LANGUAGE"),wrapperStyle:ae.itemCss,value:u.languages.find((function(t){return t.value===p})),options:u.languages,clearOption:function(){r(ne(ne({},e),{},{language:null}))},onChange:function(t){r(ne(ne({},e),{},{language:t.value}))}}),(0,v.tZ)(n.Z,{variant:"secondary",disabled:!a,buttonCss:ae.itemCss,onClick:function(){r({status:null,access:null,category:null,language:null}),l()},children:c("COM_SPPAGEBUILDER_EDITOR_CLEAR")})]})};var ae={wrapper:(0,y.iv)("display:flex;border:1px solid ",p.qo.stroke.neutral,";border-radius:",p.E0[5],";overflow:hidden;box-shadow:",p.AF.input,";input,button{border:none;border-radius:0;box-shadow:none;}input{border-right:1px solid ",p.qo.stroke.neutral,";:focus{box-shadow:none;}}button:last-of-type{display:flex;justify-content:center;align-items:center;};label:wrapper;"),itemCss:{name:"1qky7zh-itemCss",styles:"min-width:108px;label:itemCss;"}};function le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const ce=function(t){var e,r,n=t.currentPage,o=t.onPageChange,a=t.totalItems,l=t.itemsPerPage,c=(0,m.$)(),u=(e=(0,S.useState)(""),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,r)||function(t,e){if(t){if("string"==typeof t)return le(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?le(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],d=u[1],f=Math.max(Math.ceil(a/l),1);(0,S.useEffect)((function(){d(n.toString())}),[n]);var p=function(t){t<1||t>f||o(t)};return(0,v.BX)("div",{css:ue.wrapper,children:[(0,v.BX)("div",{css:ue.pageStatus,children:[c("COM_SPPAGEBUILDER_EDITOR_PAGINATION_PAGE"),(0,v.tZ)("span",{children:(0,v.tZ)("input",{type:"text",css:ue.paginationInput,value:s,onChange:function(t){var e=t.currentTarget.value.replace(/[^0-9]/g,""),r=Number(e);r>0&&r<=f?(d(e),o(r)):e||d(e)},autoComplete:"off"})}),c("COM_SPPAGEBUILDER_EDITOR_PAGINATION_PAGE_OF")," ",(0,v.tZ)("span",{children:f})]}),(0,v.BX)("div",{css:ue.pageController,children:[(0,v.tZ)("button",{type:"button",css:ue.paginationButton,onClick:function(){return p(n-1)},disabled:1===n,children:(0,v.tZ)(i.Z,{name:"chevronLeft",width:24,height:24})}),(0,v.tZ)("button",{type:"button",css:ue.paginationButton,onClick:function(){return p(n+1)},disabled:n===f,children:(0,v.tZ)(i.Z,{name:"chevronRight",width:24,height:24})})]})]})};var ue={wrapper:(0,y.iv)("display:flex;justify-content:end;align-items:center;flex-wrap:wrap;gap:",p.W0[8],";height:36px;;label:wrapper;"),pageStatus:(0,y.iv)(h.c.body()," color:",p.qo.text.neutral,";min-width:100px;;label:pageStatus;"),paginationInput:(0,y.iv)("outline:0;border:1px solid ",p.qo.stroke.neutral,";border-radius:",p.E0[5],";margin:0 ",p.W0[8],";color:",p.qo.text.neutral,";padding:",p.W0[8]," ",p.W0[12],";width:72px;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:",p.W0[0],";};label:paginationInput;"),pageController:(0,y.iv)("gap:",p.W0[8],";display:flex;justify-content:center;align-items:center;height:100%;;label:pageController;"),paginationButton:(0,y.iv)(q.iZ.resetButton,";background-color:",p.qo.background.white,";color:",p.qo.icon.default,";border-radius:",p.E0[6],";height:32px;width:32px;display:grid;place-items:center;transition:background-color 0.2s ease-in-out,color 0.3s ease-in-out;&:hover{background-color:",p.qo.base.primary,";&>svg{color:",p.qo.base.white,";}}&:disabled{background-color:",p.qo.background.disabled,";&>svg{color:",p.qo.icon.disabled,";}};label:paginationButton;")};const se=r.p+"images/ed8841a7709fb2582a09.svg";var de=r(4693);function fe(t){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fe(t)}function pe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function he(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==fe(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===fe(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ye=function(t){var e=t.draggingNodeRect,r=t.transform,n=t.scrollableAncestorRects[0];return e&&n?ve(r,e,n):r},ve=function(t,e,r){var n=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?pe(Object(r),!0).forEach((function(e){he(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},t);return e.top+t.y<=r.top?n.y=r.top-e.top:e.bottom+t.y>=r.top+r.height&&(n.y=r.top+r.height-e.bottom),e.left+t.x<=r.left?n.x=r.left-e.left:e.right+t.x>=r.left+r.width&&(n.x=r.left+r.width-e.right),n},be=r(7273),ge=r(6216);function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function me(){me=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),l=new P(o||[]);return n(a,"_invoke",{value:_(t,r,l)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function f(){}function p(){}function h(){}var y={};c(y,i,(function(){return this}));var v=Object.getPrototypeOf,b=v&&v(v(L([])));b&&b!==e&&r.call(b,i)&&(y=b);var g=h.prototype=f.prototype=Object.create(y);function E(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function m(t,e){function o(n,i,a,l){var c=s(t[n],t,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==Ee(d)&&r.call(d,"__await")?e.resolve(d.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(d).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,l)}))}l(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function _(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=O(a,r);if(l){if(l===d)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=h,n(g,"constructor",{value:h,configurable:!0}),n(h,"constructor",{value:p,configurable:!0}),p.displayName=c(h,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,l,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},E(m.prototype),c(m.prototype,a,(function(){return this})),t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(g),c(g,l,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),w(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;w(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function _e(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function Oe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){_e(i,n,o,a,l,"next",t)}function l(t){_e(i,n,o,a,l,"throw",t)}a(void 0)}))}}function Se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function we(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(r),!0).forEach((function(e){Pe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Pe(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==Ee(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Ee(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Le(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ie(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Ae=function(){var t,e=Le((0,S.useState)([]),2),r=e[0],p=e[1],h=Le((0,S.useState)(),2),y=h[0],b=h[1],g=Le((0,S.useState)((function(){return Number((0,ge.fp)(ht.dR.ITEMS_PER_PAGE_LOCAL_STORAGE_KEY))})),2),E=g[0],_=g[1],P=Le((0,S.useState)((function(){return(0,ge.fp)(ht.dR.TABLE_COLUMNS_LOCAL_STORAGE_KEY)})),2),L=P[0],I=P[1],A=(0,mt.Q)(),T=(0,S.useRef)(null),D=(0,St.nl)(),C=(0,m.$)(),R=(0,w.d)().showModal,x=(0,M.g)(),B=(0,a.p)().showToast,U=function(){var t=(0,w.d)().showModal;return function(e){return t({component:G,props:e,closeOnOutsideClick:!0})}}(),Z=(0,j.L)(),N=Le((0,S.useState)(-1),2),W=N[0],F=N[1],q=Le((0,S.useState)({ids:[],indexes:[]}),2),H=q[0],Y=q[1],X=A.edit_state,K=A.delete,$=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.limit,r=void 0===e?ht.Hy:e,n=t.updateQueryParams,o=void 0!==n&&n,i=Kt((0,Ft.useQueryParams)({page:(0,Ft.withDefault)(Ft.NumberParam,1),sortProperty:(0,Ft.withDefault)(Ft.StringParam,""),sortDirection:(0,Ft.withDefault)(Vt,void 0),filter:(0,Ft.withDefault)(Ft.JsonParam,{})}),2),a=i[0],l=i[1],c=Kt((0,S.useState)({page:1,sortProperty:"",sortDirection:void 0,filter:{}}),2),u=c[0],s=c[1],d=o?u:a,f=(r=a.filter.limit?Number(a.filter.limit):r)*Math.max(0,d.page-1),p=(0,S.useCallback)((function(t){o?s((function(e){return Yt(Yt({},e),t)})):l(Yt({},t))}),[l,s,o]),h=(0,S.useCallback)((function(t){return p({filter:t})}),[p]);return{pageInfo:d,onPageChange:function(t){return p({page:t})},onColumnSort:function(t){var e;e=t!==d.sortProperty?{sortDirection:"asc",sortProperty:t}:{sortDirection:"asc"===d.sortDirection?"desc":"asc",sortProperty:t},p(e)},offset:f,itemsPerPage:r,onFilterItems:h}}(),V=$.pageInfo,Q=$.onPageChange,J=$.onFilterItems,tt=$.offset,et=(0,wt.R4)(),rt=(0,wt.r7)(),nt=Number(V.filter.limit)||ht.Hy,it=(0,wt.u6)({offset:tt,limit:nt,filter:V.filter}),at=(0,z.O)({defaultValues:{search:V.filter.search||"",sortBy:V.filter.sortBy||"title",limit:Number(E)||ht.Hy,status:Number(V.filter.status)||null,access:Number(V.filter.access)||null,category:Number(V.filter.category)||null,language:V.filter.language||""}}),lt=(0,z.O)({defaultValues:{columns:["author","categories","access","id","hits","language"]}}),ct=(0,Wt.N)(at.watch("search","")),ut=at.watch("limit"),st=at.watch("sortBy"),dt=at.watch("status"),ft=at.watch("access"),pt=at.watch("category"),yt=at.watch("language"),bt=!!(ct||(0,be.BB)(dt)||ft||pt||yt),gt=(0,Qt.D)(ct);(0,S.useEffect)((function(){if((0,O.$K)(L))try{var t=JSON.parse(L);lt.setValue("columns",t)}catch(t){console.error(t)}}),[]),(0,S.useEffect)((function(){J(we(we(we(we(we(we(we({},ct.length>0&&{search:ct}),(0,O.$K)(dt)&&{status:dt.toString()}),ft&&{status:ft.toString()}),(0,O.$K)(pt)&&{category:pt.toString()}),yt&&{language:yt}),ut&&{limit:String(ut)}),st&&{sortBy:st})),ct!==gt&&Q(1)}),[J,ct,ut,st,dt,ft,pt,yt,gt,Q]);var Et=!!ct||(0,O.$K)(dt)||(0,O.$K)(ft)||(0,O.$K)(pt)||!!yt,_t=(0,Nt.Dy)((0,Nt.VT)(Nt.we),(0,Nt.VT)(Nt.Lg,{coordinateGetter:vt.is})),Ot=[{label:C("COM_SPPAGEBUILDER_EDITOR_FILTER_PUBLISH"),value:"published",disabled:!X},{label:C("COM_SPPAGEBUILDER_EDITOR_FILTER_UNPUBLISH"),value:"unpublished",disabled:!X},{label:C("COM_SPPAGEBUILDER_EDITOR_ACTION_CHECKOUT"),value:"check-out",disabled:!X},{label:C(-2===dt?"COM_SPPAGEBUILDER_EDITOR_FILTER_DELETE":"COM_SPPAGEBUILDER_EDITOR_FILTER_TRASH"),value:-2===dt?"delete":"trash",disabled:!K||!X},{label:C("COM_SPPAGEBUILDER_EDITOR_FILTER_LANGUAGE"),value:"language",disabled:!X},{label:C("COM_SPPAGEBUILDER_EDITOR_FILTER_ACCESS"),value:"access",disabled:!X},{label:C("COM_SPPAGEBUILDER_EDITOR_FILTER_CATEGORY"),value:"category",disabled:!X},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_EXPORT"),value:"export",disabled:!X}],Pt={language:C("COM_SPPAGEBUILDER_EDITOR_FILTER_LANGUAGE_CHANGE"),access:C("COM_SPPAGEBUILDER_EDITOR_FILTER_ACCESS_CHANGE"),category:C("COM_SPPAGEBUILDER_EDITOR_FILTER_CATEGORY_CHANGE")},Lt={language:C("COM_SPPAGEBUILDER_EDITOR_FILTER_LANGUAGE"),access:C("COM_SPPAGEBUILDER_EDITOR_FILTER_ACCESS"),category:C("COM_SPPAGEBUILDER_EDITOR_FILTER_CATEGORY")},It=[{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_TITLE_ASC"),value:"title"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_TITLE_DESC"),value:"-title"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_ORDERING_ASC"),value:"ordering"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_ORDERING_DESC"),value:"-ordering"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_DATE_ASC"),value:"created_on"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_DATE_DESC"),value:"-created_on"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_STATUS_ASC"),value:"published"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_STATUS_DESC"),value:"-published"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_HITS_ASC"),value:"hits"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_HITS_DESC"),value:"-hits"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_ID_ASC"),value:"id"},{label:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_SORT_BY_ID_DESC"),value:"-id"}],At=[{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_AUTHOR"),value:"author"},{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_CATEGORIES"),value:"categories"},{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_ACCESS"),value:"access"},{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_ID"),value:"id"},{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_HITS"),value:"hits"},{label:C("COM_SPPAGEBUILDER_EDITOR_COLUMN_LIST_LANGUAGE"),value:"language"}],Tt=[{label:"5",value:5},{label:"10",value:10},{label:"15",value:15},{label:"20",value:20},{label:"25",value:25},{label:"30",value:30},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200},{label:"500",value:500}];(0,S.useEffect)((function(){it.data&&p(it.data.results)}),[it.data]);var Dt=lt.watch("columns",[]);return(0,S.useEffect)((function(){(0,ge.pj)(ht.dR.TABLE_COLUMNS_LOCAL_STORAGE_KEY,JSON.stringify(Dt)),(0,ge.pj)(ht.dR.ITEMS_PER_PAGE_LOCAL_STORAGE_KEY,JSON.stringify(ut)),_(Number(JSON.stringify(ut))),I(JSON.stringify(Dt))}),[Dt,ut]),(0,v.BX)(d.Z,{children:[(0,v.tZ)(f.Z,{title:C("COM_SPPAGEBUILDER_EDITOR_PAGE_TITLE_PAGES"),subtitle:C("COM_SPPAGEBUILDER_EDITOR_PAGE_SUBTITLE_PAGES"),action:A.create&&(0,v.BX)(v.HY,{children:[(0,v.tZ)(n.Z,{variant:"secondary",buttonCss:Te.importButtonCss,onClick:function(){var t;return null===(t=T.current)||void 0===t?void 0:t.click()},children:C("COM_SPPAGEBUILDER_EDITOR_PAGE_BULK_IMPORT")}),(0,v.tZ)(n.Z,{icon:(0,v.tZ)(i.Z,{name:"plus"}),onClick:function(){R({component:k.Z,props:{title:C("COM_SPPAGEBUILDER_EDITOR_CREATE_PAGE_MODAL_TITLE")}})},children:C("COM_SPPAGEBUILDER_EDITOR_ADD_NEW_PAGE_BUTTON")})]})}),(0,v.tZ)("input",{ref:T,type:"file",hidden:!0,onChange:function(){var t=Oe(me().mark((function t(e){var r,n;return me().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null===(r=e.target.files)||void 0===r?void 0:r[0]){t.next=3;break}return t.abrupt("return");case 3:D.mutate(n),e.target.value="";case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),(0,v.tZ)(s.Z,{children:(0,v.BX)(te.Z,{query:it,disableLoader:!0,children:[(0,v.BX)("div",{css:Te.topPanel,children:[(0,v.BX)("div",{css:Te.topPanelLeft,children:[(0,v.tZ)(o.Z,{options:Ot,placeholder:C("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_DROPDOWN_PLACEHOLDER"),wrapperStyle:Te.topPanelLeftSelect,isClearable:!1,disabled:0===H.ids.length||!X,value:Ot.find((function(t){return t.value===y})),onChange:function(t){b(t.value)}}),(0,v.tZ)(n.Z,{onClick:Oe(me().mark((function t(){var e,r,n,o;return me().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(H.ids.length&&y){t.next=2;break}return t.abrupt("return");case 2:if("export"!==y){t.next=11;break}return t.next=5,Z({title:C("COM_SPPAGEBUILDER_EDITOR_PAGE_EXPORT_TITLE"),confirmationMessage:C("COM_SPPAGEBUILDER_EDITOR_EXPORT_PAGES_MESSAGE")});case 5:e=t.sent,r=e.action,n=e.seoChecked,"CONFIRM"===r&&(0,St.PS)(H.ids.join(","),n),t.next=29;break;case 11:if("language"!==y&&"access"!==y&&"category"!==y){t.next=19;break}return t.next=14,U({title:Pt[y],label:Lt[y],bulkAction:y,mutationFn:wt.hh,payload:{ids:H.ids.join(","),type:y},invalidateKeys:[["PageList"]]});case 14:"CONFIRM"===t.sent.action&&B({type:"success",message:C("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_PERFORMED_SUCCESSFULLY")}),t.next=29;break;case 19:if("delete"===y){t.next=23;break}et.mutate({ids:H.ids.join(","),type:y}),t.next=29;break;case 23:return o=H.ids.length,t.next=26,x({title:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_TITLE"),confirmationMessage:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_MESSAGE_MULTIPLE_PAGES",{totalPages:o.toString().padStart(2,"0")}),confirmButtonText:C("COM_SPPAGEBUILDER_EDITOR_PAGE_LIST_DELETE_MODAL_DELETE_BUTTON_TEXT",{totalPages:o.toString().padStart(2,"0")}),mutationFn:wt.hh,payload:{ids:H.ids.join(","),type:y},invalidateKeys:[["PageList"]]});case 26:"CONFIRM"===t.sent.action&&B({type:"success",message:C("COM_SPPAGEBUILDER_EDITOR_BULK_ACTION_PERFORMED_SUCCESSFULLY")});case 29:b(null),Y({ids:[],indexes:[]}),F(-1);case 32:case"end":return t.stop()}}),t)}))),disabled:!y,children:C("COM_SPPAGEBUILDER_EDITOR_APPLY")})]}),(0,v.tZ)("div",{css:Te.topPanelRight,children:(0,v.tZ)(ie,{clearButtonStatus:Et,onClearFilter:function(){return at.reset({search:"",status:null,access:null,category:null,language:""})},values:{status:dt,access:ft,category:pt,language:yt},onChange:function(t){at.reset(we(we({},at.getValues()),{},{status:t.status,access:t.access,category:Number(t.category),language:t.language||""}))}})})]}),(0,v.BX)(zt.Z,{cardCss:Te.cardStyle,children:[(0,v.BX)("div",{css:Te.tableHeaderWrapper,children:[(0,v.tZ)("div",{css:Te.searchFieldWrapper,children:(0,v.tZ)(ot.Qr,{control:at.control,name:"search",render:function(t){return(0,v.tZ)(u.Z,we(we({},t),{},{variant:"search",placeholder:C("COM_SPPAGEBUILDER_EDITOR_SEARCH_INPUT_PLACEHOLDER"),isClearable:!0}))}})}),(0,v.BX)("div",{css:Te.sortByFieldWrapper,children:[(0,v.tZ)(ot.Qr,{control:at.control,name:"limit",render:function(t){return(0,v.tZ)(c.Z,we(we({},t),{},{options:Tt,isClearable:!1,removeOptionsMinWidth:!0}))}}),(0,v.tZ)(ot.Qr,{control:lt.control,name:"columns",render:function(t){return(0,v.tZ)(l.Z,we(we({},t),{},{options:At,placeholder:C("COM_SPPAGEBUILDER_EDITOR_PAGE_TABLE_COLUMNS"),disabled:it.isSuccess&&!it.data.results.length,showChips:!1,hideSelectNumbers:!0}))}}),(0,v.tZ)(ot.Qr,{control:at.control,name:"sortBy",render:function(t){return(0,v.tZ)(c.Z,we(we({},t),{},{options:It,placeholder:C("COM_SPPAGEBUILDER_EDITOR_PAGE_SORT_TABLE_BY_PLACEHOLDER"),showArrowUpDown:!0,disabled:it.isSuccess&&!it.data.results.length}))}})]})]}),it.isSuccess&&!it.data.results.length?bt?(0,v.tZ)(Jt.Z,{orientation:"vertical",emptyStateImage:de,imageAltText:C("COM_SPPAGEBUILDER_EDITOR_ADDONS_NO_MATCH_FOUND"),title:C("COM_SPPAGEBUILDER_EDITOR_ADDONS_NO_MATCH_FOUND"),removeBorderRadius:!0,wrapperCss:Te.wrapperCss}):(0,v.tZ)(Jt.Z,{orientation:"vertical",emptyStateImage:se,imageAltText:C("COM_SPPAGEBUILDER_EDITOR_EMPTY_PAGE_LIST_IMAGE_ALT"),title:C("COM_SPPAGEBUILDER_EDITOR_EMPTY_PAGE_LIST_TITLE"),content:C("COM_SPPAGEBUILDER_EDITOR_EMPTY_PAGE_LIST_CONTENT"),removeBorderRadius:!0,action:(0,v.tZ)(n.Z,{icon:(0,v.tZ)(i.Z,{name:"plus"}),onClick:function(){R({component:k.Z,props:{title:C("COM_SPPAGEBUILDER_EDITOR_CREATE_PAGE_MODAL_TITLE")}})},children:C("COM_SPPAGEBUILDER_EDITOR_EMPTY_PAGE_LIST_ADD_NEW_BUTTON")})}):(0,v.tZ)(Nt.LB,{sensors:_t,collisionDetection:Nt.pE,onDragEnd:function(t){var e=t.active,n=t.over;null!=n&&n.id&&e.id!==n.id&&p((function(t){var o=t.findIndex((function(t){return t.id===e.id})),i=t.findIndex((function(t){return t.id===n.id})),a=(0,vt.Rp)(r,o,i),l=(0,O.x9)(a),c=Array.from({length:l.length},(function(t,e){return e+1}));return rt.mutate({ids:l,orders:c}),at.reset(we(we({},at.getValues()),{},{sortBy:"ordering"})),a}))},modifiers:[ye],children:(0,v.tZ)(vt.Fo,{items:r,strategy:vt.qw,children:(0,v.tZ)(kt,{data:r,isLoading:it.isLoading,selectedItems:H,setSelectedItems:Y,lastSelectedIndex:W,setLastSelectedIndex:F,columns:Dt})})})]}),(0,v.tZ)("div",{css:Te.paginatorWrapper,children:(0,v.tZ)(ce,{currentPage:V.page,onPageChange:Q,totalItems:(null===(t=it.data)||void 0===t?void 0:t.totalItems)||0,itemsPerPage:Number(V.filter.limit)||ht.Hy})})]})})]})};var Te={topPanel:(0,y.iv)("display:flex;justify-content:space-between;align-items:center;gap:",p.W0[8],";margin:",p.W0[16]," 0 ",p.W0[32]," 0;;label:topPanel;"),topPanelLeft:(0,y.iv)("display:flex;justify-content:center;align-items:center;gap:",p.W0[16],";;label:topPanelLeft;"),topPanelLeftSelect:{name:"1ex2zjt-topPanelLeftSelect",styles:"max-width:128px;label:topPanelLeftSelect;"},topPanelRight:{name:"qflu8b-topPanelRight",styles:"width:680px;height:32px;label:topPanelRight;"},pageName:(0,y.iv)(h.c.heading6(),";color:",p.qo.text.default,";;label:pageName;"),cardStyle:(0,y.iv)("border-radius:",p.E0[5],";box-shadow:",p.AF.base,";overflow:hidden;;label:cardStyle;"),tableHeaderWrapper:(0,y.iv)("width:100%;display:flex;justify-content:space-between;align-items:center;gap:",p.W0[8],";padding:",p.W0[24],";;label:tableHeaderWrapper;"),searchFieldWrapper:{name:"tjtfnx-searchFieldWrapper",styles:"width:min(280px, 100%);label:searchFieldWrapper;"},sortByFieldWrapper:(0,y.iv)("width:min(500px, 100%);display:flex;gap:",p.W0[16],";>div:first-of-type{max-width:80px;};label:sortByFieldWrapper;"),tableRowStyle:{name:"1l9y7ek-tableRowStyle",styles:":last-of-type{border-bottom:none;};label:tableRowStyle;"},paginatorWrapper:(0,y.iv)("margin-top:",p.W0[32],";;label:paginatorWrapper;"),wrapperCss:{name:"1kd73z9-wrapperCss",styles:">img{max-width:180px;max-height:180px;};label:wrapperCss;"},importButtonCss:(0,y.iv)("margin-right:",p.W0[10],";;label:importButtonCss;")}}}]);