Liferay.Loader.define("@liferay/content-dashboard-web@2.0.85/js/components/SidebarPanelInfoView/VersionsContent",["module","exports","require","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/link","@frontend-taglib-clay$clayui/loading-indicator","frontend-js-web","liferay!frontend-js-react-web$react","./VersionActions","./utils/formatDate"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/link")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/loading-indicator")),i=a("frontend-js-web"),o=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 l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),u=_interopRequireDefault(a("./VersionActions")),c=_interopRequireDefault(a("./utils/formatDate"));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}}var _default=({active:e,getItemVersionsURL:t,languageTag:a="en",onError:f})=>{const[s,d]=(0,o.useState)(!1),g=(0,o.useRef)(!1),[y,p]=(0,o.useState)({versions:[],viewVersionsURL:""}),m=(0,o.useCallback)((async()=>{try{d(!0);const e=await(0,i.fetch)(t);if(!e.ok)throw new Error("Failed to fetch ".concat(t));const a=await e.json();p(a),g.current=!0}catch(e){f()}finally{d(!1)}}),[t,f]);(0,o.useEffect)((()=>{e&&!g.current&&m()}),[e,m]);const{versions:b,viewVersionsURL:v}=y;return o.default.createElement(o.default.Fragment,null,s?o.default.createElement("div",{className:"align-items-center d-flex loading-indicator-wrapper"},o.default.createElement(l.default,{small:!0})):o.default.createElement(o.default.Fragment,null,o.default.createElement("ul",{className:"list-group sidebar-list-group"},b.map((({actions:e,changeLog:t,createDate:n,userName:l,version:f})=>o.default.createElement("li",{className:"list-group-item list-group-item-flex p-0",key:f},o.default.createElement(r.default.ContentCol,{expand:!0},o.default.createElement("div",{className:"list-group-title"},Liferay.Language.get("version")+" ",f),o.default.createElement("div",{className:"list-group-subtitle"},(0,i.sub)(Liferay.Language.get("x-by-x"),[(0,c.default)(n,a),l])),o.default.createElement("div",{className:"list-group-subtext"},t||Liferay.Language.get("no-change-log"))),e&&!!e.length&&o.default.createElement(u.default,{actions:e}))))),v&&o.default.createElement("div",{className:"d-flex justify-content-center"},o.default.createElement(n.default,{button:!0,className:"mt-3",displayType:"secondary",href:v},Liferay.Language.get("view-more")))))};t.default=_default}}));
//# sourceMappingURL=VersionsContent.js.map