Liferay.Loader.define("style-book-web@2.0.76/js/style-book-editor/Toolbar",["module","exports","require","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","@frontend-taglib-clay$clayui/popover","liferay!frontend-js-react-web$classnames","frontend-js-web","liferay!frontend-js-react-web$react","./PreviewSelector","./PublishButton","./Undo","./UndoHistory","./constants/draftStatusConstants","./contexts/LayoutContext","./contexts/StyleBookEditorContext"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/popover")),o=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),u=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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var r=n?Object.getOwnPropertyDescriptor(e,l):null;r&&(r.get||r.set)?Object.defineProperty(a,l,r):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),c=_interopRequireDefault(a("./PreviewSelector")),s=_interopRequireDefault(a("./PublishButton")),f=_interopRequireDefault(a("./Undo")),d=_interopRequireDefault(a("./UndoHistory")),m=a("./constants/draftStatusConstants"),y=a("./contexts/LayoutContext"),b=a("./contexts/StyleBookEditorContext");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 e={[m.DRAFT_STATUS.draftSaved]:Liferay.Language.get("saved"),[m.DRAFT_STATUS.notSaved]:"",[m.DRAFT_STATUS.saving]:"".concat(Liferay.Language.get("saving"),"...")};var p=i.default.memo((function Toolbar(){const e=(0,y.usePreviewLayout)();return i.default.createElement("div",{className:"management-bar navbar style-book-editor__toolbar"},i.default.createElement(l.default.ContainerFluid,null,i.default.createElement("ul",{className:"navbar-nav start"},(null==e?void 0:e.url)&&i.default.createElement("li",{className:"nav-item"},i.default.createElement("span",{className:"style-book-editor__page-preview-text"},"".concat(Liferay.Language.get("preview"))),i.default.createElement(c.default,null))),i.default.createElement("ul",{className:"end navbar-nav"},i.default.createElement("li",{className:"mr-2 nav-item"},i.default.createElement(DraftStatus,null)),i.default.createElement("li",{className:"nav-item"},i.default.createElement(f.default,null)),i.default.createElement("li",{className:"nav-item"},i.default.createElement(d.default,null)),i.default.createElement("li",{className:"mx-2 nav-item"},i.default.createElement(HelpInformation,null)),i.default.createElement("li",{className:"ml-2 nav-item"},i.default.createElement(s.default,null)))))}));function DraftStatus(){const t=(0,b.useDraftStatus)();return i.default.createElement("div",null,i.default.createElement("span",{className:(0,o.default)("mx-1 style-book-editor__status-text",{"text-success":t===m.DRAFT_STATUS.draftSaved})},e[t]),t===m.DRAFT_STATUS.draftSaved&&i.default.createElement(n.default,{className:"mx-1 style-book-editor__status-icon",symbol:"check-circle"}))}function HelpInformation(){const[e,t]=(0,i.useState)(!1),a=(0,i.useRef)(null),l=(0,i.useRef)(null);return(0,i.useLayoutEffect)((()=>{e&&(0,u.align)(a.current,l.current,u.ALIGN_POSITIONS.Bottom,!1)}),[e]),i.default.createElement("span",{className:"d-block text-secondary"},i.default.createElement(n.default,{onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),ref:l,symbol:"question-circle"}),e&&i.default.createElement(r.default,{alignPosition:"bottom",header:Liferay.Language.get("help-information"),ref:a},Liferay.Language.get("edit-the-style-book-using-the-sidebar-form.-you-can-preview-the-changes-instantly")))}t.default=p}}));
//# sourceMappingURL=Toolbar.js.map