"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6804],{36804:function(e,n,t){t.r(n),t.d(n,{LaunchpadStoredSessionsContainer:function(){return v},default:function(){return w}});var o=t(52322),r=t(67684),a=t(21993),i=t(39013),l=t(14934),c=t(89891),s=t(2784),d=t(35505),p=t(56130),u=t(1040);let g=e=>{let{canRemove:n,title:t,onChange:r,onClick:l,onRemove:c,active:d}=e,p=s.useRef(null),[u,g]=s.useState(!1),[x,f]=s.useState(t),k=s.useCallback(()=>{r&&g(!0)},[r]),m=s.useCallback(e=>{e.stopPropagation(),c&&c()},[c]),v=s.useCallback(()=>{g(!1),r&&r(x)},[r,x]),w=s.useCallback(e=>f(e.target.value),[]);return s.useEffect(()=>{let e=p.current;e&&u&&(e.focus(),e.select())},[u]),(0,o.jsxs)(h,{$active:d||!1,onDoubleClick:k,onClick:l,children:[u?(0,o.jsx)("input",{ref:p,type:"text",onKeyDown:e=>"Enter"===e.key&&e.currentTarget.blur(),onChange:w,onBlur:v,value:x,placeholder:"Type a tab name…"}):t,n&&!u&&c?(0,o.jsx)(b,{onClick:m,children:(0,o.jsx)(a.JO,{name:"close",color:i.Bj()})}):null]})},x=e=>{let{data:n,onCreate:t,onSave:r}=e,{sessions:s}=n,d=Object.keys(s),x=d.length,h=(0,p.p)(),b=function(e){for(var t=arguments.length,o=Array(t>1?t-1:0),a=1;a<t;a++)o[a-1]=arguments[a];r(e(n,...o))},k=async e=>{x>1&&(await h({title:"Remove tab?",description:"The configuration for ".concat(e&&s[e]?'"'.concat(s[e].name,'"'):"this tab"," will be discarded.")}),b(u.Jy,e))},m=async()=>{await h({title:"Remove all tabs?",description:"All configuration tabs will be discarded."}),r(e=>{let n=e;return d.forEach(e=>{n=(0,u.Jy)(n,e)}),n})};return(0,o.jsx)(l.x,{border:"bottom",padding:{top:12},children:(0,o.jsxs)(f,{children:[d.map(e=>(0,o.jsx)(g,{canRemove:x>1,active:e===n.current,title:s[e].name||"Unnamed",onClick:()=>b(u.XH,e),onChange:n=>b(u.sU,e,{name:n}),onRemove:()=>k(e)},e)),(0,o.jsx)(g,{title:"+ Add...",onClick:t}),d.length>3?(0,o.jsx)(l.x,{background:i.v8(),padding:{top:8,left:8,right:12},border:"bottom",style:{position:"sticky",right:0},children:(0,o.jsx)(c.Z,{color:i.Yn(),onClick:m,children:(0,o.jsxs)(l.x,{flex:{direction:"row",gap:4,alignItems:"center"},style:{whiteSpace:"nowrap"},children:[(0,o.jsx)(a.JO,{name:"delete",color:i.Yn()}),(0,o.jsx)("div",{children:"Remove all"})]})})}):null]})})},f=d.ZP.div.withConfig({componentId:"sc-62eaff8c-0"})(["display:flex;flex-direction:row;font-size:13px;gap:8px;z-index:1;flex-direction:row;padding-left:12px;overflow-x:auto;::-webkit-scrollbar{display:none;}"]),h=d.ZP.div.withConfig({componentId:"sc-62eaff8c-1"})(["align-items:center;user-select:none;padding:8px 12px;display:inline-flex;align-items:center;gap:4px;border-top-left-radius:8px;border-top-right-radius:8px;white-space:nowrap;"," &:last-child{padding-right:12px;}input{background-color:transparent;font-size:13px;border:0;outline:none;padding:0;}cursor:",";"],e=>{let{$active:n}=e;return n?(0,d.iv)(["font-weight:600;background-color:",";color:",";box-shadow:"," 0 -2px 0 inset;"],i.fk(),i.Bj(),i.Bj()):(0,d.iv)(["font-weight:normal;background-color:",";color:",";box-shadow:"," 0 -1px 0 inset;&:hover{background-color:",";box-shadow:"," 0 -1px 0 inset;color:",";}"],i.gJ(),i.Aw(),i.md(),i.gJ(),i.md(),i.$())},e=>{let{$active:n}=e;return n?"inherit":"pointer"}),b=d.ZP.button.withConfig({componentId:"sc-62eaff8c-2"})(["background-color:transparent;border:0;cursor:pointer;padding:0;","{transition:background-color 100ms;}&:hover ","{background-color:",";}"],a.a1,a.a1,i.by());var k=t(49438),m=t(73434);let v=e=>{let{launchpadType:n,pipeline:t,partitionSets:a,repoAddress:i,rootDefaultYaml:l}=e,{flagDisableAutoLoadDefaults:c}=(0,k.gV)(),s=(0,u.Bv)(t,a,l,!c),[d,p]=(0,u.aC)(i,t.name,s),g=d.sessions[d.current],f=(0,m.F)(g,e=>{p(n=>(0,u.sU)(n,n.current,e))});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{data:d,onCreate:()=>{p(e=>(0,u.f0)(e,s))},onSave:p}),(0,o.jsx)(r.Z,{launchpadType:n,session:g,onSave:f,pipeline:t,partitionSets:a,repoAddress:i,rootDefaultYaml:l})]})};var w=v}}]);
//# sourceMappingURL=6804.62b359a7abbefa2e.js.map