Liferay.Loader.define("commerce-product-options-web@4.0.48/js/add_cp_option_value",["module","exports","require","commerce-frontend-js/ServiceProvider/index","commerce-frontend-js/utilities/modals/index","commerce-frontend-js/utilities/slugify","frontend-js-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({cpOptionId:e,defaultLanguageId:t,editOptionURL:r,namespace:u,windowState:d}){const c=document.getElementById(u+"fm"),l=c.querySelector("#"+u+"key"),f=c.querySelector("#"+u+"name"),p=c.querySelector("#"+u+"priority");f.addEventListener("input",(0,a.debounce)((()=>{l.value=(0,o.default)(f.value)}),200));const s=i.default.AdminCatalogAPI("v1");Liferay.provide(window,u+"apiSubmit",(()=>{n.isSubmitting();const i={id:"",key:"",name:{},priority:0};i.key=l.value,i.name[t]=f.value,i.id=e,i.priority=p.value,s.createOptionValue(e,i).then((()=>{const t=new Liferay.PortletURL.createURL(r);t.setParameter("p_p_state",d),t.setParameter("cpOptionId",e),n.closeAndRedirect(t)})).catch(n.onSubmitFail)}),["liferay-portlet-url"])};var i=_interopRequireDefault(r("commerce-frontend-js/ServiceProvider/index")),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 o=i?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("commerce-frontend-js/utilities/modals/index")),o=_interopRequireDefault(r("commerce-frontend-js/utilities/slugify")),a=r("frontend-js-web");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}}}}));
//# sourceMappingURL=add_cp_option_value.js.map