Liferay.Loader.define("@liferay/feature-flag-web@1.0.12/js/FeatureFlagToggle",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a("@frontend-taglib-clay$clayui/form"),l=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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}var _default=({disabled:e,featureFlagKey:t,inputName:a,labelOff:n,labelOn:o,toggled:i})=>{const[f,u]=(0,l.useState)(e),[d,c]=(0,l.useState)(i);return l.default.createElement(l.default.Fragment,null,l.default.createElement(r.ClayToggle,{disabled:f,id:a,label:d?o:n,onToggle:async function updateToggled(e){u(!0);try{(await Liferay.Util.fetch("/o/com-liferay-feature-flag-web/set-enabled",{body:Liferay.Util.objectToFormData({enabled:e,key:t}),method:"POST"})).ok?c(e):Liferay.Util.openToast({message:Liferay.Language.get("could-not-update-feature-flag"),type:"danger"})}finally{u(!1)}},toggled:d,type:"checkbox"}))};t.default=_default}}));
//# sourceMappingURL=FeatureFlagToggle.js.map