import{useMemo as e,cloneElement as i}from"react";import r from"prop-types";import{SizeMe as t}from"react-sizeme";import{Collapse as n}from"@material-ui/core";import{useComonentsWidth as l,useFilterLayout as a}from"./effects/index.js";import{getAppTitle as d,getAppSubTitle as o,getExpander as c,getOffsetPicker as s,getSecondaryAsset as m,getModeSelect as h,getPadChip as p,getPrimaryAsset as u,getOffsetWellsChip as f}from"./utils.js";import{LARGE_SIZE_LAYOUT as v,MEDIUM_SIZE_LAYOUT as y,SMALL_SIZE_LAYOUT as N}from"./constants.js";import O from"./HeaderLayout.css.js";import{jsx as g,jsxs as j,Fragment as C}from"react/jsx-runtime";function T(e,r){var t,n,l,a;return e===N&&r?i(r,r.props,(t=r.props.children,n=t.split(" "),l=t[0],a=n[n.length-1],"".concat(l," ").concat(a))):r}function W(i){var r=i.children,t=i.appWidth,W=l(r),w=W.componentsWidth,L=W.hiddenElements,R=a(r,w,t),q=d(r),x=o(r),S=c(r),k=s(r),z=m(r),B=h(r),E=p(r),H=u(r),b=f(r),A=e((function(){return T(R,H)}),[R,H]),D=e((function(){return T(R,E)}),[R,E]);return j("div",{style:{width:"100%"},children:[g(n,{timeout:10,in:R===v,children:j("div",{className:O.layoutContainer,children:[j("div",{className:O.layoutTopLarge,children:[g("div",{children:q}),j("div",{className:O.layoutTopRightLarge,children:[z,B,j("div",{className:O.layoutOffsetpicker,children:[S,k]}),E,H]})]}),g("div",{children:x}),g("div",{className:O.layoutOffsetwellChipsLarge,children:b})]})}),g(n,{timeout:10,in:[y,N].includes(R),children:j("div",{className:O.layoutContainer,children:[j("div",{className:O.layoutTopSmall,children:[g("div",{children:q}),j("div",{className:O.assetChips,children:[R===y&&j(C,{children:[E,H]}),R===N&&A]})]}),g("div",{children:x}),j("div",{className:O.layoutBottomSmall,children:[z,B,R===N&&D,j("div",{className:O.layoutOffsetpicker,children:[S,k]})]}),g("div",{className:O.layoutOffsetwellChipsSmall,children:b})]})}),L]})}function w(e){return g(t,{monitorWidth:!0,children:function(i){var r=i.size;return g(W,{appWidth:r.width-21,children:e.children})}})}W.propTypes={appWidth:r.func.isRequired,children:r.arrayOf(r.node).isRequired},w.propTypes={children:r.arrayOf(r.node).isRequired};export{w as default};
