Liferay.Loader.define('document-library-web@5.0.156/document_library/js/dataEngineLayoutRendererLanguageProxy.es', ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = dataEngineLayoutRendererLanguageProxy;

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    function onLocaleChange(layoutRendererInstance, event) {
      var selectedLanguageId = event.item.getAttribute('data-value');
      var current = layoutRendererInstance.reactComponentRef.current;

      if (current) {
        current.updateEditingLanguageId({
          editingLanguageId: selectedLanguageId
        });
      }
    }

    function dataEngineLayoutRendererLanguageProxy(props) {
      var _this = this;

      var localeChangedHandler = null;
      Liferay.componentReady(props.namespace + 'dataEngineLayoutRenderer').then(function (event) {
        localeChangedHandler = Liferay.after('inputLocalized:localeChanged', onLocaleChange.bind(_this, event));
      });

      function destroyInstance(_event) {
        if (localeChangedHandler) {
          localeChangedHandler.detach();
        }

        Liferay.detach('destroyPortlet', destroyInstance);
      }

      Liferay.on('destroyPortlet', destroyInstance);
    }
    //# sourceMappingURL=dataEngineLayoutRendererLanguageProxy.es.js.map
  }
});
//# sourceMappingURL=dataEngineLayoutRendererLanguageProxy.es.js.map