this.nisje=this.nisje||{},this.nisje.avatar=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=526)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},12:function(e,t,r){var n;
/*!
  Copyright (c) 2017 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)&&n.length){var i=a.apply(null,n);i&&e.push(i)}else if("object"===c)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},19:function(e,t){!function(){e.exports=this.wp.data}()},3:function(e,t){!function(){e.exports=this.lodash}()},31:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},47:function(e,t){!function(){e.exports=this.nisje.data}()},48:function(e,t){!function(){e.exports=this.wp.dataControls}()},5:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},526:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"receiveAvatar",(function(){return p}));var a={};r.r(a),r.d(a,"getAvatar",(function(){return j}));var c={};r.r(c),r.d(c,"getAvatar",(function(){return m})),r.d(c,"avatar",(function(){return O}));var i=r(48),o=r(19),s=r(5),u=r(47);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v=Object(u.onSubKey)("context")((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"RECEIVE_AVATAR":return f({},e,Object(s.a)({},t.id,t.sources));default:return e}}));function p(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"members";return{type:"RECEIVE_AVATAR",id:e,context:r,sources:t}}var d=r(31),b=r.n(d),h=b.a.mark(j);function j(e){var t,r,n=arguments;return b.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return t=n.length>1&&void 0!==n[1]?n[1]:"members",a.next=3,Object(i.apiFetch)({path:"/buddypress/v1/".concat(t,"/").concat(e,"/avatar")});case 3:if(r=a.sent,!Array.isArray(r)||0===r.length){a.next=9;break}return a.next=7,p(e,r[0].full,t);case 7:a.next=11;break;case 9:return a.next=11,p(e,"fallback",t);case 11:case"end":return a.stop()}}),h)}var g=r(3);function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"members";return Object(g.get)(e[r],t,!1)}var O=m,y=(Object(o.registerStore)("nisje/avatar",{reducer:v,controls:i.controls,actions:n,selectors:c,resolvers:a}),r(0)),x=r(12),w=r.n(x),A=r(1);var E=function(e){var t=e.size,r=e.name;return Object(y.createElement)("svg",{viewBox:"0 0 150 150",role:"img","aria-hidden":!0,focusable:!1,height:t,width:t},Object(y.createElement)("rect",{width:"100%",height:"100%",className:"nisje-avatar__fill"}),Object(y.createElement)("text",{className:"nisje-avatar__text",dominantBaseline:"middle",fontSize:"50px",fontWeight:"600",textAnchor:"middle",x:"50%",y:"79"},r.replace(/[^a-zA-Z]+/g,"").substring(0,2).toUpperCase()))};var _=function(e){var t=e.size;return Object(y.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 150 150",role:"img","aria-hidden":!0,focusable:!1,height:t,width:t},Object(y.createElement)("path",{fill:"#d9edfb",d:"M0 0h150v150H0z"}),Object(y.createElement)("circle",{cx:"75",cy:"58",r:"33",fill:"#006db5"}),Object(y.createElement)("path",{fill:"#006db5",d:"M145.8 150c-2.6-35.6-33.3-50-70.8-50S6.8 114.4 4.2 150h141.6z"}))};var P=function(e){var t=e.className,r=e.context,n=e.id,a=e.name,c=void 0===a?"":a,i=e.size,s=void 0===i?150:i,u=e.src,l=w()("nisje-avatar",t),f={height:"".concat(s,"px"),width:"".concat(s,"px")},v=Object(o.useDispatch)("nisje/avatar").receiveAvatar;u&&v(n,u,r);var p=Object(o.useSelect)((function(e){var t=e("nisje/avatar"),a=t.avatar,c=t.getAvatar,i=a(n,r);return i||(i=c(n,r)),i}),[n]);if(!p)return Object(y.createElement)("div",{className:"".concat(l," nisje-avatar__loader"),style:f});if("fallback"!==p)return Object(y.createElement)("img",{alt:Object(A.__)("Avatar"),className:l,height:"".concat(s,"px"),src:p,style:f,width:"".concat(s,"px")});var d=String(n),b=d.charAt(d.length-1),h="groups"===r?E:_;return Object(y.createElement)("div",{className:"".concat(l," nisje-avatar__color--").concat(b),style:f},Object(y.createElement)(h,{name:c,size:s}))};t.default=P}});