import{O as e,m as n,B as s,T as o,n as l,o as t,q as r,r as a,s as i,y as d,z as c,g as f}from"../../vendor.js";import{useRef as u}from"react";import{u as p}from"../../hooks.js";import{o as m}from"./index.options.js";import{s as b}from"./index.settings.js";import{C as j}from"../Catalogue/index.js";import{D as x}from"../Droppable/index.js";import{E as v}from"../Element/index.js";import{T as h}from"../Text/index.js";var g=["element"];function L(e,n){var s=d(e);if(c){var o=c(e);n&&(o=f(o).call(o,(function(n){return i(e,n).enumerable}))),s.push.apply(s,o)}return s}function M(e){for(var n=1;n<arguments.length;n++){var s=null!=arguments[n]?arguments[n]:{};n%2?L(Object(s),!0).forEach((function(n){l(e,n,s[n])})):t?r(e,t(s)):L(Object(s)).forEach((function(n){a(e,n,i(s,n))}))}return e}var k=function(l){var t,r,a,i=l.element,d=e(l,g),c=p(),f=c.moveElement,m=c.addElement,b=c.getText,L=u(),k=function(e,n,s){var o,l,t=(null===(o=s.construct)||void 0===o?void 0:o.call(s))||{};null==m||m(M(M({},t),{},{content:"function"==typeof t.content?t.content(b):t.content}),{parent:e,position:n}),null===(l=L.current)||void 0===l||l.close()},A=function(e,n,s){var o;m(s,{parent:e,position:n,normalizeOptions:{resetIds:!0}}),null===(o=L.current)||void 0===o||o.close()},N=function(e,n){f(n,i,{parent:e,position:"before"})};return n.jsxs("div",M(M({},o(d,["builder"])),{},{children:[n.jsx("div",{className:"oak-foldable-section-title",children:n.jsx(h,{name:"core.components.foldable.sectionsTitle.seeMore",default:"Label when collapsed"})}),n.jsx(x,{disabled:i.seeMore.length>0,onDrop:N.bind(null,i.seeMore),children:n.jsx("div",{className:"oak-foldable-content",children:null!=i&&i.seeMore.length?n.jsxs(n.Fragment,{children:[n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeMore,"before"),onPaste:A.bind(null,i.seeMore,"before")}),null==i||null===(t=i.seeMore)||void 0===t?void 0:s(t).call(t,(function(e){return n.jsx(v,{element:e,parent:i.seeMore},e.id)})),n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeMore,"after"),onPaste:A.bind(null,i.seeMore,"after")})]}):n.jsx("div",{className:"oak-foldable-content-empty",children:n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeMore,"after"),onPaste:A.bind(null,i.seeMore,"after")})})})}),n.jsx("div",{className:"oak-foldable-section-title",children:n.jsx(h,{name:"core.components.foldable.sectionsTitle.seeLess",default:"Label when expanded"})}),n.jsx(x,{disabled:i.seeLess.length>0,onDrop:N.bind(null,i.seeLess),children:n.jsx("div",{className:"oak-foldable-content",children:null!=i&&i.seeLess.length?n.jsxs(n.Fragment,{children:[n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeLess,"before"),onPaste:A.bind(null,i.seeLess,"before")}),null==i||null===(r=i.seeLess)||void 0===r?void 0:s(r).call(r,(function(e){return n.jsx(v,{element:e,parent:i.seeLess},e.id)})),n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeLess,"after"),onPaste:A.bind(null,i.seeLess,"after")})]}):n.jsx("div",{className:"oak-foldable-content-empty",children:n.jsx(j,{ref:L,onAppend:k.bind(null,i.seeLess,"after"),onPaste:A.bind(null,i.seeLess,"after")})})})}),n.jsx("div",{className:"oak-foldable-section-title",children:n.jsx(h,{name:"core.components.foldable.sectionsTitle.content",default:"Content"})}),n.jsx(x,{disabled:i.content.length>0,onDrop:N.bind(null,i.content),children:n.jsx("div",{className:"oak-foldable-content",children:null!=i&&i.content.length?n.jsxs(n.Fragment,{children:[n.jsx(j,{ref:L,onAppend:k.bind(null,i.content,"before"),onPaste:A.bind(null,i.content,"before")}),null==i||null===(a=i.content)||void 0===a?void 0:s(a).call(a,(function(e){return n.jsx(v,{element:e,parent:i.content},e.id)})),n.jsx(j,{ref:L,onAppend:k.bind(null,i.content,"after"),onPaste:A.bind(null,i.content,"after")})]}):n.jsx("div",{className:"oak-foldable-content-empty",children:n.jsx(j,{ref:L,onAppend:k.bind(null,i.content,"after"),onPaste:A.bind(null,i.content,"after")})})})})]}))};k.options=m,k.settings=b;var A=k;export{A as F};
//# sourceMappingURL=index.js.map
