import{O as n,m as e,P as a,B as o,A as r,n as l,o as t,q as s,r as i,s as c,y as d,z as f,g as u}from"../../vendor.js";import{useRef as p}from"react";import{E as m}from"../Element/index.js";import{C as v}from"../Catalogue/index.js";var b=["content","title","className","onDropElement","onAppend","onPaste"];function j(n,e){var a=d(n);if(f){var o=f(n);e&&(o=u(o).call(o,(function(e){return c(n,e).enumerable}))),a.push.apply(a,o)}return a}function h(n){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?j(Object(a),!0).forEach((function(e){l(n,e,a[e])})):t?s(n,t(a)):j(Object(a)).forEach((function(e){i(n,e,c(a,e))}))}return n}var x=function(l){var t=l.content,s=void 0===t?[]:t,i=l.title,c=l.className,d=l.onDropElement,f=l.onAppend,u=l.onPaste,j=n(l,b),x=p(),g=function(){var n;null===(n=x.current)||void 0===n||n.close();for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];null==f||f.apply(void 0,a)},A=function(){var n;null===(n=x.current)||void 0===n||n.close();for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];null==u||u.apply(void 0,a)};return e.jsxs("div",h(h({className:r("oak-foldable-section",c)},j),{},{children:[e.jsx("div",{className:"oak-foldable-section-title",children:i}),e.jsx(a,{disabled:s.length>0,onDrop:d,children:e.jsx("div",{className:"oak-foldable-section-content",children:s.length?e.jsxs(e.Fragment,{children:[e.jsx(v,{ref:x,onAppend:g.bind(null,"before"),onPaste:A.bind(null,"before")}),o(s).call(s,(function(n){return e.jsx(m,{element:n,parent:s},n.id)})),e.jsx(v,{ref:x,onAppend:g.bind(null,"after"),onPaste:A.bind(null,"after")})]}):e.jsx("div",{className:"oak-foldable-section-content-empty",children:e.jsx(v,{ref:x,onAppend:g.bind(null,"after"),onPaste:A.bind(null,"after")})})})})]}))};export{x as S};
//# sourceMappingURL=Section.js.map
