(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8905],{32205:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return y}});var t=n(44359),i=n(11163),s=(n(67294),n(59499)),u=n(50029),a=n(16835),o=n(87794),c=n.n(o),l=n(23256),d=n(14416),f=n(37161),p=n(43072),m=n(53547),v=n(85893);function b(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function j(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?b(Object(n),!0).forEach((function(r){(0,s.Z)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var O=function(e){var r=function(e,r){var n,t,i,s,o,l=(0,d.useSelector)(f.dy),m=(0,p.Gl)(),v=(0,a.Z)(m,1)[0],b={username:null!==(n=e.username)&&void 0!==n?n:"",first_name:null!==(t=e.first_name)&&void 0!==t?t:"",last_name:null!==(i=e.last_name)&&void 0!==i?i:"",password:"",scopes:null!==(s=r.scopes)&&void 0!==s?s:[],id:e.id},O=function(){var r=(0,u.Z)(c().mark((function r(n){var t;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=j(j({},e),n),r.abrupt("return",v(t));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),h=!!l&&l.id===e.id,y=(0,p.gU)(null!==(o=null===l||void 0===l?void 0:l.id)&&void 0!==o?o:"").data;return{handleSubmit:O,isOwnProfile:h,canUpdateUser:!!h||!!y&&y.scopes.includes("user:update"),initialValues:b}}(e.user,e.permissions),n=r.isOwnProfile,t=r.handleSubmit,i=r.canUpdateUser,s=r.initialValues;return(0,v.jsx)("div",{children:(0,v.jsxs)("main",{children:[(0,v.jsx)(l.X6,{mb:4,fontSize:"xl",colorScheme:"primary",children:"Profile"}),(0,v.jsx)(l.iz,{mb:7}),(0,v.jsx)(m.Z,{onSubmit:t,initialValues:s,canEditNames:i,canChangePassword:n})]})})},h=n(33278),y=function(){var e=(0,i.useRouter)(),r="";r=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";var n=(0,p.Fk)(r),s=n.data,u=n.isLoading,a=(0,p.gU)(r),o=a.data,c=a.isLoading;return u||c?(0,v.jsx)(h.Z,{title:"Edit User",children:(0,v.jsx)(t.$,{})}):null==s||null==o?(0,v.jsx)(h.Z,{title:"Edit User",children:"Could not find profile ID."}):(0,v.jsx)(h.Z,{title:"Edit User",children:(0,v.jsx)(O,{user:s,permissions:o})})}},12432:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-management/profile/[id]",function(){return n(32205)}])}},function(e){e.O(0,[5372,7601,2890,2350,6211,440,6648,6508,6016,3382,9774,2888,179],(function(){return r=12432,e(e.s=r);var r}));var r=e.O();_N_E=r}]);