Liferay.Loader.define("journal-web@5.0.114/js/article/AssetDisplayPagePreview",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","frontend-js-web","liferay!frontend-js-react-web$react","./AssetDisplayPageSelector","./PreviewButton"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function AssetDisplayPagePreview({newArticle:e,portletNamespace:t,previewURL:a,saveAsDraftURL:s,selectAssetDisplayPageEventName:c,selectAssetDisplayPageURL:d,selectSiteEventName:f,siteItemSelectorURL:p,sites:g,sitesCount:y}){const[m,b]=(0,i.useState)(),[v,P]=(0,i.useState)(!1),[w,L]=(0,i.useState)(),D="".concat(t,"siteInput"),R=(0,i.useMemo)((()=>[{groupId:0,name:"- ".concat(Liferay.Language.get("not-selected")," -")},...g].map((e=>({label:e.name,onClick:()=>{P(!1),b({groupId:e.groupId,name:e.name}),e.groupId!==(null==m?void 0:m.groupId)&&L(null)}})))),[g,null==m?void 0:m.groupId]);return i.default.createElement(i.default.Fragment,null,i.default.createElement("label",{className:"control-label",htmlFor:D},Liferay.Language.get("site")),i.default.createElement(r.default,{active:v,"aria-labelledby":D,onActiveChange:P,trigger:i.default.createElement(l.default,{className:"bg-light form-control-select text-left w-100",displayType:"secondary",type:"button"},i.default.createElement("span",null,(null==m?void 0:m.name)||"- ".concat(Liferay.Language.get("not-selected")," -")))},R.map((e=>i.default.createElement(r.default.Item,{key:e.label,onClick:e.onClick},e.label))),y>g.length&&i.default.createElement(i.default.Fragment,null,i.default.createElement(r.default.Caption,null,(0,n.sub)(Liferay.Language.get("showing-x-of-x-items"),g.length,y)),i.default.createElement("div",{className:"d-flex w-100"},i.default.createElement(l.default,{className:"flex-grow-1 mx-3",displayType:"secondary",onClick:()=>{(0,n.openSelectionModal)({containerProps:{className:"cadmin"},onSelect(e){b({groupId:e.groupid,name:e.groupdescriptivename})},selectEventName:f,title:Liferay.Language.get("select-site"),url:p})},size:"sm",type:"button"},Liferay.Language.get("more"))))),i.default.createElement(u.default,{assetDisplayPageSelected:w,disabled:!m,namespace:t,selectAssetDisplayPageEventName:c,selectAssetDisplayPageURL:d,selectedSite:m,setAssetDisplayPageSelected:L}),i.default.createElement(o.default,{disabled:!w,getPreviewURL:({classPK:e,version:t})=>(0,n.createPortletURL)(a,{classPK:e,selPlid:null==w?void 0:w.plid,version:t}).toString(),namespace:t,newArticle:e,saveAsDraftURL:s}))};var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/drop-down")),n=a("frontend-js-web"),i=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")),u=_interopRequireDefault(a("./AssetDisplayPageSelector")),o=_interopRequireDefault(a("./PreviewButton"));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}}}}));
//# sourceMappingURL=AssetDisplayPagePreview.js.map