AUI.add("liferay-logo-selector",(e=>{const o=e.Lang,t="DELETE_LOGO",a={src:t},l=e.Component.create({ATTRS:{defaultLogo:{value:!1},defaultLogoURL:{value:""},editLogoFn:{setter(e){let t=function fn(){};return o.isFunction(window[e])&&(t=window[e]||t),t},validator:e.Lang.isString,value:""},editLogoURL:{value:""},logoDisplaySelector:{value:""},logoURL:{value:""},portletNamespace:{value:""},randomNamespace:{value:""}},BIND_UI_ATTRS:["logoURL"],NAME:"logoselector",prototype:{_changeLogo(e,o){const t=this;e=Liferay.Util.addParams("t="+Date.now(),e),t.set("logoURL",e),o&&t._fileEntryIdInput.val(o)},_onDeleteLogoClick(){const e=this;e.set("logoURL",e.get("defaultLogoURL"),a),e._emptyResultMessage&&e._emptyResultMessage.show()},_openEditLogoWindow(e){const o=this.get("editLogoURL");Liferay.Util.openWindow({cache:!1,dialog:{destroyOnHide:!0},dialogIframe:{bodyCssClass:"dialog-with-footer"},id:this._portletNamespace+"changeLogo",title:Liferay.Language.get("upload-image"),uri:o}),e.preventDefault()},_uiSetLogoURL(o,a){const l=this,n=o,s=l.get("logoDisplaySelector"),g=a===t,i=l.get("defaultLogo");if(l._avatar.attr("src",n),s){const o=e.one(s);o&&o.attr("src",n)}l.get("editLogoFn").apply(l,[n,g]),l._deleteLogoInput.val(g),l._deleteLogoButton.attr("disabled",g||i?"disabled":""),l._deleteLogoButton.toggleClass("disabled",g),l._emptyResultMessage&&l._emptyResultMessage.hide()},bindUI(){const e=this;e.get("contentBox").delegate("click",e._openEditLogoWindow,".edit-logo",e),e.get("contentBox").delegate("click",e._onDeleteLogoClick,".delete-logo",e)},initializer(){const o=this;o._portletNamespace=o.get("portletNamespace"),o._randomNamespace=o.get("randomNamespace"),window[o._randomNamespace+"changeLogo"]=e.bind("_changeLogo",o)},renderUI(){const e=this,o=e._portletNamespace,t=e._randomNamespace,a=e.get("contentBox");e._avatar=a.one("#"+t+"avatar"),e._deleteLogoButton=a.one(".delete-logo"),e._deleteLogoInput=a.one("#"+o+"deleteLogo"),e._emptyResultMessage=a.one("#"+t+"emptyResultMessage"),e._fileEntryIdInput=a.one("#"+o+"fileEntryId")}}});Liferay.LogoSelector=l}),"",{requires:["aui-base","liferay-util-window"]});
//# sourceMappingURL=logo_selector.js.map