import e from"@babel/runtime/helpers/defineProperty";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useRef as i}from"react";import s from"classnames";import{isEmpty as l}from"lodash";import{SEGMENTS as n}from"../../../constants/segment.js";import{getAppSegment as r}from"../../../utils/devcenter.js";import{PadModeSelect as d}from"../../PadModeSelect/PadModeSelect.js";import"../../PadModeSelect/PadModeSelect.constants.js";import{AppHeaderTestIds as a}from"../AppHeader.constants.js";import"../../AppCommonsProvider/AppCommonsProvider.js";import{useAppCommonsInternal as p}from"../../AppCommonsProvider/AppCommonsContext.js";import{HideInNativeApp as c}from"../../HideInNativeApp/index.js";import{AppHeaderFinderProps as m}from"../../utils.js";import{VersionSelect as v}from"./VersionSelect/VersionSelect.js";import{AssetChips as f}from"./AssetChips/AssetChips.js";import{AppTitle as u}from"./AppTitle/AppTitle.js";import"./AppTitle/AppTitle.constants.js";import{useResponsivity as h}from"./useResponsivity.js";import{Actions as C}from"./Actions/Actions.js";import"./Actions/Actions.constants.js";import j from"./AppHeaderV3.scss.js";function y(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)}return o}function A(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?y(Object(i),!0).forEach((function(o){e(t,o,i[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var b=function(e){var y,b,g,O,P,I,M,N,S,L,w,R,T,D=e.elementsClassNames,x=e.className,U=e.testId,k=e.logo,E=e.additionalControls,H=e.title,V=e.padModeDisabled,W=e.padModeWells,q=e.dqData,B=e.asset,F=e.lastUpdate,z=e.additionalActions,G=e.showComments,J=e.titleControls,K=e.disableSettings,Q=e.showAssetChips,X=e.disableAssetSelector,Y=e.titleMenuActions,Z=e.titleControlsPosition,$=void 0===Z?"right":Z,_=e.responsivenessConfig,ee=i(null),te=p(),oe=te.app,ie=te.well,se=te.wells,le=te.fracFleet,ne=te.isInsideNewMobileApp,re=te.disableAppAssetSelection,de=W||se,ae=r(oe)===n.COMPLETION&&!ie,pe=!l(de)&&!!le,ce=!re&&!V&&!ne&&ae&&pe,me=k?"ultranarrow":ce||E||J?"narrow":void 0,ve="left"===$&&!!J,fe=i(null),ue=i(null),he=i(null),Ce=i(null),je=i(null),ye=i(null),Ae=i(null),be=h({disabled:ne,titleControlsLeft:ve,rootRef:ee,versionRef:fe,additionalControlsRef:he,titleControlsRef:Ce,logoRef:ye,padModeRef:ue,chipsRef:je,actionsRef:Ae});return t("div",A(A({className:s(j.root,x),"data-testid":U,ref:ee,style:null===(y=be.root)||void 0===y?void 0:y.style},m),{},{children:[o("div",{className:s(j.logoContainer,null==D?void 0:D.logoContainer),ref:ye,children:k&&"string"==typeof k?o("img",{className:j.logo,src:k,alt:"Logo"}):k}),o(u,{title:H,asset:B,dqData:q,lastUpdate:F,className:s(j.title,ve&&j.titleWithControlsLeft,null==D?void 0:D.title),disableAssetSelector:X,titleMenuActions:Y,style:null===(b=be.title)||void 0===b?void 0:b.style}),J&&o("div",{className:s(j.titleControls,ve&&j.titleControlsLeft,(null===(g=be.titleControls)||void 0===g?void 0:g.lastInLine)&&j.lastInLine,null==D?void 0:D.titleControls),ref:Ce,style:null===(O=be.titleControls)||void 0===O?void 0:O.style,children:J}),o(c,{children:o("div",{className:j.version,ref:fe,children:o(v,{className:null==D?void 0:D.versionSelect})})}),ce&&o("div",{className:s(j.padMode,(null===(P=be.padMode)||void 0===P?void 0:P.lastInLine)&&j.lastInLine),ref:ue,style:null===(I=be.padMode)||void 0===I?void 0:I.style,children:o(d,{testId:a.PadModeSelectTestId})}),E&&o("div",{className:s(j.additionalControls,(null===(M=be.additionalControls)||void 0===M?void 0:M.lastInLine)&&j.lastInLine,null==D?void 0:D.additionalControls),ref:he,style:null===(N=be.additionalControls)||void 0===N?void 0:N.style,"data-testid":a.AdditionalControlsTestId,children:E}),!re&&Q&&o(c,{children:o("div",{className:s(j.assetChips,(null===(S=be.chips)||void 0===S?void 0:S.lastInLine)&&j.lastInLine,null==D?void 0:D.chips),ref:je,style:null===(L=be.chips)||void 0===L?void 0:L.style,children:o(f,{chipsWidth:me})})}),o("div",{className:s(j.actions,(null===(w=be.actions)||void 0===w?void 0:w.lastInLine)&&j.lastInLine,null==D?void 0:D.actions),ref:Ae,style:null===(R=be.actions)||void 0===R?void 0:R.style,"data-testid":a.ActionsRootTestId,children:o(C,{additionalActions:z,showComments:G,disableSettings:K,rootRef:ee,hideSettingsUnderMore:null==_?void 0:_.hideSettingsUnderMore})}),null===(T=be.linebreaks)||void 0===T?void 0:T.map((function(e,t){return o("div",{className:j.responsivenessLineBreak,style:e},t)}))]}))};export{b as AppHeaderV3};
//# sourceMappingURL=AppHeaderV3.js.map
