Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.173/page_editor/app/utils/useBackgroundImageValue",["module","exports","require","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../services/ImageService","./editable_value/resolveEditableValue"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function useBackgroundImageValue(e,t,r){const o=(0,n.useIsMounted)(),[l,d]=(0,a.useState)({mediaQueries:"",url:(null==t?void 0:t.url)||""});return(0,a.useEffect)((()=>{t&&function loadBackgroundImage(e,t){return(0,i.default)(_objectSpread(_objectSpread({},e||{}),{},{defaultValue:(null==e?void 0:e.url)||""}),null,t).then((e=>{var t;return{fileEntryId:e.fileEntryId||"",url:(null===(t=e.fieldValue)||void 0===t?void 0:t.url)||e.url||e||""}}))}(t,r).then((({fileEntryId:r,url:n})=>function loadBackgroundImageMediaQueries(e,t){if(!e||!(null==t?void 0:t.fileEntryId))return Promise.resolve("");return u.default.getAvailableImageConfigurations({fileEntryId:t.fileEntryId,onNetworkStatus:()=>{}}).then((t=>(null==t?void 0:t.length)?t.filter((e=>e.mediaQuery&&e.url)).map((t=>"@media ".concat(t.mediaQuery," {\n\t\t\t\t\t\t#").concat(e," {\n\t\t\t\t\t\t\tbackground-image: url(").concat(t.url,") !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}"))).join("\n"):""))}(e,_objectSpread(_objectSpread({},t),{},{fileEntryId:r||t.fileEntryId})).then((e=>({mediaQueries:e,url:n}))))).then((e=>{o()&&d(e)}))}),[e,t,o,r]),l};var n=r("@liferay/frontend-js-react-web"),a=r("liferay!frontend-js-react-web$react"),u=_interopRequireDefault(r("../services/ImageService")),i=_interopRequireDefault(r("./editable_value/resolveEditableValue"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(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 _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}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}}}));
//# sourceMappingURL=useBackgroundImageValue.js.map