"use strict";(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[8],{7778:function(e,t,a){a.r(t),a.d(t,{default:function(){return i}});var n=a(1);function i(e){return n.useMemo((()=>Object.assign({},e)),[...Object.values(e)])}},7780:function(e,t,a){a.r(t),a.d(t,{default:function(){return i}});var n=a(1);function i(){const e=n.useRef(!0);return n.useEffect((()=>()=>{e.current=!1}),[]),n.useCallback((()=>e.current),[])}},7776:function(e,t,a){a.r(t),a.d(t,{default:function(){return S}});var n=a(12),i=a.n(n),r=a(1),l=a(3317),o=a(1019),s=a(2547),d=a(4607),u=a(3496),c=a(4412),f=a(6269),m=a(4366),p=a(2384),E=a(7777),v=a(5018),y=a(5019),b=a(5020),g=a(7778),I=a(7779),h=a(7781);a(5032);function S(e,t){const a=(0,s.observer)((({controller:a,editorId:n})=>{const s=(0,o.toJS)(a.itemState.get("item")),{error:S,isLoading:C,isActive:R}=a.tabState,T=!1,[O,_]=r.useState({}),A=(0,r.useMemo)((()=>{return(e=a.update.bind(a)).path=(t,a)=>{e((e=>{void 0===a?i().unset(e,t):i().set(e,t,a)}))},e;var e}),[a]),D=(0,r.useCallback)((()=>{a.cacheUpdatesBuffer()}),[a]),L=Object.freeze((0,g.default)({type:pm.runtime.agent.stat.type,version:pm.runtime.version,isReady:pm.runtime.agent.isReady})),N=Object.freeze((0,g.default)({isActive:R,isOffline:a.isOffline,isReadOnly:a.isReadOnly})),k=(0,m.resolveStoreInstance)(f.default).get("editor.requestEditorLayoutName");if(S===E.default.DeletedEntity)return r.createElement(u.default,{userFriendlyEntityName:e.config.title,type:"deleted",hasToCapitalize:!1});if(S===E.default.NoHistoryPermission)return r.createElement(u.default,{userFriendlyEntityName:e.config.title,icon:e.config.icon,title:"You don't have view permission",message:`Only team members can view this ${e.config.title} from history of this workspace.`,hasToCapitalize:!1});if(S)return r.createElement(u.default,{userFriendlyEntityName:e.config.title,hasToCapitalize:!1});if(C)return r.createElement(d.default,null);return r.createElement(v.AgentContext.Provider,{value:L,key:s.id},r.createElement(c.default,{collectionId:null},r.createElement(y.TabContext.Provider,{value:N},r.createElement(b.LayoutContext.Provider,{value:k},function(){var i;return r.createElement(l.default,{direction:"column",height:"100%"},r.createElement(I.default,{state:s,isSaved:T,historyId:a instanceof h.default&&a.historyId||null,feedbackURL:e.config.feedbackURL,docsURL:e.config.docsURL,saveDisabledReason:a.saveDisabledReason,saveAsDisabledReason:a.saveAsDisabledReason,renameOnMount:null===(i=a.context)||void 0===i?void 0:i.rename,tabId:a.getTabId(),cacheUpdatesBuffer:D}),r.createElement(t,{state:s,update:A,agent:L,tab:N,historyEvents:a instanceof h.default?a.historyEvents:[],setContextData:e=>_(Object.assign(Object.assign({},O),e)),collectionId:null,promoteTab:()=>p.default.promoteEditor({id:n}),controller:a}))}()))))}));return class extends r.Component{render(){return r.createElement(a,{controller:this.props.controller,editorId:this.props.id})}}}},7779:function(e,t,a){a.r(t),a.d(t,{default:function(){return O}});var n=a(1),i=a(2575),r=a(3506),l=a(4834),o=a(3317),s=a(2670),d=a(3330),u=a(3490),c=a(6070),f=a(6072),m=a(5496),p=a(5506),E=a(5503),v=a(2249),y=a(5030),b=a(5017),g=a(5031),I=a(5032),h=a(7780),S=a(5019),C=a(2540),R=a(6654);(0,i.default)(d.Dropdown)`
  & .btn-group > .btn {
    min-width: var(--size-s);
    height: var(--size-m);
    padding: var(--spacing-s) var(--spacing-xs);
    margin-left: var(--border-width-default);
  }
`;const T=(0,i.default)(u.default)`
  &.entity-tab-header {
    border-bottom: 0;
  }
`;function O({state:e,isSaved:t,historyId:a,saveDisabledReason:i,saveAsDisabledReason:d,renameOnMount:u,tabId:O,cacheUpdatesBuffer:_}){var A;const D=(null===(A=pm.ECItemRegistry.getConfig(e.type))||void 0===A?void 0:A.title)||"item",L=i||`Save ${D}`,N=d||`Save ${D} to a collection`,{isOffline:k,isReadOnly:U}=(0,S.default)(),[w,x]=n.useState(!1),B=(0,h.default)(),M=n.useRef(null),P=Boolean(null!==a);n.useEffect((()=>{var e;u&&(null===(e=M.current)||void 0===e||e.handleEditName())}),[]);const z=n.useMemo((()=>{var a;const n=[];if(t){n.push({type:e.type,id:e.id,name:e.title});let t=null===(a=I.default.cacheAPI.get(e.id))||void 0===a?void 0:a.parent;for(;t;){const{parent:e}=I.default.getParent(t);n.unshift({type:e.type,id:e.id,name:e.title||""}),t=e.parent}}return n}),[e]),F=n.useCallback((()=>pm.mediator.trigger("showSignInModal",{userFlow:R.USER_FLOW.REQUEST_SAVE,subtitle:p.SAVE_REQUEST_SIGNIN_MODAL_SUBTITLE})),[]),j=(n.useCallback((()=>pm.mediator.trigger("showSignInModal",{userFlow:R.USER_FLOW.REQUEST_SAVE,subtitle:p.SAVE_REQUEST_SIGNIN_MODAL_SUBTITLE})),[]),n.useCallback((({id:e,type:t})=>{var a;t===y.COLLECTION?g.default.openInTab(e):null===(a=pm.ECItemRegistry.getSDK(t))||void 0===a||a.openInTab(e)}),[])),G=n.useCallback((({id:e,type:t})=>t===y.COLLECTION?{routeIdentifier:"build.collection",routeParams:{cid:e},queryParams:null}:pm.ECItemRegistry.getSDK(t)?{routeIdentifier:pm.ECItemRegistry.getSDK(t).openSavedIdentifier,routeParams:{ecid:e},queryParams:{}}:null),[]),K=n.useCallback((t=>{if(w)return;x(!0);pm.ECItemRegistry.getSDK(e.type).menuActionHandler(e.id,b.ItemAction.RENAME,{name:t}).then((()=>{B()&&x(!1)}))}),[w,e.type,e.id]);n.useCallback((()=>{pm.ECItemRegistry.getSDK(e.type).menuActionHandler(e.id,b.ItemAction.DELETE)}),[e.type,e.id]),t?n.createElement(r.default,{text:"Save",type:"secondary",icon:n.createElement(s.default,null),onClick:F,isDisabled:Boolean(i),tooltip:L}):n.createElement(r.default,{text:"Save",type:"secondary",icon:n.createElement(s.default,null),onClick:F,isDisabled:Boolean(d),tooltip:N});return n.createElement(T,{name:e.title,ref:M,path:z.length?z:null,entityType:a?`ech:${e.type}`:`ec:${e.type}`,entityUID:a||e.id,isEntityEditable:t&&!k&&!U&&!w,onBreadCrumbItemClick:j,onSubmit:K,leftMetaComponent:()=>n.createElement(m.default,{activeValue:e.type,tabId:O,canSwitch:!t&&!P,beforeSwitch:()=>_()}),renderActions:()=>n.createElement(o.default,{alignItems:"center",gap:"spacing-s"},(()=>{const e=n.createElement(r.default,{icon:n.createElement(s.default,null),text:"Save",type:"tertiary"});return v.default.isEnabled?n.createElement(l.default,{placement:"bottom-end",padding:"spacing-xs",maxWidth:"350px",trigger:e,pointer:"true"},n.createElement(E.default,{title:p.GENERIC_SIGNIN_MODAL_TITLE,subtitle:p.GENERIC_SIGNIN_MODAL_SUBTITLE})):n.createElement(r.default,{icon:n.createElement(s.default,null),text:"Save",type:"tertiary",onClick:F})})(),C.default.isUseBrowserTabsActive()&&n.createElement("div",{className:"environment-container"},n.createElement(c.default,{selectorWidth:130,useBrowserTabs:!0}),n.createElement("div",{className:"environment-splitter"}),n.createElement(f.default,{useBrowserTabs:!0}))),breadCrumbRouteConfig:G})}}}]);