Liferay.Loader.define("@liferay/search-experiences-web@3.0.30/sxp_blueprint_admin/js/shared/ErrorListItem",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/layout","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../utils/testIds"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/alert")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/button")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),l=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),o=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),u=a("../utils/testIds");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(a,n,i):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e={advanced_configuration:Liferay.Language.get("advanced-configuration"),aggregation_configuration:Liferay.Language.get("aggregation-configuration"),highlight_configuration:Liferay.Language.get("highlight-configuration"),parameter_configuration:Liferay.Language.get("parameter-configuration"),query_configuration:Liferay.Language.get("query-configuration"),sort_configuration:Liferay.Language.get("sort-configuration"),sxpElementTemplateJSON:Liferay.Language.get("element-template"),uiConfigurationJSON:Liferay.Language.get("ui-configuration")},s=["className","sxpElementId","localizedMessage","msg","throwable","severity"],f={ERROR:"danger",INFO:"info",WARN:"warning"};function getTextCSSClass(e){return"text-"+(f[e]||"danger")}var c=function ErrorListItem({error:t,onFocusSXPElement:a}){const[c,g]=(0,o.useState)(!0),_handleCollapse=()=>{g(!c)},_isCollapsible=()=>Object.keys(t).some((e=>t[e]&&!s.includes(e)));return o.default.createElement(r.default,{className:(0,l.default)("error-list-item",{collapsible:_isCollapsible()}),"data-testid":u.TEST_IDS.ERROR_LIST_ITEM,displayType:f[t.severity]||"danger"},o.default.createElement("span",{className:"message",onClick:_handleCollapse},o.default.createElement("span",{className:"title"},t.localizedMessage||Liferay.Language.get("error")),t.msg&&o.default.createElement("span",{className:"description"},(()=>{const a=function getConfigurationFieldName(t){const a=Object.keys(e).find((e=>null==t?void 0:t.includes(e)));return a?e[a]:""}(t.rootProperty);return a?"".concat(t.msg," (").concat(a,")"):t.msg})())),!!t.sxpElementId&&o.default.createElement("div",{className:"scroll-button"},o.default.createElement(n.default,{alert:!0,onClick:()=>{a(t.sxpElementId)},small:!0},Liferay.Language.get("view-element"))),_isCollapsible()&&o.default.createElement(n.ClayButtonWithIcon,{"aria-label":c?Liferay.Language.get("expand"):Liferay.Language.get("collapse"),borderless:!0,className:(0,l.default)("collapse-button",getTextCSSClass(t.severity)),displayType:"unstyled",onClick:_handleCollapse,small:!0,symbol:c?"angle-right":"angle-down"}),!c&&_isCollapsible()&&o.default.createElement(r.default.Footer,null,Object.keys(t).map((e=>t[e]&&!s.includes(e)&&o.default.createElement(i.default.Row,{justify:"start",key:e},o.default.createElement(i.default.Col,{className:"property",size:3},e),o.default.createElement(i.default.Col,{size:9},o.default.createElement("code",{className:getTextCSSClass(t.severity)},"object"==typeof t[e]?function prettyPrint(e){return JSON.stringify(e,null,2)}(t[e]):t[e])))))))};t.default=c}}));
//# sourceMappingURL=ErrorListItem.js.map