Liferay.Loader.define("commerce-frontend-js@4.0.52/components/dropdown/Dropdown",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utilities/eventsDefinitions","../../utilities/index","../../utilities/modals/index","../modal/Modal"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=m(n("@frontend-taglib-clay$clayui/button")),a=m(n("@frontend-taglib-clay$clayui/drop-down")),l=m(n("@frontend-taglib-clay$clayui/icon")),o=n("frontend-js-web"),i=(m(n("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=r?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react"))),u=n("../../utilities/eventsDefinitions"),d=n("../../utilities/index"),f=n("../../utilities/modals/index"),c=m(n("../modal/Modal"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function m(e){return e&&e.__esModule?e:{default:e}}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var y=function(e){const[t,n]=(0,i.useState)(!1),[s]=(0,i.useState)("support-modal-"+(0,d.getRandomId)());if(!e.items||!e.items.length)return null;const m=(0,d.sortByKey)(e.items,"order");return i.default.createElement(a.default,{active:t,onActiveChange:n,trigger:i.default.createElement(r.default,{className:"component-action dropdown-toggle",displayType:"unstyled"},i.default.createElement(l.default,{symbol:"ellipsis-v"}))},i.default.createElement(c.default,{id:s}),i.default.createElement(a.default.ItemList,null,i.default.createElement(a.default.Group,null,m.map(((e,t)=>{const r="modal"===e.target||"submitWithConfirmation"===e.target?{onClick:t=>(t.preventDefault(),n(!1),function({data:e,label:t,target:n,url:r}){"submitWithConfirmation"===n?(0,o.openConfirmModal)({message:(null==e?void 0:e.confirmationMessage)||"",onConfirm:t=>{t&&((null==e?void 0:e.formId)?submitForm(document.getElementById(e.formId)):(0,d.liferayNavigate)(r))},title:t}):n.includes("modal")&&Liferay.fire(u.OPEN_MODAL,{closeOnSubmit:!0,id:s,size:(0,f.resolveModalSize)(n),url:r})}({data:e.data,label:e.label,target:e.target,url:e.href}))}:{"data-senna-off":!0,href:e.href};return i.default.createElement(a.default.Item,p({key:t},r),e.icon&&i.default.createElement("span",{className:"pr-2"},i.default.createElement(l.default,{symbol:e.icon})),e.label)})))))};t.default=y}}));
//# sourceMappingURL=Dropdown.js.map