import{j as e,A as n,w as o,x as t,k as s,l as r,m as a,n as c,o as i,t as l,u as d,f as u}from"../../vendor.js";import{useRef as p}from"react";import{u as x,a as f}from"../../hooks.js";import{E as m}from"../Element/index.js";import{C as j}from"../Catalogue/index.js";import{I as v}from"../Icon/index.js";function h(e,n){var o=l(e);if(d){var t=d(e);n&&(t=u(t).call(t,(function(n){return i(e,n).enumerable}))),o.push.apply(o,t)}return o}function b(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?h(Object(o),!0).forEach((function(n){s(e,n,o[n])})):r?a(e,r(o)):h(Object(o)).forEach((function(n){c(e,n,i(o,n))}))}return e}var k=function(){var s=p(),r=x(),a=r.components,c=r.content,i=r.addElement,l=r._setSettingsHolderRef,d=r.undo,u=r.redo,h=r.isUndoPossible,k=r.isRedoPossible,g=r.getText,C=r.getOverrides,E=f(),y=E.debug,N=E.historyButtonsEnabled;return e.exports.jsxs("div",{className:"oak-builder",children:[!1!==N&&e.exports.jsxs("div",{className:"oak-undo-redo",children:[e.exports.jsx("a",{onClick:function(){return h&&d()},className:n("oak-undo",!h&&"disabled"),children:e.exports.jsx(v,{children:"undo"})}),e.exports.jsx("a",{onClick:function(){return k&&u()},className:n("oak-redo",!k&&"disabled"),children:e.exports.jsx(v,{children:"redo"})})]}),o(c).call(c,(function(n,o){return e.exports.jsx(m,{index:o,element:n},n.id||o)})),e.exports.jsx("div",{className:"oak-add-element",children:e.exports.jsx(j,{ref:s,onAppend:function(e){var n,o,t=(null===(n=e.construct)||void 0===n?void 0:n.call(e))||{},r=C("component",t.type),a=b(b({},t),{},{content:"function"==typeof t.content?t.content(g):t.content});i(b(b({},a),null!=r&&r.construct&&"function"==typeof r.construct?r.construct(a):{})),null===(o=s.current)||void 0===o||o.close()},onPaste:function(e){var n;i(e,{normalizeOptions:{resetIds:!0}}),null===(n=s.current)||void 0===n||n.close()}})}),e.exports.jsx("div",{ref:l}),y&&e.exports.jsxs("pre",{children:[e.exports.jsx("p",{children:"Content:"}),t(c,null,2),e.exports.jsx("p",{children:"Components:"}),t(a,null,2)]})]})};export{k as B};
//# sourceMappingURL=index.js.map
