1import{o as e,t}from"./jsx-runtime-cvnAX2Ol.js";import{M as n,T as r,ct as i}from"./components-d-7UI7xd.js";import{$t as a,A as o,Gr as s,Ht as c,Jr as l,Kr as u,Lt as d,O as f,On as p,Ri as m,Ur as h,Vi as g,Wr as _,Yt as v,bn as y,dn as b,dr as x,et as S,mr as C,qr as w,ta as T}from"./dist-CWgLnKY7.js";import{i as E,t as D}from"./hook-DzomF-Jy.js";import{t as O}from"./environment-02S_Yjsl.js";import{t as k}from"./clsx-DB0hHKMi.js";import{t as A}from"./constants-Psi_r1At.js";import{t as j}from"./actions-BnPYjUfT.js";import{t as M}from"./useAppConfig-C7QORzzm.js";import{t as N}from"./useEnvironment-VwUMuFFG.js";import{t as P}from"./useShubOrgInfo-CJLgZXxW.js";import{t as F}from"./Form-CplgXhu-.js";import{t as I}from"./roles-CSoT72ey.js";var L=e(i(),1),R=t(),z=({icon:e,label:t,href:n,isExternal:r,isSubmenu:i=!1})=>(0,R.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,"data-testid":t,className:`group`,children:(0,R.jsxs)(`div`,{className:`flex items-center h-[2.125rem] gap-2 px-4 text-body2 text-(--sp-color-text-muted) hover:bg-(--sp-color-surface-hover) hover:text-(--sp-color-text) group-last:rounded-b group-first:rounded-t`,children:[(0,R.jsx)(`div`,{className:`flex justify-center flex-grow-0 flex-shrink-0 w-4`,children:e}),i?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`content-between`,children:t}),(0,R.jsx)(`div`,{className:`ml-auto`,children:(0,R.jsx)(p,{width:8,height:8})})]}):(0,R.jsxs)(`div`,{className:`flex truncate`,children:[(0,R.jsx)(`div`,{className:`truncate`,children:t}),r?(0,R.jsx)(`div`,{children:(0,R.jsx)(C,{})}):null]})]})}),B=({featureFlags:e,showResetValues:t=!0})=>{let r=N(),i=r===O.PROD,a=r===O.LOCAL,o=r===O.DEV,s=T(),{flags:c,token:l}=n(`root`)||{flags:{},token:``};if(i)return null;let u=e.map(e=>c[e]===!0?(0,R.jsxs)(`span`,{className:`cursor-pointer px-4 py-1.5`,onClick:()=>{s?.submit?.({},{method:`POST`,action:j.TOGGLE_FEATURE_FLAG({[e]:!1})})},children:[e,` â`]},e):(0,R.jsx)(`span`,{className:`cursor-pointer px-4 py-1.5`,onClick:()=>{s?.submit?.({},{method:`POST`,action:j.TOGGLE_FEATURE_FLAG({[e]:!0})})},children:e},e)),d=(0,L.useMemo)(()=>{let e=[{name:`Enabled Flags`,options:u}];return e.push({name:`Tools`,options:[(a||o)&&`Storybook`,`Copy APP Token`]}),t&&e.push({name:`Reset Values`,options:[`Reset Pre Setup`,`Reset Flag Overrides`]}),e},[c,t]),f=(0,L.useCallback)(e=>{switch(e){case`Storybook`:window.location.href=`/storybook`;break;case`Reset Pre Setup`:window.location.href=`/sp-admin/presetup?force=true`;break;case`Reset Flag Overrides`:s?.submit?.({},{method:`POST`,action:j.CLEAR_FLAG_OVERRIDES()}),location.reload();break;case`Copy APP Token`:try{navigator.clipboard.writeText(String(l)),window.alert(`App token copied to clipboard`)}catch{}}},[c]);return(0,R.jsx)(`div`,{className:`mr-4`,children:(0,R.jsx)(S,{dropdownButton:`Debug`,menuItems:d,onClick:f})})},V=`data:image/svg+xml,%3csvg%20width='52'%20height='32'%20viewBox='0%200%2052%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3931_27462)'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='%23131921'/%3e%3crect%20x='14'%20y='12'%20width='28'%20height='2'%20rx='1'%20fill='%234B5662'/%3e%3crect%20x='14'%20y='16'%20width='28'%20height='2'%20rx='1'%20fill='%234B5662'/%3e%3crect%20x='14'%20y='20'%20width='18'%20height='2'%20rx='1'%20fill='%234B5662'/%3e%3crect%20width='27'%20height='1'%20transform='translate(9%2034)%20rotate(-90)'%20fill='%234B5662'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20fill='%234B5662'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20stroke='%234B5662'/%3e%3crect%20x='4'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%2367707A'/%3e%3crect%20x='13'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%2367707A'/%3e%3crect%20x='44'%20y='3'%20width='4'%20height='2'%20rx='1'%20fill='%23097EB2'/%3e%3crect%20x='6'%20y='12'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2012)'%20fill='%234B5662'/%3e%3crect%20x='6'%20y='16'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2016)'%20fill='%234B5662'/%3e%3crect%20x='6'%20y='20'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2020)'%20fill='%234B5662'/%3e%3c/g%3e%3crect%20x='0.5'%20y='0.5'%20width='51'%20height='31'%20rx='1.5'%20stroke='%234B5662'/%3e%3cdefs%3e%3cclipPath%20id='clip0_3931_27462'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,H=`data:image/svg+xml,%3csvg%20width='52'%20height='32'%20viewBox='0%200%2052%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3931_27444)'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='white'/%3e%3crect%20x='14'%20y='12'%20width='28'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20x='14'%20y='16'%20width='28'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20x='14'%20y='20'%20width='18'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20width='27'%20height='1'%20transform='translate(9%2034)%20rotate(-90)'%20fill='%23D8DDE4'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20fill='%23D8DDE4'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20stroke='%23D8DDE4'/%3e%3crect%20x='4'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%23929AA3'/%3e%3crect%20x='13'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%23929AA3'/%3e%3crect%20x='44'%20y='3'%20width='4'%20height='2'%20rx='1'%20fill='%23097EB2'/%3e%3crect%20x='6'%20y='12'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2012)'%20fill='%23D8DDE4'/%3e%3crect%20x='6'%20y='16'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2016)'%20fill='%23D8DDE4'/%3e%3crect%20x='6'%20y='20'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2020)'%20fill='%23D8DDE4'/%3e%3c/g%3e%3crect%20x='0.5'%20y='0.5'%20width='51'%20height='31'%20rx='1.5'%20stroke='%23D8DDE4'/%3e%3cdefs%3e%3cclipPath%20id='clip0_3931_27444'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,U=`data:image/svg+xml,%3csvg%20width='52'%20height='32'%20viewBox='0%200%2052%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3931_27480)'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='white'/%3e%3crect%20x='14'%20y='12'%20width='28'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20x='14'%20y='16'%20width='28'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20x='14'%20y='20'%20width='18'%20height='2'%20rx='1'%20fill='%23D8DDE4'/%3e%3crect%20width='27'%20height='1'%20transform='translate(9%2034)%20rotate(-90)'%20fill='%23D8DDE4'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20fill='%23D8DDE4'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20stroke='%23D8DDE4'/%3e%3crect%20x='4'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%23929AA3'/%3e%3crect%20x='13'%20y='3'%20width='8'%20height='2'%20rx='1'%20fill='%23929AA3'/%3e%3crect%20x='44'%20y='3'%20width='4'%20height='2'%20rx='1'%20fill='%23097EB2'/%3e%3crect%20x='6'%20y='12'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2012)'%20fill='%23D8DDE4'/%3e%3crect%20x='6'%20y='16'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2016)'%20fill='%23D8DDE4'/%3e%3crect%20x='6'%20y='20'%20width='2'%20height='2'%20rx='1'%20transform='rotate(90%206%2020)'%20fill='%23D8DDE4'/%3e%3c/g%3e%3crect%20x='0.5'%20y='0.5'%20width='51'%20height='31'%20rx='1.5'%20stroke='%23D8DDE4'/%3e%3cg%20clip-path='url(%23clip1_3931_27480)'%3e%3cpath%20d='M26%200H50C51.1046%200%2052%200.895431%2052%202V30C52%2031.1046%2051.1046%2032%2050%2032H26V0Z'%20fill='%23131921'/%3e%3crect%20x='14'%20y='12'%20width='28'%20height='2'%20rx='1'%20fill='%233A4452'/%3e%3crect%20x='14'%20y='16'%20width='28'%20height='2'%20rx='1'%20fill='%233A4452'/%3e%3crect%20x='14'%20y='20'%20width='18'%20height='2'%20rx='1'%20fill='%233A4452'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20fill='%233A4452'/%3e%3cpath%20d='M0.5%202C0.5%201.17157%201.17157%200.5%202%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V7.5H0.5V2Z'%20stroke='%233A4452'/%3e%3crect%20x='44'%20y='3'%20width='4'%20height='2'%20rx='1'%20fill='%23097EB2'/%3e%3c/g%3e%3cpath%20d='M26.5%200.5H50C50.8284%200.5%2051.5%201.17157%2051.5%202V30C51.5%2030.8284%2050.8284%2031.5%2050%2031.5H26.5V0.5Z'%20stroke='%233A4452'/%3e%3cdefs%3e%3cclipPath%20id='clip0_3931_27480'%3e%3crect%20width='52'%20height='32'%20rx='2'%20fill='white'/%3e%3c/clipPath%3e%3cclipPath%20id='clip1_3931_27480'%3e%3cpath%20d='M26%200H50C51.1046%200%2052%200.895431%2052%202V30C52%2031.1046%2051.1046%2032%2050%2032H26V0Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,W=({content:e,menuFor:t,onClick:n,close:r})=>(0,R.jsx)(u,{children:(0,R.jsx)(`button`,{className:g(`sp-profile-mode-item text-(--sp-color-text-muted) group flex w-full px-4 py-1.5 text-body2 items-center whitespace-nowrap first:rounded-t-md last:rounded-b-md`,`hover:bg-(--sp-color-surface-hover)`),onClick:()=>{n(t),r()},children:e})}),G=({image:e,text:t,className:n=``})=>(0,R.jsxs)(`span`,{className:k(`flex pt-[6px] w-52 items-center`,n),children:[(0,R.jsx)(`img`,{src:e,alt:t}),(0,R.jsx)(`span`,{className:`ml-4`,children:t})]}),K=({close:e})=>{let{t}=E(),{setMode:n,isDark:r}=D(),i=[{name:A.LIGHT,content:(0,R.jsx)(G,{image:H,text:t(`components.ui.modeToggle.light`)})},{name:A.DARK,content:(0,R.jsx)(G,{image:V,text:t(`components.ui.modeToggle.dark`)})},{name:A.SYSTEM,content:(0,R.jsx)(G,{image:U,text:t(`components.ui.modeToggle.system`),className:`pb-[6px]`})}],o=e=>n(e);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`mx-4 border-b border-b-(--sp-color-border-subtle)`}),(0,R.jsxs)(s,{className:`relative flex w-full text-left z-[49] flex-1`,children:[(0,R.jsx)(h,{className:`w-full outline-none`,children:(0,R.jsx)(z,{icon:r()?(0,R.jsx)(a,{}):(0,R.jsx)(c,{}),label:t(`components.profile.buttons.mode.label`),isSubmenu:!0},t(`components.profile.buttons.mode.label`))}),(0,R.jsx)(_,{children:(0,R.jsx)(w,{children:(0,R.jsx)(l,{static:!0,className:`sp-profile-mode-panel absolute top-0 right-0 min-w-full origin-top-right bg-(--sp-color-surface) rounded-md shadow-[0_2px_4px_0_rgba(0,0,0,0.12)] border-0 ring-black focus:outline-none`,children:(0,R.jsx)(s,{className:`relative`,children:(0,R.jsx)(h,{className:`w-full outline-none`,as:`div`,children:(0,R.jsx)(_,{static:!0,children:(0,R.jsx)(w,{children:(0,R.jsx)(l,{static:!0,className:`sp-profile-mode-panel absolute top-0 max-h-[25rem] overflow-auto bg-(--sp-color-surface) right-[calc(100%+4px)] min-w-[139px] rounded-md shadow-[0_2px_4px_0_rgba(0,0,0,0.12)] border-0 ring-black focus:outline-none dark:border dark:border-(--sp-color-border-subtle)`,children:i.map(t=>(0,R.jsx)(W,{content:t.content,onClick:o,menuFor:t.name,close:e},t.name))})})})})})})})})]})]})},q=({platformUiUrl:e,shubAppUrl:t,isOnPrem:n,platformManaged:r,swaggerhubOrgId:i})=>[{icon:(0,R.jsx)(v,{}),label:`components.profile.buttons.myOrganizations.label`,href:n||!r?`${t}/settings/organizations`:`${e}/organizations/${i}/members`,isExternal:!0},{icon:(0,R.jsx)(d,{width:16,height:16}),label:`components.profile.buttons.APIKey.label`,href:`${t}/settings/apiKey`,isExternal:!0}],J=({swaggerhubOrgId:e,platformManaged:t})=>{let{shubAppUrl:n,platformUiUrl:r}=M(),i=N(),a=(0,L.useMemo)(()=>q({platformUiUrl:r,shubAppUrl:n,isOnPrem:i===O.ON_PREM,platformManaged:t,swaggerhubOrgId:e}),[]),{t:o}=E();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`mx-4 border-b border-b-(--sp-color-border-subtle)`}),a.map(e=>(0,R.jsx)(z,{icon:e.icon,label:o(e.label),href:e.href,isExternal:e.isExternal},o(e.label)))]})},Y=({user:e,isConsumerSide:t,showMode:n=!0,close:i=()=>{},platformAdmin:a,platformManaged:s})=>{let{t:c}=E(),l=r(),{highestRole:u,swaggerhubOrgId:d}=P(),p=N(),h=!e?.isExternal&&(p!==O.ON_PREM||p===O.ON_PREM&&e?.authType?.toLowerCase()===`internal`);return(0,R.jsxs)(`div`,{className:`sp-profile-menu w-[21.25rem] rounded bg-(--sp-color-surface) dark:bg-(--sp-color-surface-raised) shadow-[0px_3px_6px_0px_rgba(0,0,0,0.18)] dark:border dark:border-(--sp-color-border) dark:shadow-[0px_2px_4px_0px_rgba(23,54,71,0.12)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center w-full h-20 leading-5`,children:[(0,R.jsx)(`div`,{className:`pl-4 flex-0 text-(--sp-color-text-muted)`,children:(0,R.jsx)(b,{})}),(0,R.jsxs)(`div`,{className:`flex-auto px-4 overflow-hidden`,children:[(0,R.jsx)(`div`,{"aria-label":c(`components.profile.buttons.email.ariaLabel`),className:`sp-profile-email mb-1 overflow-hidden font-semibold cursor-default text-ellipsis whitespace-nowrap text-body2 text-(--sp-color-text-muted)`,children:e.email}),h&&(0,R.jsx)(o,{"aria-label":c(`components.profile.buttons.manageAccount.ariaLabel`),label:c(`components.profile.buttons.manageAccount.label`),href:e.profile,target:`_blank`,isExternal:!0})]})]}),(I(u)||a)&&t?(0,R.jsxs)(`div`,{className:`relative flex justify-center w-full px-4 py-5`,children:[(0,R.jsx)(`div`,{className:`absolute top-0 border-b inset-x-4 border-b-(--sp-color-border-subtle)`}),(0,R.jsx)(f,{"aria-label":c(`components.profile.buttons.provider.ariaLabel`),size:`s`,className:`sp-profile-provider-button w-full`,icon:(0,R.jsx)(y,{}),onClick:()=>l(`/sp-admin/home`),children:c(`components.profile.buttons.provider.label`)})]}):null,!t&&(0,R.jsx)(J,{swaggerhubOrgId:d||``,platformManaged:s}),n&&(0,R.jsx)(K,{close:i}),(0,R.jsx)(F,{schema:m({}),method:`get`,action:`/services/api/logout`,children:()=>(0,R.jsxs)(`div`,{"aria-label":c(`components.profile.buttons.logout.ariaLabel`),className:k(`relative flex w-full cursor-pointer rounded-b`,`text-(--sp-color-text-muted) hover:bg-(--sp-color-surface-hover) hover:text-(--sp-color-text-strong)`),children:[(0,R.jsx)(`input`,{type:`submit`,name:`submit`,className:`absolute inset-0 w-full h-full bg-transparent cursor-pointer`,value:``}),(0,R.jsx)(`div`,{className:`py-2 pl-4 flex-0`,children:(0,R.jsx)(x,{})}),(0,R.jsx)(`div`,{className:`flex-1 overflow-hidden text-ellipsis whitespace-nowrap py-1.5 pr-4 pl-2 text-body2`,children:c(`components.profile.buttons.logout.label`)})]})})]})};export{B as n,z as r,Y as t}; 2//# sourceMappingURL=Profile-DiQW_13a.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.