Liferay.Loader.define("@liferay/search-experiences-web@3.0.30/sxp_blueprint_admin/js/edit_sxp_blueprint/preview_sidebar/ResultListItem",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/list","liferay!frontend-js-react-web$classnames","liferay!search-experiences-web$moment","liferay!frontend-js-react-web$react","../../shared/PreviewModal","../../shared/ThemeContext"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/list")),u=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),c=_interopRequireDefault(a("liferay!search-experiences-web$moment")),d=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={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),o=a("../../shared/PreviewModal"),f=_interopRequireDefault(a("../../shared/ThemeContext"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const getResultDefaultKeys=e=>["entryClassName","content_".concat(e),"createDate","modified","userName"],e=["assetEntryId"],m=["birthDate","createDate","modified"],y=700,p=new RegExp("^(".concat("_",")"));var s=function ResultListItem({explanation:t="",fields:a,id:s,score:g=0}){const{locale:b}=(0,d.useContext)(f.default),[_,h]=(0,d.useState)(!0),_renderListRow=(e,t)=>t&&d.default.createElement(n.default.Row,{justify:"start",key:e},d.default.createElement(n.default.Col,{className:"semibold",size:4},function removeSXPBlueprintFieldPrefix(e){return e.replace(p,"")}(e)),d.default.createElement(n.default.Col,{className:(0,u.default)({"text-truncate":_}),size:8},function truncateString(e){return e.length>y?e.substring(0,y).concat("..."):e}(function localizeDate(e,t){return m.includes(e)?(0,c.default)((0,c.default)(t,"YYYYMMDDHHmmss")).locale(Liferay.ThemeDisplay.getBCP47LanguageId()||"en-US").format("lll"):t}(e,t))));return d.default.createElement(i.default.Item,{className:"result-list-item",flex:!0,key:s},d.default.createElement(i.default.ItemField,null,d.default.createElement(o.PreviewModalWithCopyDownload,{fileName:"score_explanation.json",size:"lg",text:t,title:Liferay.Language.get("score-explanation")},d.default.createElement(l.default,{className:"score",displayType:"unstyled",small:!0},g.toFixed(2)))),d.default.createElement(i.default.ItemField,{expand:!0},d.default.createElement(i.default.ItemTitle,null,a.assetTitle||s),getResultDefaultKeys(b).map((e=>_renderListRow(e,a[e]))),!_&&d.default.createElement(d.default.Fragment,null,e.map((e=>_renderListRow(e,a[e]))),d.default.createElement("div",{className:"list-group-header"},d.default.createElement("span",{className:"list-group-header-title"},Liferay.Language.get("document-fields"))),Object.keys(a).sort().map((e=>_renderListRow(e,a[e]))))),d.default.createElement(i.default.ItemField,null,d.default.createElement(l.default,{"aria-label":_?Liferay.Language.get("expand"):Liferay.Language.get("collapse"),displayType:"unstyled",onClick:()=>h(!_)},d.default.createElement(r.default,{symbol:_?"angle-right":"angle-down"}))))};t.default=s}}));
//# sourceMappingURL=ResultListItem.js.map