1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5521],{50967:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/teams/[id]/edit",function(){return n(70594)}])},44555:function(t,e,n){"use strict";n.d(e,{Qy:function(){return g},ST:function(){return f},UH:function(){return u},US:function(){return j},WS:function(){return d},Wx:function(){return m},Zr:function(){return o},_L:function(){return p},_P:function(){return T},d7:function(){return y},jg:function(){return l},qp:function(){return w},xZ:function(){return h},zf:function(){return c}});var r=n(34078),i=n.n(r);let a="https://mapping.team",s=i()(a,"/api/profiles");async function o(t){let e=await fetch(i()(s,"keys","teams","".concat(t),"users"),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===e.status)return e.json();{let n=Error("could not retrieve team member attributes");throw n.status=e.status,n}}async function u(t){let e=await fetch(i()(s,"keys","organizations","".concat(t),"users"),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===e.status)return e.json();{let n=Error("could not retrieve team member attributes");throw n.status=e.status,n}}async function c(t){let e=await fetch(i()(s,"keys","organizations","".concat(t),"teams"),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===e.status)return e.json();{let n=Error("could not retrieve team member attributes");throw n.status=e.status,n}}async function l(t){let e=await fetch(i()(s,"keys","teams","".concat(t)),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===e.status)return e.json();{let n=Error("could not retrieve team member attributes");throw n.status=e.status,n}}async function f(t,e){return fetch(i()(s,"keys","".concat(t)),{method:"PUT",body:JSON.stringify(e),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function h(t){return fetch(i()(s,"keys","".concat(t)),{method:"DELETE",headers:{"Content-Type":"application/json; charset=utf-8"}})}async function d(t,e){let n=await fetch(i()(s,"organizations","".concat(t),"".concat(e)),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===n.status)return n.json();if(404===n.status||401===n.status)return[];{let r=Error("could not retrieve profile");throw r.status=n.status,r}}async function p(t,e){let n=await fetch(i()(s,"teams","".concat(t),"".concat(e)),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===n.status)return n.json();if(404===n.status||401===n.status)return[];{let r=Error("could not retrieve profile");throw r.status=n.status,r}}async function y(t,e){return e=[].concat(e),fetch(i()(s,"keys","teams","".concat(t),"users"),{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function m(t,e){return e=[].concat(e),fetch(i()(s,"keys","organizations","".concat(t),"users"),{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function g(t,e){return e=[].concat(e),fetch(i()(s,"keys","organizations","".concat(t),"teams"),{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function j(){let t=await fetch(i()(a,"/api/my/profiles"),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===t.status)return t.json();{let e=Error("could not retrieve profile");throw e.status=t.status,e}}async function w(t){return fetch(i()(a,"/api/my/profiles"),{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json; charset=utf-8"}})}async function T(t){let e=await fetch(i()(a,"/api/profiles/teams/".concat(t)),{method:"GET",headers:{"Content-Type":"application/json; charset=utf-8"}});if(200===e.status)return e.json();if(404===e.status||401===e.status)return[];{let n=Error("could not retrieve profile");throw n.status=e.status,n}}},70594:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return E}});var r=n(85893),i=n(67294),a=n(34078),s=n.n(a),o=n(11163),u=n.n(o),c=n(90178),l=n(917),f=n(93798),h=n(82308),d=n(96272),p=n(204),y=n(14418),m=n(23100),g=n(88911),j=n(36979),w=n(44555),T=n(36986),x=n.n(T),Z=n(41664),v=n.n(Z),b=n(33379);let S="https://mapping.team";class E extends i.Component{static async getInitialProps(t){let{query:e}=t;if(e)return{id:e.id}}async componentDidMount(){let{id:t}=this.props;try{let e=await (0,f.VP)(t),n=await (0,w.jg)(t)||[],r=[],i=[];i=await (0,w._P)(t),e.org&&(r=await (0,w.zf)(e.org.organization_id)),this.setState({team:e,profileValues:i,teamAttributes:n,orgTeamAttributes:r,loading:!1})}catch(a){x().error(a),this.setState({error:a,team:null,loading:!1})}}async deleteTeam(){let{id:t}=this.props;try{let e=await (0,f.uL)(t);if(e.ok)u().push(s()(S,"/teams"));else throw Error("Could not delete team")}catch(n){x().error(n),this.setState({error:n})}}renderDeleter(){let t=(0,r.jsx)(d.z,{colorScheme:"red",variant:"outline",onClick:()=>{this.setState({deleteClickedOnce:!0})},children:"Delete this team"});return this.state.deleteClickedOnce&&(t=(0,r.jsxs)(p.k,{gap:4,children:[(0,r.jsx)(d.z,{onClick:()=>{this.setState({deleteClickedOnce:!1})},children:"Cancel"}),(0,r.jsx)(d.z,{colorScheme:"red",variant:"outline",onClick:()=>{this.deleteTeam()},children:"Really delete this team?"})]})),t}render(){let{team:t,error:e,teamAttributes:n,orgTeamAttributes:i,profileValues:a}=this.state;if(e){if(e.status>=400&&e.status<500)return(0,r.jsx)(b.Z,{children:(0,r.jsx)(y.X,{color:"white",children:"Team not found"})});if(e.status>=500)return(0,r.jsx)(b.Z,{children:(0,r.jsx)(y.X,{color:"white",children:"Error Fetching Team"})})}return t?(0,r.jsxs)(m.xu,{as:"main",mb:16,children:[(0,r.jsx)(b.Z,{children:(0,r.jsxs)(p.k,{direction:["column","row"],justifyContent:"space-between",gap:4,children:[(0,r.jsxs)(p.k,{direction:"column",gap:1,children:[(0,r.jsx)(v(),{href:"/teams/".concat(t.id),children:"â Back to Team Page"}),(0,r.jsx)(y.X,{color:"white",children:t.name}),(0,r.jsx)(g.x,{variant:"overline",children:"Editing Team"})]}),(0,r.jsx)(d.z,{variant:"outline",colorScheme:"white",as:v(),href:"/teams/".concat(t.id,"/edit-profiles"),children:"Edit Team Profiles"})]})}),(0,r.jsxs)(j.W,{maxW:"container.xl",as:"section",children:[(0,r.jsx)(m.xu,{as:"article",layerStyle:"shadowed",children:(0,r.jsx)(h.Z,{initialValues:(0,c.Z)(["name","bio","hashtag","editing_policy","location","privacy"],t),profileValues:a,teamTags:n,orgTeamTags:i,team:t,async onSubmit(e,n){try{let r=Object.keys(e.tags).map(t=>({key_id:(0,l.Z)("-",t)[1],value:e.tags[t]}));e.tags=r,await (0,f.fs)(t.id,e),n.setSubmitting(!1),u().push(s()(S,"/teams/".concat(t.id)))}catch(i){x().error(i),n.setSubmitting(!1),n.setStatus(i.message)}}})}),(0,r.jsxs)(m.xu,{layerStyle:"shadowed",as:"section",borderColor:"red.500",boxShadow:"4px 4px 0 0 var(--chakra-colors-red-500)",display:"flex",flexDirection:"column",alignItems:"flex-start",ga
1p:2,children:[(0,r.jsx)(y.X,{as:"h2",variant:"sectionHead",size:"md",color:"red",children:"Danger Zone"}),(0,r.jsx)("p",{children:"Delete this team, team information and all memberships associated to this team"}),this.renderDeleter()]})]})]}):null}constructor(t){super(t),this.state={loading:!0,error:void 0,deleteClickedOnce:!1}}}},23224:function(t,e,n){"use strict";var r=n(8969),i=(0,n(81353).Z)(function(t,e){return(0,r.Z)(t.length,function(){return t.apply(e,arguments)})});e.Z=i},95669:function(t,e,n){"use strict";var r=n(8969),i=n(93993),a=n(81353),s=n(12092),o=(0,a.Z)(function(t,e){return 1===t?(0,i.Z)(e):(0,r.Z)(t,(0,s.Z)(t,[],e))});e.Z=o},8969:function(t,e,n){"use strict";function r(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,n){return e.apply(this,arguments)};case 3:return function(t,n,r){return e.apply(this,arguments)};case 4:return function(t,n,r,i){return e.apply(this,arguments)};case 5:return function(t,n,r,i,a){return e.apply(this,arguments)};case 6:return function(t,n,r,i,a,s){return e.apply(this,arguments)};case 7:return function(t,n,r,i,a,s,o){return e.apply(this,arguments)};case 8:return function(t,n,r,i,a,s,o,u){return e.apply(this,arguments)};case 9:return function(t,n,r,i,a,s,o,u,c){return e.apply(this,arguments)};case 10:return function(t,n,r,i,a,s,o,u,c,l){return e.apply(this,arguments)};default:throw Error("First argument to _arity must be a non-negative integer no greater than ten")}}n.d(e,{Z:function(){return r}})},12092:function(t,e,n){"use strict";n.d(e,{Z:function(){return function t(e,n,a){return function(){for(var s,o=[],u=0,c=e,l=0;l<n.length||u<arguments.length;)l<n.length&&(!(0,i.Z)(n[l])||u>=arguments.length)?s=n[l]:(s=arguments[u],u+=1),o[l]=s,(0,i.Z)(s)||(c-=1),l+=1;return c<=0?a.apply(this,o):(0,r.Z)(c,t(e,o,a))}}}});var r=n(8969),i=n(66508)},1230:function(t,e,n){"use strict";n.d(e,{Z:function(){return a}});var r=n(5272),i=n(88076);function a(t,e,n){return function(){if(0==arguments.length)return n();var a=Array.prototype.slice.call(arguments,0),s=a.pop();if(!(0,r.Z)(s)){for(var o=0;o<t.length;){if("function"==typeof s[t[o]])return s[t[o]].apply(s,a);o+=1}if((0,i.Z)(s))return e.apply(null,a)(s)}return n.apply(this,arguments)}}},5272:function(t,e){"use strict";e.Z=Array.isArray||function(t){return null!=t&&t.length>=0&&"[object Array]"===Object.prototype.toString.call(t)}},27201:function(t,e,n){"use strict";var r=n(93993),i=n(5272),a=n(53459),s=(0,r.Z)(function(t){return!!(0,i.Z)(t)||!(!t||"object"!=typeof t||(0,a.Z)(t))&&(1===t.nodeType?!!t.length:0===t.length||t.length>0&&t.hasOwnProperty(0)&&t.hasOwnProperty(t.length-1))});e.Z=s},53459:function(t,e,n){"use strict";function r(t){return"[object String]"===Object.prototype.toString.call(t)}n.d(e,{Z:function(){return r}})},88076:function(t,e,n){"use strict";function r(t){return null!=t&&"function"==typeof t["@@transducer/step"]}n.d(e,{Z:function(){return r}})},17900:function(t,e,n){"use strict";function r(t,e){for(var n=0,r=e.length,i=Array(r);n<r;)i[n]=t(e[n]),n+=1;return i}n.d(e,{Z:function(){return r}})},85142:function(t,e,n){"use strict";n.d(e,{Z:function(){return c}});var r=n(27201),i=n(71110),a=n(23224);function s(t,e,n){for(var r=n.next();!r.done;){if((e=t["@@transducer/step"](e,r.value))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=n.next()}return t["@@transducer/result"](e)}function o(t,e,n,r){return t["@@transducer/result"](n[r]((0,a.Z)(t["@@transducer/step"],t),e))}var u="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function c(t,e,n){if("function"==typeof t&&(t=(0,i.Z)(t)),(0,r.Z)(n))return function(t,e,n){for(var r=0,i=n.length;r<i;){if((e=t["@@transducer/step"](e,n[r]))&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r+=1}return t["@@transducer/result"](e)}(t,e,n);if("function"==typeof n["fantasy-land/reduce"])return o(t,e,n,"fantasy-land/reduce");if(null!=n[u])return s(t,e,n[u]());if("function"==typeof n.next)return s(t,e,n);if("function"==typeof n.reduce)return o(t,e,n,"reduce");throw TypeError("reduce: list must be array or iterable")}},35643:function(t,e){"use strict";e.Z={init:function(){return this.xf["@@transducer/init"]()},result:function(t){return this.xf["@@transducer/result"](t)}}},71110:function(t,e,n){"use strict";n.d(e,{Z:function(){return i}});var r=function(){function t(t){this.f=t}return t.prototype["@@transducer/init"]=function(){throw Error("init not implemented on XWrap")},t.prototype["@@transducer/result"]=function(t){return t},t.prototype["@@transducer/step"]=function(t,e){return this.f(t,e)},t}();function i(t){return new r(t)}},90178:function(t,e,n){"use strict";var r=(0,n(81353).Z)(function(t,e){for(var n={},r=0;r<t.length;)t[r]in e&&(n[t[r]]=e[t[r]]),r+=1;return n});e.Z=r}},function(t){t.O(0,[5062,7478,9219,5683,9014,3958,2042,9774,2888,179],function(){return t(t.s=50967)}),_N_E=t.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.