Liferay.Loader.define("commerce-frontend-taglib@19.1.14/user_utils/UserListItem.es",["module","exports","require","frontend-js-metal-web$metal-component","frontend-js-metal-web$metal-soy","./UserListItem.soy","../autocomplete_item/AutocompleteItem.es","../add_to_tick_item/AddToTickItem.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.UserListItem=void 0;var i=_interopRequireDefault(r("frontend-js-metal-web$metal-component")),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=i?Object.getOwnPropertyDescriptor(e,n):null;s&&(s.get||s.set)?Object.defineProperty(r,n,s):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("frontend-js-metal-web$metal-soy")),s=_interopRequireDefault(r("./UserListItem.soy"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r("../autocomplete_item/AutocompleteItem.es"),r("../add_to_tick_item/AddToTickItem.es");const e=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;class UserListItem extends i.default{attached(){return this._updateStatus()}willUpdate(){return this._updateStatus()}syncAddedUsers(){this._invited=this.addedUsers.reduce(((e,t)=>e||t.email===this.email),!1)}_updateStatus(){return this.userId?this._status="valid":this.email.indexOf("@")<0?this._status="user-not-found":e.test(this.email)?this._status="valid":this._status="email-not-valid",this._status}_handleToggleInvitation(e){return e.preventDefault(),this.emit("toggleInvitation",function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({email:this.email},this.userId?{name:this.name,thumbnail:this.thumbnail,userId:this.userId}:{}))}}t.UserListItem=UserListItem,n.default.register(UserListItem,s.default),UserListItem.STATE={_invited:n.Config.bool().value(!1),_status:n.Config.string().value("valid"),addedUsers:n.Config.array(n.Config.shapeOf({email:n.Config.string()})).value([]),email:n.Config.string().required(),name:n.Config.string(),query:n.Config.string(),thumbnail:n.Config.string(),userId:n.Config.oneOfType([n.Config.string(),n.Config.number()])};var o=UserListItem;t.default=o}}));
//# sourceMappingURL=UserListItem.es.js.map