PageSourceSearch

https://cmscritic.com/_next/static/chunks/pages/admin/categories-a65e8a816a4b0ede.js

js cmscritic.com collected 2026-09-24 15:23:47 UTC 22,103 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8444,7863],{27561:function(e,a,s){var t=s(67990),l=/^\s+/;e.exports=function(e){return e?e.slice(0,t(e)+1).replace(l,""):e}},67990:function(e){var a=/\s/;e.exports=function(e){for(var s=e.length;s--&&a.test(e.charAt(s)););return s}},23279:function(e,a,s){var t=s(13218),l=s(7771),n=s(14841),i=Math.max,r=Math.min;e.exports=function(e,a,s){var o,c,d,u,m,h,x=0,p=!1,f=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(a){var s=o,t=c;return o=c=void 0,x=a,u=e.apply(t,s)}function j(e){var s=e-h,t=e-x;return void 0===h||s>=a||s<0||f&&t>=d}function b(){var e,s,t,n=l();if(j(n))return N(n);m=setTimeout(b,(e=n-h,s=n-x,t=a-e,f?r(t,d-s):t))}function N(e){return(m=void 0,v&&o)?g(e):(o=c=void 0,u)}function y(){var e,s=l(),t=j(s);if(o=arguments,c=this,h=s,t){if(void 0===m)return x=e=h,m=setTimeout(b,a),p?g(e):u;if(f)return clearTimeout(m),m=setTimeout(b,a),g(h)}return void 0===m&&(m=setTimeout(b,a)),u}return a=n(a)||0,t(s)&&(p=!!s.leading,d=(f="maxWait"in s)?i(n(s.maxWait)||0,a):d,v="trailing"in s?!!s.trailing:v),y.cancel=function(){void 0!==m&&clearTimeout(m),x=0,o=h=c=m=void 0},y.flush=function(){return void 0===m?u:N(l())},y}},33448:function(e,a,s){var t=s(44239),l=s(37005);e.exports=function(e){return"symbol"==typeof e||l(e)&&"[object Symbol]"==t(e)}},7771:function(e,a,s){var t=s(55639);e.exports=function(){return t.Date.now()}},14841:function(e,a,s){var t=s(27561),l=s(13218),n=s(33448),i=0/0,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(n(e))return i;if(l(e)){var a="function"==typeof e.valueOf?e.valueOf():e;e=l(a)?a+"":a}if("string"!=typeof e)return 0===e?e:+e;e=t(e);var s=o.test(e);return s||c.test(e)?d(e.slice(2),s?2:8):r.test(e)?i:+e}},52269:function(e,a,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/categories",function(){return s(13114)}])},53030:function(e,a,s){"use strict";s.d(a,{A:function(){return o}});var t=s(85893),l=s(67294),n=s(98333),i=s(27436),r=s(40139);let o=e=>{let{isOpen:a,onClose:s,titleOverride:o,entityDescription:c,onDelete:d}=e,u=(0,l.useRef)(null),[m,h]=(0,l.useState)(!1),x=async()=>{try{h(!0),await d(),h(!1),s()}catch(e){h(!1),(0,r.Y)(e)}};return(0,t.jsx)(n.aR,{isOpen:a,leastDestructiveRef:u,onClose:s,isCentered:!0,children:(0,t.jsx)(n.dh,{className:"dialog",children:(0,t.jsx)(n._T,{children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(n.fY,{children:o||'Delete "'.concat(c,'"')}),(0,t.jsx)(n.iP,{children:"You cannot undo this action."}),(0,t.jsxs)(n.xo,{className:"d-flex justify-content-center gap-3",children:[(0,t.jsx)(i.Z,{className:"me-2",ariaLabel:"Close Delete Dialog",buttonRef:u,onClick:s,children:"Cancel"}),(0,t.jsx)(i.Z,{className:"text-white",ariaLabel:"Delete ".concat(c),color:"danger",onClick:x,isLoading:m,disabled:m,children:"Delete"})]})]})})})})}},98605:function(e,a,s){"use strict";var t=s(85893),l=s(67294),n=s(27436);let i=(e,a,s)=>{let t=a?a[e]:null;return!t&&e.includes(".")&&(t=e.split(".").reduce((e,a)=>e&&e[a],a)),t?t.message||s:null};a.Z=e=>{let{label:a,register:s,errors:r,placeholder:o,inputRef:c,getValues:d,customErrorMessage:u,type:m="text",isPassword:h=!1,helperText:x,prependInput:p,appendInput:f,className:v,...g}=e,[j,b]=(0,l.useState)(!1),[N,y]=(0,l.useState)(!1),[w,k]=(0,l.useState)(void 0),C=(0,l.useCallback)(e=>{e&&k(e.clientWidth?"".concat(e.clientWidth-2,"px"):void 0)},[]),L=i((null==s?void 0:s.name)||"",r,u);return(0,t.jsxs)("div",{className:"field-container field-container--".concat(N?"labelFloating":"labelResting"," ").concat(L?"is-invalid":""),children:[(0,t.jsx)("label",{className:"field-label ".concat((null==s?void 0:s.name)&&d&&["",null,void 0].includes(d(s.name))?"field-label--empty":""," field-label--").concat(N?"floating":"resting"," ").concat(p?"field-label--has-prepend":""),htmlFor:null==s?void 0:s.name,children:a}),(0,t.jsxs)("div",{className:"position-relative",children:[p&&(0,t.jsx)("div",{ref:C,className:"field-prepend d-flex align-items-end position-absolute left-0 bottom-0 top-0 p-2 ms-1",children:p}),(0,t.jsx)("input",{ref:c,type:h?j?"text":"password":m,placeholder:o,className:"Input ".concat(N?"Input--focused":""," ").concat(v),style:{paddingLeft:w},...s,onFocus:()=>y(!0),onBlur:e=>{null==s||s.onBlur(e),y(!1)},...g}),h&&(0,t.jsx)(n.Z,{onClick:()=>b(!j),className:"toggle-password no-min-size text-dark position-absolute right-0 bottom-0 top-0 p-2 me-1 z-index-1",children:(0,t.jsx)("span",{className:"far fa-eye".concat(j?"-slash":"")})}),f&&(0,t.jsx)("div",{className:"field-append d-flex align-items-center position-absolute right-0 bottom-0 top-0 p-2 me-1",children:f})]}),L&&(0,t.jsx)("span",{className:"invalid-feedback",children:"".concat(L)}),x&&(0,t.jsx)("span",{className:"small d-block mt-2",children:x})]})}},57863:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return c}});var t=s(85893),l=s(67294),n=s(87536),i=s(90483);let r={transparent:"#0000",primary:"#0C78E2",dark:"#30313d",white:"#ffffff"},o={option:(e,a)=>({...e,color:a.isSelected||a.isFocused?r.white:r.dark,padding:8,backgroundColor:a.isSelected||a.isFocused?r.primary:r.white}),control:e=>({...e,backgroundColor:r.transparent,padding:0,minHeight:70,border:"1px solid ".concat(r.dark),outline:0,borderRadius:12}),menuList:e=>
1({...e,margin:0,backgroundColor:r.white}),singleValue:e=>({...e,color:r.dark,marginTop:15,marginLeft:5}),input:e=>({...e,marginTop:"16px"}),menuPortal:e=>({...e,zIndex:9999})};var c=e=>{let{register:a,name:s,control:r,value:c,options:d,label:u,getValues:m,setFirstAsDefault:h=!0,allowNone:x=!1,emptyOptionLabel:p="None",onSelectChange:f,onInputChange:v,errors:g,helperText:j,customErrorMessage:b,isDisabled:N=!1,formatOptionLabel:y,...w}=e,k=(null==a?void 0:a.name)||s||"",C=[{label:p,value:""},...d],[L,S]=(0,l.useState)(!!m(k)),Z=g?g[k]:null,T=Z?Z.message||b:null;return(0,t.jsxs)("div",{className:"select-container ".concat(T?"is-invalid":""),children:[(0,t.jsx)("label",{htmlFor:k,className:"".concat(L?"select-label-floating":""),children:u}),(0,t.jsx)(n.Qr,{name:k,control:r,render:e=>{let{field:{value:s,onChange:l,onBlur:n}}=e;return(0,t.jsx)(i.ZP,{classNamePrefix:"select",...a,options:x?C:d,styles:o,onChange:e=>{let a=(null==e?void 0:e.value)===p?"":null==e?void 0:e.value;l(a),S(!0),f&&f(a)},onInputChange:e=>{v&&v(e)},onBlur:n,value:d.find(e=>e.value===s),defaultValue:h?d[0]:void 0,placeholder:!1,isDisabled:N,formatOptionLabel:y,menuPortalTarget:"undefined"!=typeof document?document.body:void 0,...w})}}),T&&(0,t.jsx)("span",{className:"invalid-feedback",children:"".concat(T)}),j&&(0,t.jsx)("span",{className:"small d-block mt-2",children:j})]})}},10803:function(e,a,s){"use strict";var t=s(85893),l=s(41664),n=s.n(l);a.Z=e=>{let{title:a,backUrl:s,align:l="start",showOnMobile:i=!1}=e;return(0,t.jsxs)("div",{className:"page-title text-".concat(l," ").concat(i?"":"d-none"," d-lg-block"),children:[s&&(0,t.jsxs)(n(),{href:s,className:"me-4 text-dark text-start d-none d-lg-block",children:[(0,t.jsx)("span",{className:"fas fa-arrow-left fa-md me-2 mb-2"}),"Back"]}),(0,t.jsx)("h1",{className:"text-capitalize mb-0 h2",children:a})]})}},30947:function(e,a,s){"use strict";s.d(a,{l:function(){return f}});var t=s(85893);s(67294);var l=s(41664),n=s.n(l),i=s(99052),r=s(72341),o=s(44562),c=s(34527),d=s(26426),u=s(27436),m=s(99837),h=s(40669);let x=()=>{var e,a,s,l,x,p,f,v;let{isNavActive:g}=(0,o.Q)(),{signOut:j}=(0,c.P9)(),{user:b}=(0,r.c)(),{ADMIN_LEFT_NAV_OPTIONS:N,NAV_OPTIONS_FOR_ADMIN_LEFT_NAV_USER_MENU:y}=(0,o.Q)();return(0,t.jsx)("div",{className:"w-md-250p vh-100 position-absolute top-0 left-0 bottom-0",children:(0,t.jsxs)("div",{className:"border-end h-100",children:[(0,t.jsx)("div",{className:"h-xs-200p",children:(0,t.jsx)(d.d,{src:(null==b?void 0:null===(e=b.profileMedia)||void 0===e?void 0:e.media.sourceUrl)||m.c1,alt:(null==b?void 0:null===(s=b.profileMedia)||void 0===s?void 0:null===(a=s.media.details)||void 0===a?void 0:a.altText)||"profile image",width:250,height:200,className:"object-fit-cover object-position-top w-100 h-100"},null==b?void 0:null===(l=b.profileMedia)||void 0===l?void 0:l.mediaId)}),(0,t.jsx)("div",{className:"custom-scroll-bar admin-left-nav-list-container",children:Object.keys(N).map((e,a)=>(0,t.jsxs)("ul",{className:"nav flex-column mt-3",children:[-1===e.indexOf("_hide")&&(0,t.jsx)("span",{className:"fw-bold small d-block px-3 mb-2",children:e}),N[e].map((e,a)=>(0,t.jsx)("li",{children:(0,t.jsxs)(n(),{href:e.path,className:"d-block text-dark-900 fw-600 py-2 px-3 ".concat(g(e.path,e.hasChildrenRoutes)?"bg-alice-blue":""),"aria-label":"Link to ".concat(e.label),children:[(0,t.jsx)("span",{className:"".concat(e.icon," me-1 fa-fw")})," ",(0,t.jsx)("span",{children:e.label})]})},a))]},a))}),(0,t.jsx)("div",{className:"position-absolute bottom-0 left-0 right-0",children:(0,t.jsxs)(i.v2,{children:[(0,t.jsx)(i.j2,{className:"btn w-100 text-dark-900 text-start no-min-size p-2 bg-white rounded-0 border-end mt-0 bg-white border-top",children:(0,t.jsx)("div",{className:"d-flex gap-2 align-items-center justify-content-between",children:b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"d-flex gap-2 align-items-center",children:[(0,t.jsx)(d.d,{src:(null===(x=b.profileMedia)||void 0===x?void 0:x.media.sourceUrl)||m.Wp,alt:(null===(f=b.profileMedia)||void 0===f?void 0:null===(p=f.media.details)||void 0===p?void 0:p.altText)||"profile image",width:40,height:40,className:"object-fit-cover rounded-pill"},null===(v=b.profileMedia)||void 0===v?void 0:v.mediaId),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"d-block fw-bold",children:(0,h.N)(b)}),(0,t.jsx)("span",{className:"d-block small",children:"Manage Profile"})]})]}),(0,t.jsx)("span",{className:"fal fa-chevron-right"})]})})}),(0,t.jsx)(i.qy,{className:"bg-dark w-xs-250p overflow-hidden p-3 mb-n2 menu-list-container",children:(0,t.jsxs)("ul",{className:"list-unstyled mb-0",children:[y.map((e,a)=>(0,t.jsx)("li",{children:(0,t.jsxs)(n(),{href:e.path,className:"d-block text-white fw-600 py-2 mb-2","aria-label":"Link to ".concat(e.label),rel:e.isExternal?"noopener noreferrer":void 0,target:e.isExternal?"_blank":void 0,children:[(0,t.jsx)("span",{className:"".concat(e.icon," me-2 fa-fw")}),(0,t.jsx)("span",{children:e.label}),e.isExternal&&(0,t.jsx)("span",{className:"fal fa-external-link ms-3"})]})},a)),(0,t.jsx)("li",{children:(0,t.jsxs)(u.Z,{ariaLabel:"Log out",className:"d-block text-white fw-600 no-min-size py-2 px-0",onClick:j,children:[(0,t.jsx)("span",{className:"fal fa-sign-out me-1 fa-fw"})," Log Out"]})})]})})]})})]})})};var p=s(28098);let f=e=>{let{children:a,isLoading:s}=e;return(0,t.jsx)("div",{className:"position-absolute top-0 left-0 right-0",children:(0,t.jsxs)("div",{className:"position-relative px-2 ps-lg-0 pe-lg-4",children:[(0,t.jsx)("div",{className:"d-none d-lg-block position-fixed",children:(0,t.jsx)(x,{})}),(0,t.jsx)("div",{className:"ms-lg-280p",children:s?(0,t.jsx)("div",{className:"w-100 vh-100 d-flex align-items-center justify-content-center",children:(0,t.jsx)(p.Z,{color:"primary"})}):(0,t.jsx)("div",{className:"pt-7 pt-lg-4 pb-8 pb-lg-5",children:a})})]})})}},61770:function(e,a,s){"use strict";var t=s(85893),l=s(67294),n=s(11163),i=s(27436),r=s(28098),o=s(99837);a.Z=e=>{let{messageTitle:a,showMessage:s=!1,actionLabel:c,action:d,callActionOnInit:u=!1,showCancelAction:m=!0,showSpinner:h=!0,bottomMessage:x}=e,p=(0,n.useRouter)();return(0,l.useEffect)(()=>{u&&d&&d()},[d,u]),(0,t.jsx)("div",{className:"h-fix-screen d-flex align-items-center justify-content-center",children:(0,t.jsxs)("div",{className:"minw-md-450p d-flex align-items-center justify-content-center flex-column p-4 rounded-md position-relative ".concat(s?"shadow bg-white":""),children:[m&&s&&(0,t.jsx)(i.Z,{ariaLabel:"Navigate back to home",className:"no-min-size position-absolute top-0 right-0 m-2 text-white",onClick:()=>p.back(),children:(0,t.jsx)("span",{className:"fal fa-times"})}),s&&(0,t.jsx)("img",{alt:"CMS Critic Logo",src:o.Yr,className:"w-xs-200
1p img-fluid"}),h&&(0,t.jsx)("div",{className:"my-3",children:(0,t.jsx)(r.Z,{})}),s&&(0,t.jsxs)("div",{className:"text-center mt-4 mw-xs-500p",children:[(0,t.jsx)("h4",{className:"mb-4",children:a}),(0,t.jsx)(i.Z,{ariaLabel:"sign up",className:"ms-2 text-white fw-bold h-50 rounded-xl",color:"secondary",onClick:()=>d&&d(),children:c})]}),(0,t.jsx)("div",{className:"mt-3",children:x})]})})}},17101:function(e,a,s){"use strict";var t=s(85893),l=s(67294),n=s(11163),i=s(23279),r=s.n(i),o=s(87536),c=s(95507),d=s(10295),u=s(37848),m=s(98605),h=s(57863);a.Z=e=>{let{type:a,isStatusFilterHidden:s=!1,isCategoryFilterHidden:i=!1,setSearchState:x}=e,{query:{categoryId:p,status:f,nameLike:v}}=(0,n.useRouter)(),{updateURL:g}=(0,u.j)(),{data:j=[]}=(0,d.lz)({mode:"options"}),{register:b,getValues:N,control:y}=(0,o.cI)({defaultValues:{name:(null==v?void 0:v.toString())||"",status:(null==f?void 0:f.toString())||"all",categoryId:(null==p?void 0:p.toString())||"all"}}),w=(0,l.useCallback)(r()(()=>{let e=N("name").trim();x?x(a=>({...a,nameLike:e})):g("nameLike",e)},300),[]),k=(0,l.useMemo)(()=>s||i?!s&&i||s&&!i?2:1:3,[i,s]);return(0,t.jsxs)("form",{onSubmit:e=>e.preventDefault(),className:"row row-cols-1 row-cols-md-".concat(k," g
1-3"),children:[(0,t.jsx)("div",{className:"col",children:(0,t.jsx)(m.Z,{register:b("name"),placeholder:"Enter ".concat(a," name to filter"),label:"Filter by name",getValues:N,onKeyUp:w})}),!i&&(0,t.jsx)("div",{className:"col",children:(0,t.jsx)(h.default,{name:"categoryId",label:"Category to filter",options:[{label:"All",value:"all"},...j],control:y,getValues:N,onSelectChange:e=>{x?x(a=>({...a,categoryId:e&&"all"!==e?e:void 0})):g("categoryId",e)}})}),!s&&(0,t.jsx)("div",{className:"col",children:(0,t.jsx)(h.default,{name:"status",label:"Status to filter",options:[{label:"All",value:"all"},{label:"Live",value:c.Ao.live},{label:"Draft",value:c.Ao.draft}],control:y,getValues:N,onSelectChange:e=>{x?x(a=>({...a,status:e&&"all"!==e?e:void 0})):g("status",e)}})})]})}},85517:function(e,a,s){"use strict";var t=s(85893),l=s(67294),n=s(41664),i=s.n(n),r=s(11163),o=s(19133),c=s(95507),d=s(93199),u=s(72341),m=s(61770);a.Z=(e,a)=>{let s=s=>{let{push:n,back:h}=(0,r.useRouter)(),{isDataLoaded:x,isConnected:p,user:f}=(0,o.C)(d.JS),[v,g]=(0,l.useState)(!p),{userHasEditorOnAnyProduct:j,userCanManageAds:b}=(0,u.c)();return((0,l.useEffect)(()=>{setTimeout(()=>g(!1),1e3)},[]),v)?(0,t.jsx)(m.Z,{}):p?x?(null==a?void 0:a.needSystemAdminRole)&&(null==f?void 0:f.systemRole)!==c.yY.admin||(null==a?void 0:a.needAdsCreatorRole)&&!b||(null==a?void 0:a.checkIfUserIsProductMemberOrAdmin)&&!j&&(null==f?void 0:f.systemRole)!==c.yY.admin?(0,t.jsx)(m.Z,{showMessage:!0,messageTitle:"You do not have sufficient permission to access this page",actionLabel:"Go Back",action:()=>h(),showSpinner:!1,showCancelAction:!1}):(0,t.jsx)(e,{...s}):(0,t.jsx)(m.Z,{}):(0,t.jsx)(m.Z,{showMessage:!0,showSpinner:!1,messageTitle:"Please sign up to continue",actionLabel:"Sign Up",action:()=>n("/signup"),bottomMessage:(0,t.jsxs)("div",{className:"d-flex gap-1",children:[(0,t.jsx)("span",{children:"Already have an account?"}),(0,t.jsx)(i(),{href:"/signin",className:"text-decoration-underline text-dark",children:"Sign In"})]})})};return e.getInitialProps&&(s.getInitialProps=e.getInitialProps),s}},37848:function(e,a,s){"use strict";s.d(a,{j:function(){return r}});var t=s(67294),l=s(11163);function n(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,s=Number(e);return isNaN(s)?a:s<=50?s:50}let i={includePage:!0},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,{push:a}=(0,l.useRouter)(),[s,r]=(0,t.useState)({page:1,limit:10,status:void 0,nameLike:void 0}),o=(e,a)=>{let s=Number(e);return isNaN(s)||s<1?1:a&&s>a?a:s};return{updateURL:async(s,t)=>{let l=new URL(window.location.href);t&&"all"!==t?(l.searchParams.set(s,t),e.includePage&&l.searchParams.set("page","1")):l.searchParams.delete(s),await a(l.href,l.href,{shallow:!0})},getLimitFromQuery:n,calculateProperPageNumber:o,calculatePageState:(e,a,s)=>{let t=Math.ceil(e/a),l=o(s,t);return{disabledPrev:l<=1,disabledNext:l>=t,currentPageNumber:l,maxPagesCount:t}},searchState:s,setSearchState:r,calculateRowNumber:(e,a,s)=>(o(a)-1)*n(s)+e+1}}},13114:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return Z}});var t=s(85893),l=s(39653),n=s(67294),i=s(98333),r=s(87536),o=s(40782),c=s(10295),d=s(40669);let u=()=>{let[e,{isLoading:a}]=(0,c.m7)(),[s,{isLoading:t}]=(0,c.pi)(),[l,{isLoading:n}]=(0,c.l8)(),[i]=(0,c.I)(),r=async(e,a,s)=>!!s&&s[a].toLowerCase()===e.toLocaleLowerCase()||(await i({value:e,key:a}).unwrap()).isAvailable,o=async e=>{let a=await r(e,"slug"),s=e;for(;!a;)s=s+"-"+(0,d.O1)(),a=await r(s,"slug");return s};return{isCreating:a,isUpdating:t,isDeleting:n,saveCategory:async(a,t)=>{let l={...t};return a?await e({payload:l}).unwrap():await s({payload:l}).unwrap()},removeCategory:async e=>{await l({category:e}).unwrap()},isCategorySlugOrNameAvailable:r,generateUniqueCategorySlug:o}};var m=s(27436),h=s(98605),x=s(73786),p=s(40139);let f=e=>{let{category:a,isOpen:s,onClose:l}=e,{saveCategory:c,isCategorySlugOrNameAvailable:f,generateUniqueCategorySlug:v}=u(),{register:g,handleSubmit:j,setError:b,getValues:N,clearErrors:y,reset:w,formState:{errors:k,isSubmitting:C}}=(0,r.cI)({defaultValues:{slug:(null==a?void 0:a.slug)||"",name:(null==a?void 0:a.name)||""}});(0,n.useEffect)(()=>{w({slug:(null==a?void 0:a.slug)||"",name:(null==a?void 0:a.name)||""})},[a,w]);let L=async e=>{try{if(!a){let a=(0,d.aP)(e.name),s=await v(a);e.slug=s}await c(!a,{...a,...e}),w(),o.Am.success("Your category has been saved successfully"),l()}catch(e){(0,p.Y)(e,b)}};return(0,t.jsxs)(i.dy,{isOpen:s,onClose:l,size:"xl",children:[(0,t.jsx)(i.P1,{}),(0,t.jsxs)(i.sc,{className:"drawer",children:[(0,t.jsx)(i.cC,{}),(0,t.jsxs)(i.OX,{children:[a?"Update":"Add"," Category"]}),(0,t.jsx)(i.Ng,{children:(0,t.jsxs)("form",{id:"tag-update-form",onSubmit:j(L),children:[a&&(0,t.jsx)("div",{className:"w-100 mb-4 mt-3",children:(0,t.jsx)(h.Z,{register:g("slug",{required:"This field is required",pattern:{value:x.Zs,message:"The slug must only contain lowercase letters, numbers, and hyphen"},minLength:{value:2,message:"Your tag slug must have at least 2 characters"},validate:async e=>await f(e,"slug",a)}),customErrorMessage:"This slug is already taken",errors:k,placeholder:"Enter your tag slug",label:"Slug",getValues:N})}),(0,t.jsx)("div",{className:"w-100 mb-4 ".concat(a?"":"mt-3"),children:(0,t.jsx)(h.Z,{register:g("name",{required:"This field is required",minLength:{value:2,message:"Your category name must have at least 2 characters"},validate:async e=>await f(e,"name",a)}
1),customErrorMessage:"This name is already taken",errors:k,placeholder:"Enter your category name",label:"Name",getValues:N})})]})}),(0,t.jsxs)(i.ze,{children:[(0,t.jsx)(m.Z,{ariaLabel:"Cancel",onClick:l,children:"Cancel"}),(0,t.jsx)(m.Z,{type:"submit",className:"text-white",ariaLabel:"Save category Changes",color:"primary",form:"tag-update-form",isLoading:C,disabled:C,onClick:()=>y(["server-error"]),children:"Save"})]})]})]})};var v=s(11163),g=s(41609),j=s.n(g),b=s(53030),N=s(28098),y=s(17101);let w=()=>{let{query:{nameLike:e}}=(0,v.useRouter)(),{isOpen:a,onOpen:s,onClose:i}=(0,l.qY)(),{isOpen:r,onOpen:o,onClose:h}=(0,l.qY)(),{removeCategory:x}=u(),{data:p,isFetching:g,isLoading:w}=(0,c.lz)({nameLike:(null==e?void 0:e.toString())||void 0}),[k,C]=(0,n.useState)(null),L=(e,a)=>{let t=e.target.closest("[data-type]"),l=null==t?void 0:t.getAttribute("data-type");if(C(a),"action"===l){s();return}o()};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Z,{type:"category",isStatusFilterHidden:!0,isCategoryFilterHidden:!0}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("table",{className:"table",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{scope:"col",className:"w-lg-90-down",children:"Name"}),(0,t.jsx)("th",{scope:"col",className:"opacity-0 w-xs-100p",children:"Actions"})]})}),(0,t.jsx)("tbody",{children:p&&!g&&p.map((e,a)=>(0,t.jsxs)("tr",{className:"pointer",onClick:a=>L(a,e),children:[(0,t.jsx)("td",{className:"align-middle",children:(0,d.aS)(e.name,80)}),(0,t.jsx)("td",{className:"text-center align-middle",children:(0,t.jsx)(m.Z,{className:"no-min-size w-xs-50p h-100 bg-hover-background","data-type":"action",children:(0,t.jsx)("span",{className:"fal fa-trash"})})})]},a))})]}),g&&(0,t.jsx)("div",{className:"w-100 d-flex justify-content-center py-4",children:(0,t.jsx)(N.Z,{color:"primary"})}),!w&&!g&&j()(p)&&(0,t.jsx)("div",{className:"d-flex flex-column align-items-center justify-content-center",children:e?(0,t.jsx)("p",{children:"There are no categories to show that match your search"}):(0,t.jsx)("p",{children:"You don't have any categories yet"})})]}),k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f,{category:k,isOpen:r,onClose:h}),(0,t.jsx)(b.A,{isOpen:a,onClose:i,entityDescription:"".concat(k.name),onDelete:()=>x(k)})]})]})};var k=s(10803),C=s(30947),L=s(85517);let S=()=>{let{isOpen:e,onOpen:a,onClose:s}=(0,l.qY)();return(0,t.jsxs)(C.l,{children:[(0,t.jsxs)("div",{className:"row mx-auto",children:[(0,t.jsx)("div",{className:"col-8 col-lg-6",children:(0,t.jsx)(k.Z,{title:"Categories"})}),(0,t.jsxs)("div",{className:"col-4 col-lg-6 d-flex justify-content-end align-items-center",children:[(0,t.jsx)(m.Z,{type:"button",className:"no-min-size w-xs-80p rounded-xl text-white fw-bold d-md-none",ariaLabel:"Add new post",color:"primary",onClick:a,children:(0,t.jsx)("span",{className:"fal fa-plus"})}),(0,t.jsx)(m.Z,{color:"primary",className:"text-white d-none d-md-block",onClick:a,children:"Create Category"})]})]}),(0,t.jsx)("div",{className:"my-4",children:(0,t.jsx)(w,{})}),(0,t.jsx)(f,{isOpen:e,onClose:s})]})};S.getInitialProps=async()=>({pageTitle:"Categories",hideDesktopNav:!0,showDetailTopNav:!0});var Z=(0,L.Z)(S,{needSystemAdminRole:!0})}},function(e){e.O(0,[7536,9052,483,2888,9774,179],function(){return e(e.s=52269)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.