"use strict";(self.webpackChunk_dagster_io_dagit_app=self.webpackChunk_dagster_io_dagit_app||[]).push([[566],{90566:function(n,e,t){t.r(e),t.d(e,{LaunchpadStoredSessionsContainer:function(){return _},default:function(){return j}});var o,r,a=t(19065),i=t(325),c=t(88796),s=t(13881),u=t(99500),l=t(85358),d=t(922),p=t(95550),f=t.n(p),h=t(42658),g=t(7838),b=t(32030),v=t(79540),x=t(32289),w=function(n){var e=n.canRemove,t=n.title,o=n.onChange,r=n.onClick,c=n.onRemove,s=n.active,u=i.useRef(null),l=i.useState(!1),d=(0,a.Z)(l,2),p=d[0],f=d[1],b=i.useState(t),v=(0,a.Z)(b,2),w=v[0],m=v[1],k=i.useCallback((function(){o&&f(!0)}),[o]),_=i.useCallback((function(n){n.stopPropagation(),c&&c()}),[c]),j=i.useCallback((function(){f(!1),o&&o(w)}),[o,w]),T=i.useCallback((function(n){return m(n.target.value)}),[]);return i.useEffect((function(){var n=u.current;n&&p&&(n.focus(),n.select())}),[p]),(0,x.jsxs)(C,{$active:s||!1,onDoubleClick:k,onClick:r,children:[p?(0,x.jsx)("input",{ref:u,type:"text",onKeyDown:function(n){return"Enter"===n.key&&n.currentTarget.blur()},onChange:T,onBlur:j,value:w,placeholder:"Type a tab name\u2026"}):t,e&&!p&&c?(0,x.jsx)(y,{onClick:_,children:(0,x.jsx)(h.JO,{name:"close",color:g.w.Olive500})}):null]})},m=function(n){var e=n.data,t=n.onCreate,o=n.onSave,r=e.sessions,a=Object.keys(r),i=a.length,s=(0,v.p)(),u=function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];o(n.apply(void 0,[e].concat(r)))},d=function(){var n=(0,l.Z)(f().mark((function n(e){return f().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(i>1)){n.next=4;break}return n.next=3,s({title:"Discard tab?",description:"The configuration for ".concat(e?'"'.concat(r[e].name,'"'):"this tab"," will be discarded.")});case 3:u(c.Jy,e);case 4:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}();return(0,x.jsx)(b.x,{border:{side:"bottom",width:1,color:g.w.KeylineGray},padding:{horizontal:12,top:12},children:(0,x.jsxs)(k,{children:[a.map((function(n){return(0,x.jsx)(w,{canRemove:i>1,active:n===e.current,title:r[n].name||"Unnamed",onClick:function(){return u(c.XH,n)},onChange:function(e){return u(c.sU,n,{name:e})},onRemove:function(){return d(n)}},n)})),(0,x.jsx)(w,{title:"+ Add...",onClick:t})]})})},k=d.ZP.div.withConfig({displayName:"LaunchpadTabs__LaunchpadTabsContainer",componentId:"sc-2w3op5-0"})(["display:flex;flex-direction:row;font-size:13px;gap:8px;z-index:1;flex-direction:row;"]),C=d.ZP.div.withConfig({displayName:"LaunchpadTabs__TabContainer",componentId:"sc-2w3op5-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;"," &:last-child{padding-right:12px;}input{background-color:transparent;font-size:13px;border:0;outline:none;padding:0;}cursor:",";"],(function(n){return n.$active?(0,d.iv)(o||(o=(0,u.Z)(["\n          font-weight: 600;\n          background-color: ",";\n          color: ",";\n          box-shadow: "," 0 -2px 0 inset;\n        "])),g.w.Gray100,g.w.ForestGreen,g.w.ForestGreen):(0,d.iv)(r||(r=(0,u.Z)(["\n          font-weight: normal;\n          background-color: ",";\n          color: ",";\n          box-shadow: "," 0 -1px 0 inset;\n\n          &:hover {\n            background-color: ",";\n            box-shadow: "," 0 -1px 0 inset;\n            color: ",";\n          }\n        "])),g.w.Gray50,g.w.Gray300,g.w.Olive200,g.w.Gray100,g.w.Olive500,g.w.Olive500)}),(function(n){return n.$active?"inherit":"pointer"})),y=d.ZP.button.withConfig({displayName:"LaunchpadTabs__RemoveButton",componentId:"sc-2w3op5-2"})(["background-color:transparent;border:0;cursor:pointer;padding:0;","{transition:background-color 100ms;}&:hover ","{background-color:",";}"],h.a1,h.a1,g.w.Olive700),_=function(n){var e=n.launchpadType,t=n.pipeline,o=n.partitionSets,r=n.repoAddress,i=(0,c.Bv)(t,o),u=(0,c.aC)(r,t.name,i),l=(0,a.Z)(u,2),d=l[0],p=l[1],f=d.sessions[d.current];return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(m,{data:d,onCreate:function(){p((0,c.f0)(d,i))},onSave:p}),(0,x.jsx)(s.Z,{launchpadType:e,session:f,onSave:function(n){p((0,c.sU)(d,d.current,n))},pipeline:t,partitionSets:o,repoAddress:r})]})},j=_}}]);
//# sourceMappingURL=566.3e4cc102.chunk.js.map