unleash-server 5.1.0 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/lib/db/event-store.js +2 -1
  2. package/dist/lib/db/event-store.js.map +1 -1
  3. package/frontend/build/index.html +1 -1
  4. package/frontend/build/static/{CreateProject-3c093214.js → CreateProject-217f67b6.js} +1 -1
  5. package/frontend/build/static/{Error-10dff66c.js → Error-5606eccd.js} +1 -1
  6. package/frontend/build/static/FeatureArchiveDialog-c311c641.js +4 -0
  7. package/frontend/build/static/{FeatureMetricsChart-d5c6311d.js → FeatureMetricsChart-1c6bb078.js} +1 -1
  8. package/frontend/build/static/{FeatureViewLazyExport-e52ae7b0.js → FeatureViewLazyExport-06cf4baa.js} +2 -2
  9. package/frontend/build/static/{LazyAdminExport-2554e446.js → LazyAdminExport-04c8032d.js} +2 -2
  10. package/frontend/build/static/{LazyProjectExport-682e75c0.js → LazyProjectExport-d9663a8c.js} +1 -1
  11. package/frontend/build/static/{NetworkOverview-4653e26c.js → NetworkOverview-2bce4916.js} +1 -1
  12. package/frontend/build/static/{NetworkTraffic-4332556b.js → NetworkTraffic-7db94d86.js} +1 -1
  13. package/frontend/build/static/{Playground-130e9113.js → Playground-6602cb1a.js} +1 -1
  14. package/frontend/build/static/{StrategyItemContainer-893b13f0.js → StrategyItemContainer-0140b94f.js} +1 -1
  15. package/frontend/build/static/{chartjs-adapter-date-fns.esm-23b8f0d9.js → chartjs-adapter-date-fns.esm-c75aa905.js} +1 -1
  16. package/frontend/build/static/{index-66ec1ba9.js → index-1f392976.js} +2 -2
  17. package/frontend/build/static/{index-4d0a5ffb.js → index-b3def5eb.js} +1 -1
  18. package/frontend/build/static/{index-e7efdb59.js → index-f8439975.js} +1 -1
  19. package/frontend/build/static/{unknownify-6ed6e58e.js → unknownify-6683037a.js} +1 -1
  20. package/frontend/build/static/{useProjectRole-ce09b03e.js → useProjectRole-122ac4bb.js} +1 -1
  21. package/package.json +1 -1
  22. package/frontend/build/static/FeatureArchiveDialog-365cb2af.js +0 -4
@@ -353,12 +353,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
353
353
  --data-raw '${JSON.stringify(S(),void 0,2)}'`,children:l(fD,{handleSubmit:async U=>{if(r){U.preventDefault(),A();try{await c(r.id,S()),await d(),s(t?`/projects/${t}/settings/segments/`:"/segments/"),i({title:"Segment updated",type:"success"})}catch(M){a(ht(M))}}},name:p,setName:f,description:h,setDescription:g,project:v,setProject:y,constraints:b,setConstraints:w,errors:k,clearErrors:A,mode:"edit",children:l(Ic,{permission:xE,disabled:!T||_,"data-testid":yie})})})},cTe=()=>{const{uiConfig:e}=Ot(),t=gt();return l(LL,{onClick:()=>t("/environments/create"),maxWidth:"700px",Icon:ca,permission:fi,disabled:!e.flags.EEA,children:"New environment"})},uTe=(e,t,n)=>{const r=m.useRef(null);return m.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),dTe(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},dTe=(e,t,n)=>{const r=p=>{lg&&t(Number(lg.dataset.index),Number(e.dataset.index),p)},o=n??e,i=p=>{p.target===o&&(e.draggable=!0)},a=()=>{e.draggable=!1},s=()=>{e.draggable=!0,lg=e},c=()=>{r(!1)},u=p=>{p.preventDefault()},d=()=>{r(!0),lg=null};return o.addEventListener("mouseenter",i),o.addEventListener("mouseleave",a),n&&e.addEventListener("mouseenter",a),e.addEventListener("dragstart",s),e.addEventListener("dragenter",c),e.addEventListener("dragover",u),e.addEventListener("drop",d),()=>{o.removeEventListener("mouseenter",i),o.removeEventListener("mouseleave",a),n&&e.removeEventListener("mouseenter",a),e.removeEventListener("dragstart",s),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",u),e.removeEventListener("drop",d)}};let lg;const pTe=C(zi)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),fTe=({row:e,moveListItem:t})=>{const{hasAccess:n}=m.useContext(yo),r=m.useRef(null),{searchQuery:o}=Al(),i=!o&&n(lx),a=uTe(e.index,t,r),s=(c,u)=>i&&c.column.isDragHandle?l(Wi,{...c.getCellProps(),ref:u,className:"drag-handle",children:c.render("Cell")}):l(Wi,{...c.getCellProps(),children:c.render("Cell")});return l(pTe,{hover:!0,ref:i?a:void 0,children:e.cells.map(c=>s(c,r))})},hTe=C(se)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),mTe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),T3=C(Zt)(({theme:e})=>({marginLeft:e.spacing(1)})),gTe=({environment:e})=>{const{searchQuery:t}=Al();return x(rr,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:[l(Ua,{search:t,children:e.name}),l(q,{condition:e.protected,show:l(T3,{color:"success",children:"Predefined"})}),l(q,{condition:!e.enabled,show:l(Fh,{maxWidth:"270px",title:x(ve,{children:[l(hTe,{children:"Deprecated environment"}),l(mTe,{children:"This environment is not auto-enabled for new projects. The project owner will need to manually enable it in the project."})]}),describeChild:!0,arrow:!0,children:l(T3,{color:"neutral",children:"Deprecated"})})})]})},pu=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:i})=>{const{hasAccess:a}=m.useContext(yo);let s;return t&&r?s=a(e,t,r):t?s=a(e,t):s=a(e),l(Cd,{...i,title:E1(s,o),children:n({hasAccess:s})})},vTe=C(W2)(({theme:e})=>({padding:e.spacing(1)})),Mg=C(ja)(({theme:e})=>({borderRadius:e.shape.borderRadius})),yTe=C(Mg)(({theme:e})=>({color:e.palette.error.main})),bTe=C(_u)(({theme:e})=>({color:e.palette.error.main})),wTe=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[i,a]=m.useState(null),s=!!i,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`environment-${e.name}-actions`,p=`${d}-menu`;return x(ve,{children:[l(xt,{title:"Environment actions",arrow:!0,describeChild:!0,children:l(Ht,{id:d,"aria-controls":s?p:void 0,"aria-haspopup":"true","aria-expanded":s?"true":void 0,onClick:c,type:"button",children:l(qE,{})})}),l(H2,{id:p,anchorEl:i,open:s,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:x(vTe,{"aria-labelledby":d,children:[l(pu,{permission:lx,children:({hasAccess:f})=>x(Mg,{onClick:()=>{t(),u()},disabled:!f||e.protected,children:[l(_u,{children:l(Ui,{})}),l(rn,{children:l(se,{variant:"body2",children:"Edit"})})]})}),l(pu,{permission:fi,children:({hasAccess:f})=>x(Mg,{onClick:()=>{r(),u()},disabled:!f,children:[l(_u,{children:l(qse,{})}),l(rn,{children:l(se,{variant:"body2",children:"Clone"})})]})}),l(pu,{permission:lx,children:({hasAccess:f})=>x(Mg,{onClick:()=>{n(),u()},disabled:!f||e.protected,children:[l(_u,{children:l(q,{condition:e.enabled,show:l(Cle,{}),elseShow:l(Ele,{})})}),l(rn,{children:l(se,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),l(pu,{permission:Lle,children:({hasAccess:f})=>x(yTe,{onClick:()=>{o(),u()},disabled:!f||e.protected,children:[l(bTe,{children:l(go,{})}),l(rn,{children:l(se,{variant:"body2",children:"Delete"})})]})})]})})]})},k3=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},STe=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),xTe=C("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),CTe=C("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),ETe=(e,t,n)=>x("li",{...e,children:[l(Ka,{icon:l(L1,{fontSize:"small"}),checkedIcon:l(M1,{fontSize:"small"}),style:{marginRight:8},checked:n}),x(STe,{children:[l("span",{children:t.name}),l("span",{children:t.description})]})]}),TTe=e=>l(xTe,{children:e.length>1?`${e.length} projects selected`:e[0].name}),kTe=({projects:e,setProjects:t})=>{const{projects:n}=Qa(),r=n.sort((c,u)=>c.name.localeCompare(u.name)).map(({id:c,name:u,description:d})=>({id:c,name:u,description:d})),o=r.filter(({id:c})=>e.includes(c)),i=e.length>0&&e.length===r.length,a=()=>{const c=i?[]:r.map(({id:u})=>u);t(c)};return l(CTe,{children:l(_h,{size:"small",multiple:!0,limitTags:1,openOnFocus:!0,disableCloseOnSelect:!0,value:o,onChange:(c,u,d)=>{c.type==="keydown"&&c.key==="Backspace"&&d==="removeOption"||t(u.map(({id:p})=>p))},options:r,renderOption:(c,u,{selected:d})=>ETe(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:p})=>k3(u,d)||k3(u,p)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>l(wn,{...c,label:"Projects"}),renderTags:c=>TTe(c),groupBy:()=>"Select/Deselect all",renderGroup:({key:c,children:u})=>x(m.Fragment,{children:[l(q,{condition:r.length>2,show:l(uT,{isAllSelected:i,onClick:a})}),u]},c)})})},kp="*",ATe=({...e})=>l(wr,{elevation:8,...e}),RTe=C(Ka)(({theme:e})=>({marginRight:e.spacing(.4)})),_Te=({options:e,defaultValue:t=[kp],onChange:n,disabled:r,error:o,onFocus:i})=>{const[a,s]=m.useState(typeof t=="string"?[t]:t),[c,u]=m.useState(typeof t=="string"||t.includes(kp)),d=a.length>0&&a.length===e.length&&a[0]!==kp,p=(y,b)=>{b?(u(!0),n([kp])):(u(!1),n(a.includes(kp)?[]:a))},f=()=>{const y=d?[]:e.map(({value:b})=>b);s(y),n(y)};return x(Le,{sx:{mt:-1,mb:3},children:[l(Le,{sx:{mt:1,mb:.25,ml:1.5},children:l(Hr,{disabled:r,"data-testid":"select-all-projects",control:l(Ka,{checked:r||c,onChange:p}),label:"ALL current and future projects"})}),l(_h,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:y})=>y,groupBy:()=>"Select/Deselect all",renderGroup:({key:y,children:b})=>x(m.Fragment,{children:[l(q,{condition:e.length>2,show:l(uT,{isAllSelected:d,onClick:f})}),b]},y),fullWidth:!0,PaperComponent:ATe,renderOption:(y,b,{selected:w})=>x("li",{...y,children:[l(RTe,{icon:l(L1,{fontSize:"small"}),checkedIcon:l(M1,{fontSize:"small"}),checked:w}),b.label]}),renderInput:y=>l(wn,{...y,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:i,"data-testid":"select-input"}),value:c||r?e:e.filter(y=>a.includes(y.value)),onChange:(y,b)=>{const w=b.map(({value:S})=>S);s(w),n(w)}})]})},PTe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{deleteToken:async a=>{const s=`api/admin/api-tokens/${a}`,c=t(s,{method:"DELETE"});try{return await e(c.caller,c.id)}catch(u){throw u}},createToken:async a=>{const c=t("api/admin/api-tokens",{method:"POST",body:JSON.stringify(a)});try{return await e(c.caller,c.id)}catch(u){throw u}},errors:n,loading:r}},ITe=C("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Jc=C("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),mw=C("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),OTe=C(Sr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),$Te=C("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),NTe=C("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),LTe=C("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),MTe=C(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),DTe=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:i}=Td(),{cloneEnvironment:a,loading:s}=_d(),{createToken:c}=PTe(),{projects:u}=Qa(),{setToastData:d,setToastApiError:p}=$t(),{uiConfig:f}=Ot(),[h,g]=m.useState(`${e.name}_clone`),[v,y]=m.useState("development"),[b,w]=m.useState([]),[S,k]=m.useState(["*"]),[A,T]=m.useState(!0),[R,P]=m.useState("later"),[_,I]=m.useState({}),$=Z=>{I(ae=>({...ae,[Z]:void 0}))},U=(Z,ae)=>{I(Ae=>({...Ae,[Z]:ae}))};m.useEffect(()=>{g(M(e.name)),y("development"),w([]),k(["*"]),T(!0),P("later"),I({})},[e]);const M=Z=>{let ae=`${Z}_clone`,Ae=2;for(;!j(ae);)ae=`${e.name}_clone_${Ae}`,Ae++;return ae},D=()=>({name:h,type:v,projects:b,clonePermissions:A}),K=()=>({username:`${h}_token`,type:"CLIENT",environment:h,projects:S}),H=async Z=>{Z.preventDefault();try{if(await a(e.name,D()),R==="now"){const Ae=await(await c(K())).json();r(Ae)}d({title:"Environment successfully cloned!",type:"success"}),i(),n(!1)}catch(ae){p(ht(ae))}},Q=()=>`curl --location --request POST '${f.unleashUrl}/api/admin/environments/${e.name}/clone' \\
354
354
  --header 'Authorization: INSERT_API_KEY' \\
355
355
  --header 'Content-Type: application/json' \\
356
- --data-raw '${JSON.stringify(D(),void 0,2)}'`,V=Z=>Z.length,j=Z=>!(o!=null&&o.some(ae=>ae.name===Z)),z=V(h)&&j(h)&&S.length,O=Z=>{$("name"),j(Z)||U("name","An environment with that name already exists."),g(Z)},B=u.map(Z=>({value:Z.id,label:Z.name}));return l(X1,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:l(Yr,{loading:s,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:Q,children:x(ITe,{onSubmit:H,children:[x("div",{children:[l(Jc,{children:"What is your new environment name? (Can't be changed later)"}),l(OTe,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:Z=>O(Z.target.value),required:!0}),l(Jc,{children:"What type of environment do you want to create?"}),l(FL,{onChange:Z=>y(Z.currentTarget.value),value:v}),x(Jc,{children:["Select which projects you want to clone the environment configuration in?",l(Qu,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),l(kTe,{projects:b,setProjects:w}),l(Jc,{children:"Keep the users permission for this environment?"}),l(mw,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),l(Hr,{label:A?"Yes":"No",control:l(Ya,{onChange:Z=>T(Z.target.checked),checked:A})}),x($Te,{children:[l(Jc,{children:"API Token"}),x(mw,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",l(Vr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),l(ks,{children:x(q2,{value:R,onChange:Z=>P(Z.target.value),name:"api-token-generation",children:[l(Hr,{value:"later",control:l(nc,{}),label:"I want to generate an API token later"}),l(Hr,{value:"now",control:l(nc,{}),label:"Generate an API token now"})]})}),x(NTe,{children:[l(mw,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),l(q,{condition:R==="now",show:x(ve,{children:[l(Jc,{children:"Which projects do you want this token to give access to?"}),l(_Te,{options:B,defaultValue:S,onChange:k,error:_.projects,onFocus:()=>$("projects")})]})})]})]})]}),x(LTe,{children:[l(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!z,children:"Clone environment"}),l(MTe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var jT={},BTe=En;Object.defineProperty(jT,"__esModule",{value:!0});var mD=jT.default=void 0,FTe=BTe(Tn()),zTe=kn,jTe=(0,FTe.default)((0,zTe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");mD=jT.default=jTe;const gD=({token:e})=>{const{setToastData:t}=$t();return x(Le,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,l(xt,{title:"Copy token",arrow:!0,children:l(Ht,{onClick:()=>{UL(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:l(mD,{})})})]})},UTe=({open:e,setOpen:t,token:n})=>x(gr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[l(se,{variant:"body1",children:"Your new token has been created successfully."}),x(se,{variant:"body1",children:['You can also find it as "',l("strong",{children:n==null?void 0:n.username}),'" in the'," ",l(hn,{to:"/admin/api",children:"API access page"}),"."]}),l(gD,{token:(n==null?void 0:n.secret)||""})]}),WTe=C(Le)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5)})),HTe=C(Ht)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",display:"none",color:e.palette.neutral.main})),VTe=C(u9,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),vD=({environment:e})=>x(WTe,{children:[l(HTe,{size:"large",disableRipple:!0,className:"drag-icon",children:l(nle,{titleAccess:"Drag to reorder"})}),l(VTe,{deprecated:!e.enabled})]}),GTe=C(la)(({theme:e})=>({marginTop:e.spacing(3)})),qTe=C("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),yD=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>l(vD,{environment:c})},{Header:"Name",accessor:"name",Cell:rr},{Header:"Type",accessor:"type",Cell:rr},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>x(rr,{children:[u,l(q,{condition:!!t,show:l(qTe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:s}=Yt.useTable({columns:n,data:[e],disableSortBy:!0});return x(GTe,{...r(),rowHeight:"compact",children:[l(sa,{headerGroups:i}),l(aa,{...o(),children:a.map(c=>(s(c),l(zi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>l(Wi,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},KTe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return x(gr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[l(q,{condition:o,show:l(tn,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:l(tn,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),l(yD,{environment:e})]})},YTe=C("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),XTe=C(Sr)(()=>({width:"100%"})),JTe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),x(gr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[x(tn,{severity:"error",children:[l("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),l(yD,{environment:e,warnEnabledToggles:!0}),x(YTe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",l("strong",{children:e.name})]}),l(XTe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},QTe=({environment:e})=>{const t=gt(),{setToastApiError:n,setToastData:r}=$t(),{environments:o,refetchEnvironments:i}=Td(),{refetch:a}=KE(),{deleteEnvironment:s,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=_d(),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[y,b]=m.useState(!1),[w,S]=m.useState();return x(Ha,{children:[l(wTe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<Nv?v(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Nv}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),l(JTe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await s(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(T){n(ht(T))}finally{p(!1),await i()}}}),l(KTe,{environment:e,open:f,setOpen:h,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(T){n(ht(T))}finally{h(!1),await i()}}}),l(DTe,{environment:e,open:g,setOpen:v,newToken:T=>{S(T),b(!0)}}),l(UTe,{open:y,setOpen:b,token:w})]})},ZTe=C(Le)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),eke=C("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),tke=C("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),gs=({value:e,subtitle:t})=>{const{searchQuery:n}=Al();return x(ZTe,{children:[l(eke,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:l(Ua,{search:n,children:e})}),l(q,{condition:!!t,show:()=>l(tke,{"data-loading":!0,children:l(Ua,{search:n,children:t})})})]})},nke=C(tn)(({theme:e})=>({marginBottom:e.spacing(4)})),rke=()=>{const{changeSortOrder:e}=_d(),{setToastApiError:t}=$t(),{environments:n,mutateEnvironments:r}=Td(),o=m.useCallback(async(y,b,w=!1)=>{const S=[...n],k=S[y];if(S.splice(y,1),S.splice(b,0,k),await r(S),w)try{await e(Jge(S))}catch(A){t(ht(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:s,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=Yt.useTable({columns:oke,data:n,disableSortBy:!0},Yt.useGlobalFilter),h=x(ve,{children:[l(vo,{initialValue:d,onChange:p}),l(Dn.Divider,{}),l(cTe,{})]});let g=c.length;const v=l(Dn,{title:`Environments (${g})`,actions:h});return x(Or,{header:v,children:[l(nke,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),l(Xa,{value:d,children:x(la,{...i(),rowHeight:"compact",children:[l(sa,{headerGroups:s}),l(aa,{...a(),children:c.map(y=>(u(y),l(fTe,{row:y,moveListItem:o},y.original.name)))})]})}),l(q,{condition:c.length===0,show:l(q,{condition:(d==null?void 0:d.length)>0,show:x(Kn,{children:["No environments found matching “",d,"”"]}),elseShow:l(Kn,{children:"No environments available. Get started by adding one."})})})]})},oke=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>l(vD,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>l(gTe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:gs},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:rr},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:rr},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>l(QTe,{environment:e}),disableGlobalFilter:!0}],ike=()=>{const e=Wa("projectId"),t=gt();return l(hi,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[y1,CE],projectId:e,"data-testid":cie,children:"New segment"})},ake=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),ske=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),lke=C("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),cke=C(hn)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),uke=()=>{const{hasAccess:e}=m.useContext(yo);return x(ake,{children:[l(ske,{children:"No segments yet!"}),l(lke,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),l(q,{condition:e(y1),show:l(cke,{to:"/segments/create",children:"Create your first segment"})})]})},dke=C(Sr)(({theme:e})=>({marginTop:e.spacing(2)})),pke=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=m.useState(""),a=u=>i(u.currentTarget.value),s=()=>{n(),i("")},c="delete-segment-confirmation-form";return x(gr,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:s,formId:c,children:[x("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",l("strong",{children:e==null?void 0:e.name})]}),l("form",{id:c,children:l(dke,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":wie})})]})},fke=C("ul")({marginBottom:0}),hke=C(hn)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),mke=({segment:e,open:t,onClose:n,strategies:r})=>x(gr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[x("p",{children:["The following feature toggles are using the"," ",l("strong",{children:e.name})," segment for their strategies:"]}),l(fke,{children:r==null?void 0:r.map(o=>l("li",{children:x(hke,{to:uD(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",gke(o)]})},o.id))})]}),gke=e=>e.strategyName?`(${yl(e.strategyName)})`:"",vke=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=yM(e.id),a=(o==null?void 0:o.length)===0;return i?null:l(q,{condition:a,show:l(pke,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:l(mke,{segment:e,open:t,onClose:n,strategies:o})})},yke=({segment:e})=>{const t=Wa("projectId"),{refetchSegments:n}=_l(),{deleteSegment:r}=pT(),{setToastData:o,setToastApiError:i}=$t(),[a,s]=m.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(ht(u))}finally{s(!1)}};return x(ve,{children:[l(Ir,{onClick:()=>s(!0),permission:[Fle,CE],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${bie}_${e.name}`,children:l(go,{"data-loading":!0})}),l(q,{condition:a,show:()=>l(vke,{segment:e,open:a,onClose:()=>s(!1),onRemove:c})})]})},bke=({segment:e})=>{const t=Wa("projectId"),n=gt();return l(Ir,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[xE,CE],projectId:t,tooltipProps:{title:"Edit segment"},children:l(Ui,{"data-loading":!0})})},wke=({segment:e})=>x(Ha,{children:[l(bke,{segment:e}),l(yke,{segment:e})]}),Ske=()=>{const e=Wa("projectId"),{segments:t,loading:n}=_l(),r=or(ml.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:g})=>g===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),{getTableProps:a,getTableBodyProps:s,headerGroups:c,rows:u,prepareRow:d,state:{globalFilter:p},setGlobalFilter:f,setHiddenColumns:h}=Yt.useTable({initialState:o,columns:A3,data:i,sortTypes:si,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:gs}},Yt.useGlobalFilter,Yt.useSortBy);return Ed([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],h,A3),l(Or,{header:l(Dn,{title:`Segments (${u.length})`,actions:x(ve,{children:[l(vo,{initialValue:p,onChange:f}),l(Dn.Divider,{}),l(ike,{})]})}),isLoading:n,children:l(q,{condition:!n&&i.length===0,show:l(Kn,{children:l(uke,{})}),elseShow:()=>x(ve,{children:[l(Xa,{value:p,children:x(la,{...a(),rowHeight:"standard",children:[l(sa,{headerGroups:c}),l(aa,{...s(),children:u.map(g=>(d(g),l(zi,{hover:!0,...g.getRowProps(),children:g.cells.map(v=>l(Wi,{...v.getCellProps(),children:v.render("Cell")}))})))})]})}),l(q,{condition:u.length===0&&(p==null?void 0:p.length)>0,show:x(Kn,{children:["No segments found matching “",p,"”"]})})]})})})},A3=[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>l(P1,{icon:l(d9,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({value:e,row:{original:t}})=>l(gs,{value:e,subtitle:t.description})},{Header:"Project",accessor:"project",Cell:({value:e})=>l(q,{condition:!!e,show:l(Rs,{title:e,to:`/projects/${e}`}),elseShow:l(rr,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:th,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>l(wke,{segment:e})},{accessor:"description"}],xke=e=>fetch(e).then(Rn("Feature toggle archive")).then(t=>t.json()),bD=e=>{const{data:t,error:n,mutate:r,isLoading:o}=An(Bt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),xke,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Cke=({onRevive:e,onDelete:t,project:n})=>x(Ha,{children:[l(Ir,{onClick:e,projectId:n,permission:SE,tooltipProps:{title:"Revive feature toggle"},children:l(g9,{})}),l(Ir,{permission:T9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:l(go,{})})]}),Eke=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{reviveFeature:async a=>{const s=`api/admin/archive/revive/${a}`,c=t(s,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const s=`api/admin/archive/${a}`,c=t(s,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},Tke=({value:e})=>{const{locationSettings:t}=Ja(),n=gn();return e?l(rr,{children:l(xt,{title:`Archived on: ${Xu(e,t.locale)}`,arrow:!0,children:l(se,{noWrap:!0,variant:"body2","data-loading":!0,children:l(x1,{date:new Date(e),title:"",live:!1})})})}):l(rr,{children:l(se,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},kke=C("p")(({theme:e})=>({marginTop:e.spacing(3)})),Ake=C(Sr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),Rke="I want to delete",wD=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=m.useState(""),{setToastData:s,setToastApiError:c}=$t(),{deleteFeatures:u}=Wh(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),s({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(h){c(ht(h))}finally{p()}},p=()=>{r(!1),a("")},f="delete-feature-toggle-confirmation-form";return x(gr,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:Rke!==i,formId:f,children:[x(tn,{severity:"warning",children:[l("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),x(kke,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",l("strong",{children:"I want to delete"})]}),l("form",{id:f,children:l(Ake,{autoFocus:!0,onChange:h=>{a(h.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},_ke=C(Le)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),Pke=({onChange:e,checked:t,title:n})=>l(_ke,{"data-testid":Fie,children:l(Ka,{onChange:e,title:n,checked:t})}),Ike=C("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),Oke=C(Le)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),$ke=C(wr)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),Nke=C("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),Lke=C(se)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),Mke=({count:e,children:t})=>e===0?null:l(Ike,{"data-testid":Die,children:l(Oke,{children:x($ke,{elevation:4,children:[x(Lke,{children:[l(Nke,{"data-testid":Bie,children:e})," selected"]}),t]})})}),Dke=({selectedIds:e,projectId:t})=>{const{reviveFeatures:n}=Wh(),{setToastData:r,setToastApiError:o}=$t(),{refetchArchived:i}=bD(t),[a,s]=m.useState(!1),{trackEvent:c}=Dr(),u=async()=>{try{await n(t,e),await i(),r({type:"success",title:"And we're back!",text:"The feature toggles have been revived."}),c("batch_operations",{props:{eventType:"features revived"}})}catch(p){o(ht(p))}},d=async()=>{s(!0)};return x(ve,{children:[l(pu,{projectId:t,permission:SE,children:({hasAccess:p})=>l(Ve,{disabled:!p,startIcon:l(g9,{}),variant:"outlined",size:"small",onClick:u,children:"Revive"})}),l(pu,{projectId:t,permission:T9,children:({hasAccess:p})=>l(Ve,{disabled:!p,startIcon:l(go,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),l(wD,{deletedFeatures:e,projectId:t,open:a,setOpen:s,refetch:()=>{i(),c("batch_operations",{props:{eventType:"features deleted"}})}})]})},Bke=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const s=or(ml.breakpoints.down("md")),c=or(ml.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=$t(),[p,f]=m.useState(!1),[h,g]=m.useState(),[v,y]=md(),{reviveFeature:b}=Eke(),[w,S]=m.useState(v.get("search")||""),k=m.useCallback(async V=>{try{await b(V),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(j){d(ht(j))}},[n,b,d,u]),A=m.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:V})=>l(Ka,{...V()}),Cell:({row:V})=>{var j;return l(Pke,{...(j=V==null?void 0:V.getToggleRowSelectedProps)==null?void 0:j.call(V)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",width:85,canSort:!0,Cell:H9,accessor:"lastSeenAt",align:"center"},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:K9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:V,row:{original:j}})=>l(gs,{value:V,subtitle:j.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:th,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Tke,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:V})=>l(Rs,{title:V,to:`/projects/${V}`})}],{Header:"State",accessor:"stale",Cell:eL,sortType:"boolean",maxWidth:120,filterName:"state",filterParsing:V=>V?"stale":"active"},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:V}})=>l(Cke,{project:V.project,onRevive:()=>k(V.name),onDelete:()=>{g(V),f(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a]),{data:T,getSearchText:R,getSearchContext:P}=jh(A,w,e),_=m.useMemo(()=>t?sL:T,[T,t]),[I]=m.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),$=m.useCallback(V=>V.name,[]),{headerGroups:U,rows:M,state:{sortBy:D,selectedRowIds:K},prepareRow:H,setHiddenColumns:Q}=Yt.useTable({columns:A,data:_,initialState:I,sortTypes:si,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:$},Yt.useFlexLayout,Yt.useSortBy,Yt.useRowSelect);return Ed([{condition:s,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],Q,A),m.useEffect(()=>{if(t)return;const V={};V.sort=D[0].id,D[0].desc&&(V.order="desc"),w&&(V.search=w),y(V,{replace:!0}),o({id:D[0].id,desc:D[0].desc||!1})},[t,D,w]),x(ve,{children:[x(Or,{isLoading:t,header:l(Dn,{titleElement:`${i} (${M.length<_.length?`${M.length} of ${_.length}`:_.length})`,actions:l(vo,{initialValue:w,onChange:S,hasFilters:!0,getSearchContext:P})}),children:[l(Xa,{value:R(w),children:l(b1,{rows:M,headerGroups:U,prepareRow:H})}),l(q,{condition:M.length===0,show:()=>l(q,{condition:(w==null?void 0:w.length)>0,show:x(Kn,{children:["No feature toggles found matching “",w,"”"]}),elseShow:l(Kn,{children:"None of the feature toggles were archived yet."})})}),l(wD,{deletedFeatures:[h==null?void 0:h.name],projectId:a??(h==null?void 0:h.project),open:p,setOpen:f,refetch:n})]}),l(q,{condition:!!a,show:l(Mke,{count:Object.keys(K).length,children:l(Dke,{selectedIds:Object.keys(K),projectId:a})})})]})},Fke={id:"createdAt"},{value:zke,setValue:jke}=Rc("FeaturesArchiveTable:v1",Fke),Uke=()=>{Y9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=bD();return l(Bke,{title:"Archive",archivedFeatures:e,loading:t,storedParams:zke,setStoredParams:jke,refetch:n})},Wke=m.lazy(()=>import("./Playground-130e9113.js")),Hke=C(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},justifyContent:"space-between"})),Vke=({label:e,selected:t,onClick:n})=>l(Hke,{selected:!!t,onClick:n,disableRipple:!0,disableElevation:!0,disableFocusRipple:!0,disableTouchRipple:!0,fullWidth:!0,children:e}),Gke=C("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),qke=C("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Kke=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),Yke=({tabs:e,value:t,onChange:n,children:r})=>x(Gke,{children:[l(Kke,{children:e.filter(o=>!o.hidden).map(o=>l(Vke,{label:o.label,selected:o.id===t,onClick:()=>n(o)},o.id))}),l(qke,{children:r})]}),SD=(e,t={})=>{const n=async()=>{const u=Bt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(Rn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=An(r,n,t),[a,s]=m.useState(!i&&!o),c=()=>{io(r)};return m.useEffect(()=>{s(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},Xke=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(s){throw s}},errors:n,loading:r}},Jke=C("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Qke=()=>{const{config:e,loading:t}=SD("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=$t(),[a,s]=m.useState(!1),[c,u]=m.useState(),[d,p]=m.useState(""),[f,h]=m.useState(""),{changePassword:g}=Xke(),v=async y=>{if(y.preventDefault(),d===f){if(!a)u(RL);else{r(!0),u(void 0);try{await g({password:d,confirmPassword:f}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(b){const w=ht(b);u(w),i(w)}}r(!1)}};return t?null:l(Or,{isLoading:n,header:"Change password",children:l(q,{condition:e.disabled,show:l(tn,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:x(Jke,{children:[l(_L,{password:d,callback:s,"data-loading":!0}),l(Zu,{"data-loading":!0,label:"Password",name:"password",value:d,error:!!c,helperText:c,autoComplete:"new-password",onChange:y=>p(y.target.value)}),l(Zu,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:f,autoComplete:"new-password",onChange:y=>h(y.target.value)}),l(IL,{"data-loading":!0,started:!!(d&&f),matchingPasswords:d===f}),l(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:v,children:"Save"})]})})})},Zke=10,UT=()=>{const{data:e,error:t,mutate:n}=An(Bt("api/admin/user/tokens"),eAe);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},eAe=e=>fetch(e).then(Rn("Personal API Tokens")).then(t=>t.json()),xD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{createPersonalAPIToken:async c=>{const u=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(c)});try{return await(await e(u.caller,u.id)).json()}catch(d){throw d}},deletePersonalAPIToken:async c=>{const u=t(`api/admin/user/tokens/${c}`,{method:"DELETE"});try{await e(u.caller,u.id)}catch(d){throw d}},createUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat`,{method:"POST",body:JSON.stringify(u)});try{return await(await e(d.caller,d.id)).json()}catch(p){throw p}},deleteUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat/${u}`,{method:"DELETE"});try{await e(d.caller,d.id)}catch(p){throw p}},errors:n,loading:r}},tAe=e=>{const t=new Date(e);return eh(t,"yyyy-MM-dd")},nAe=e=>{const t=new Date(e);return eh(t,"yyyy-MM-dd")+"T"+eh(t,"HH:mm")},rAe=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:s,...c})=>{const u=t==="datetime"?nAe:tAe;return l(wn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=zL(p.target.value);s(f??a)},FormHelperTextProps:{["data-testid"]:ON},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},R3=C("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),oAe=C(Sr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),iAe=C("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),aAe=C(YE)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),sAe=C(rAe)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),lAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var CD=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(CD||{});const ED=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],_x=e=>{const t=new Date,n=ED.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},cAe=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:s,setErrors:c})=>{const{locationSettings:u}=Ja(),d=v=>{c(y=>({...y,[v]:void 0}))},p=(v,y)=>{c(b=>({...b,[v]:y}))};m.useEffect(()=>{d("expiresAt"),a(_x(r))},[r]);const f=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return x(ve,{children:[l(R3,{children:"Describe what this token will be used for"}),l(oAe,{autoFocus:!0,label:"Description",error:!!s.description,errorText:s.description,value:e,onChange:v=>f(v.target.value),required:!0}),l(R3,{children:"Token expiration date"}),x(iAe,{custom:h,children:[l(aAe,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:ED}),l(q,{condition:h,show:()=>l(sAe,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:!!s.expiresAt,errorText:s.expiresAt,required:!0}),elseShow:l(q,{condition:g,show:x(se,{variant:"body2",children:["The token will ",l("strong",{children:"never"})," ","expire!"]}),elseShow:()=>x(se,{variant:"body2",children:["Token will expire on"," ",l("strong",{children:Xu(i,u.locale)})]})})})]}),l(q,{condition:g,show:l(lAe,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},uAe=C("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),dAe=C("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),pAe=C(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),cg=CD["30DAYS"],fAe=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=UT(),{createPersonalAPIToken:i,loading:a}=xD(),{setToastApiError:s}=$t(),{uiConfig:c}=Ot(),[u,d]=m.useState(""),[p,f]=m.useState(cg),[h,g]=m.useState(_x(cg)),[v,y]=m.useState({});m.useEffect(()=>{d(""),f(cg),g(_x(cg)),y({})},[e]);const b=()=>({description:u,expiresAt:h}),w=async R=>{R.preventDefault();try{const P=await i(b());n(P),o(),t(!1)}catch(P){s(ht(P))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
356
+ --data-raw '${JSON.stringify(D(),void 0,2)}'`,V=Z=>Z.length,j=Z=>!(o!=null&&o.some(ae=>ae.name===Z)),z=V(h)&&j(h)&&S.length,O=Z=>{$("name"),j(Z)||U("name","An environment with that name already exists."),g(Z)},B=u.map(Z=>({value:Z.id,label:Z.name}));return l(X1,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:l(Yr,{loading:s,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:Q,children:x(ITe,{onSubmit:H,children:[x("div",{children:[l(Jc,{children:"What is your new environment name? (Can't be changed later)"}),l(OTe,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:Z=>O(Z.target.value),required:!0}),l(Jc,{children:"What type of environment do you want to create?"}),l(FL,{onChange:Z=>y(Z.currentTarget.value),value:v}),x(Jc,{children:["Select which projects you want to clone the environment configuration in?",l(Qu,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),l(kTe,{projects:b,setProjects:w}),l(Jc,{children:"Keep the users permission for this environment?"}),l(mw,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),l(Hr,{label:A?"Yes":"No",control:l(Ya,{onChange:Z=>T(Z.target.checked),checked:A})}),x($Te,{children:[l(Jc,{children:"API Token"}),x(mw,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",l(Vr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),l(ks,{children:x(q2,{value:R,onChange:Z=>P(Z.target.value),name:"api-token-generation",children:[l(Hr,{value:"later",control:l(nc,{}),label:"I want to generate an API token later"}),l(Hr,{value:"now",control:l(nc,{}),label:"Generate an API token now"})]})}),x(NTe,{children:[l(mw,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),l(q,{condition:R==="now",show:x(ve,{children:[l(Jc,{children:"Which projects do you want this token to give access to?"}),l(_Te,{options:B,defaultValue:S,onChange:k,error:_.projects,onFocus:()=>$("projects")})]})})]})]})]}),x(LTe,{children:[l(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!z,children:"Clone environment"}),l(MTe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var jT={},BTe=En;Object.defineProperty(jT,"__esModule",{value:!0});var mD=jT.default=void 0,FTe=BTe(Tn()),zTe=kn,jTe=(0,FTe.default)((0,zTe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");mD=jT.default=jTe;const gD=({token:e})=>{const{setToastData:t}=$t();return x(Le,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,l(xt,{title:"Copy token",arrow:!0,children:l(Ht,{onClick:()=>{UL(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:l(mD,{})})})]})},UTe=({open:e,setOpen:t,token:n})=>x(gr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[l(se,{variant:"body1",children:"Your new token has been created successfully."}),x(se,{variant:"body1",children:['You can also find it as "',l("strong",{children:n==null?void 0:n.username}),'" in the'," ",l(hn,{to:"/admin/api",children:"API access page"}),"."]}),l(gD,{token:(n==null?void 0:n.secret)||""})]}),WTe=C(Le)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5)})),HTe=C(Ht)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",display:"none",color:e.palette.neutral.main})),VTe=C(u9,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),vD=({environment:e})=>x(WTe,{children:[l(HTe,{size:"large",disableRipple:!0,className:"drag-icon",children:l(nle,{titleAccess:"Drag to reorder"})}),l(VTe,{deprecated:!e.enabled})]}),GTe=C(la)(({theme:e})=>({marginTop:e.spacing(3)})),qTe=C("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),yD=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>l(vD,{environment:c})},{Header:"Name",accessor:"name",Cell:rr},{Header:"Type",accessor:"type",Cell:rr},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>x(rr,{children:[u,l(q,{condition:!!t,show:l(qTe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:s}=Yt.useTable({columns:n,data:[e],disableSortBy:!0});return x(GTe,{...r(),rowHeight:"compact",children:[l(sa,{headerGroups:i}),l(aa,{...o(),children:a.map(c=>(s(c),l(zi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>l(Wi,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},KTe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return x(gr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[l(q,{condition:o,show:l(tn,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:l(tn,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),l(yD,{environment:e})]})},YTe=C("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),XTe=C(Sr)(()=>({width:"100%"})),JTe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),x(gr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[x(tn,{severity:"error",children:[l("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),l(yD,{environment:e,warnEnabledToggles:!0}),x(YTe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",l("strong",{children:e.name})]}),l(XTe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},QTe=({environment:e})=>{const t=gt(),{setToastApiError:n,setToastData:r}=$t(),{environments:o,refetchEnvironments:i}=Td(),{refetch:a}=KE(),{deleteEnvironment:s,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=_d(),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[y,b]=m.useState(!1),[w,S]=m.useState();return x(Ha,{children:[l(wTe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<Nv?v(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Nv}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),l(JTe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await s(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(T){n(ht(T))}finally{p(!1),await i()}}}),l(KTe,{environment:e,open:f,setOpen:h,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(T){n(ht(T))}finally{h(!1),await i()}}}),l(DTe,{environment:e,open:g,setOpen:v,newToken:T=>{S(T),b(!0)}}),l(UTe,{open:y,setOpen:b,token:w})]})},ZTe=C(Le)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),eke=C("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),tke=C("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),gs=({value:e,subtitle:t})=>{const{searchQuery:n}=Al();return x(ZTe,{children:[l(eke,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:l(Ua,{search:n,children:e})}),l(q,{condition:!!t,show:()=>l(tke,{"data-loading":!0,children:l(Ua,{search:n,children:t})})})]})},nke=C(tn)(({theme:e})=>({marginBottom:e.spacing(4)})),rke=()=>{const{changeSortOrder:e}=_d(),{setToastApiError:t}=$t(),{environments:n,mutateEnvironments:r}=Td(),o=m.useCallback(async(y,b,w=!1)=>{const S=[...n],k=S[y];if(S.splice(y,1),S.splice(b,0,k),await r(S),w)try{await e(Jge(S))}catch(A){t(ht(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:s,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=Yt.useTable({columns:oke,data:n,disableSortBy:!0},Yt.useGlobalFilter),h=x(ve,{children:[l(vo,{initialValue:d,onChange:p}),l(Dn.Divider,{}),l(cTe,{})]});let g=c.length;const v=l(Dn,{title:`Environments (${g})`,actions:h});return x(Or,{header:v,children:[l(nke,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),l(Xa,{value:d,children:x(la,{...i(),rowHeight:"compact",children:[l(sa,{headerGroups:s}),l(aa,{...a(),children:c.map(y=>(u(y),l(fTe,{row:y,moveListItem:o},y.original.name)))})]})}),l(q,{condition:c.length===0,show:l(q,{condition:(d==null?void 0:d.length)>0,show:x(Kn,{children:["No environments found matching “",d,"”"]}),elseShow:l(Kn,{children:"No environments available. Get started by adding one."})})})]})},oke=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>l(vD,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>l(gTe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:gs},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:rr},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:rr},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>l(QTe,{environment:e}),disableGlobalFilter:!0}],ike=()=>{const e=Wa("projectId"),t=gt();return l(hi,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[y1,CE],projectId:e,"data-testid":cie,children:"New segment"})},ake=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),ske=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),lke=C("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),cke=C(hn)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),uke=()=>{const{hasAccess:e}=m.useContext(yo);return x(ake,{children:[l(ske,{children:"No segments yet!"}),l(lke,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),l(q,{condition:e(y1),show:l(cke,{to:"/segments/create",children:"Create your first segment"})})]})},dke=C(Sr)(({theme:e})=>({marginTop:e.spacing(2)})),pke=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=m.useState(""),a=u=>i(u.currentTarget.value),s=()=>{n(),i("")},c="delete-segment-confirmation-form";return x(gr,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:s,formId:c,children:[x("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",l("strong",{children:e==null?void 0:e.name})]}),l("form",{id:c,children:l(dke,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":wie})})]})},fke=C("ul")({marginBottom:0}),hke=C(hn)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),mke=({segment:e,open:t,onClose:n,strategies:r})=>x(gr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[x("p",{children:["The following feature toggles are using the"," ",l("strong",{children:e.name})," segment for their strategies:"]}),l(fke,{children:r==null?void 0:r.map(o=>l("li",{children:x(hke,{to:uD(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",gke(o)]})},o.id))})]}),gke=e=>e.strategyName?`(${yl(e.strategyName)})`:"",vke=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=yM(e.id),a=(o==null?void 0:o.length)===0;return i?null:l(q,{condition:a,show:l(pke,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:l(mke,{segment:e,open:t,onClose:n,strategies:o})})},yke=({segment:e})=>{const t=Wa("projectId"),{refetchSegments:n}=_l(),{deleteSegment:r}=pT(),{setToastData:o,setToastApiError:i}=$t(),[a,s]=m.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(ht(u))}finally{s(!1)}};return x(ve,{children:[l(Ir,{onClick:()=>s(!0),permission:[Fle,CE],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${bie}_${e.name}`,children:l(go,{"data-loading":!0})}),l(q,{condition:a,show:()=>l(vke,{segment:e,open:a,onClose:()=>s(!1),onRemove:c})})]})},bke=({segment:e})=>{const t=Wa("projectId"),n=gt();return l(Ir,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[xE,CE],projectId:t,tooltipProps:{title:"Edit segment"},children:l(Ui,{"data-loading":!0})})},wke=({segment:e})=>x(Ha,{children:[l(bke,{segment:e}),l(yke,{segment:e})]}),Ske=()=>{const e=Wa("projectId"),{segments:t,loading:n}=_l(),r=or(ml.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:g})=>g===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),{getTableProps:a,getTableBodyProps:s,headerGroups:c,rows:u,prepareRow:d,state:{globalFilter:p},setGlobalFilter:f,setHiddenColumns:h}=Yt.useTable({initialState:o,columns:A3,data:i,sortTypes:si,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:gs}},Yt.useGlobalFilter,Yt.useSortBy);return Ed([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],h,A3),l(Or,{header:l(Dn,{title:`Segments (${u.length})`,actions:x(ve,{children:[l(vo,{initialValue:p,onChange:f}),l(Dn.Divider,{}),l(ike,{})]})}),isLoading:n,children:l(q,{condition:!n&&i.length===0,show:l(Kn,{children:l(uke,{})}),elseShow:()=>x(ve,{children:[l(Xa,{value:p,children:x(la,{...a(),rowHeight:"standard",children:[l(sa,{headerGroups:c}),l(aa,{...s(),children:u.map(g=>(d(g),l(zi,{hover:!0,...g.getRowProps(),children:g.cells.map(v=>l(Wi,{...v.getCellProps(),children:v.render("Cell")}))})))})]})}),l(q,{condition:u.length===0&&(p==null?void 0:p.length)>0,show:x(Kn,{children:["No segments found matching “",p,"”"]})})]})})})},A3=[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>l(P1,{icon:l(d9,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({value:e,row:{original:t}})=>l(gs,{value:e,subtitle:t.description})},{Header:"Project",accessor:"project",Cell:({value:e})=>l(q,{condition:!!e,show:l(Rs,{title:e,to:`/projects/${e}`}),elseShow:l(rr,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:th,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>l(wke,{segment:e})},{accessor:"description"}],xke=e=>fetch(e).then(Rn("Feature toggle archive")).then(t=>t.json()),bD=e=>{const{data:t,error:n,mutate:r,isLoading:o}=An(Bt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),xke,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Cke=({onRevive:e,onDelete:t,project:n})=>x(Ha,{children:[l(Ir,{onClick:e,projectId:n,permission:SE,tooltipProps:{title:"Revive feature toggle"},children:l(g9,{})}),l(Ir,{permission:T9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:l(go,{})})]}),Eke=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{reviveFeature:async a=>{const s=`api/admin/archive/revive/${a}`,c=t(s,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const s=`api/admin/archive/${a}`,c=t(s,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},Tke=({value:e})=>{const{locationSettings:t}=Ja(),n=gn();return e?l(rr,{children:l(xt,{title:`Archived on: ${Xu(e,t.locale)}`,arrow:!0,children:l(se,{noWrap:!0,variant:"body2","data-loading":!0,children:l(x1,{date:new Date(e),title:"",live:!1})})})}):l(rr,{children:l(se,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},kke=C("p")(({theme:e})=>({marginTop:e.spacing(3)})),Ake=C(Sr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),Rke="I want to delete",wD=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=m.useState(""),{setToastData:s,setToastApiError:c}=$t(),{deleteFeatures:u}=Wh(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),s({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(h){c(ht(h))}finally{p()}},p=()=>{r(!1),a("")},f="delete-feature-toggle-confirmation-form";return x(gr,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:Rke!==i,formId:f,children:[x(tn,{severity:"warning",children:[l("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),x(kke,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",l("strong",{children:"I want to delete"})]}),l("form",{id:f,children:l(Ake,{autoFocus:!0,onChange:h=>{a(h.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},_ke=C(Le)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),Pke=({onChange:e,checked:t,title:n})=>l(_ke,{"data-testid":Fie,children:l(Ka,{onChange:e,title:n,checked:t})}),Ike=C("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),Oke=C(Le)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),$ke=C(wr)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),Nke=C("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),Lke=C(se)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),Mke=({count:e,children:t})=>e===0?null:l(Ike,{"data-testid":Die,children:l(Oke,{children:x($ke,{elevation:4,children:[x(Lke,{children:[l(Nke,{"data-testid":Bie,children:e})," selected"]}),t]})})}),Dke=({selectedIds:e,projectId:t})=>{const{reviveFeatures:n}=Wh(),{setToastData:r,setToastApiError:o}=$t(),{refetchArchived:i}=bD(t),[a,s]=m.useState(!1),{trackEvent:c}=Dr(),u=async()=>{try{await n(t,e),await i(),r({type:"success",title:"And we're back!",text:"The feature toggles have been revived."}),c("batch_operations",{props:{eventType:"features revived"}})}catch(p){o(ht(p))}},d=async()=>{s(!0)};return x(ve,{children:[l(pu,{projectId:t,permission:SE,children:({hasAccess:p})=>l(Ve,{disabled:!p,startIcon:l(g9,{}),variant:"outlined",size:"small",onClick:u,children:"Revive"})}),l(pu,{projectId:t,permission:T9,children:({hasAccess:p})=>l(Ve,{disabled:!p,startIcon:l(go,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),l(wD,{deletedFeatures:e,projectId:t,open:a,setOpen:s,refetch:()=>{i(),c("batch_operations",{props:{eventType:"features deleted"}})}})]})},Bke=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const s=or(ml.breakpoints.down("md")),c=or(ml.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=$t(),[p,f]=m.useState(!1),[h,g]=m.useState(),[v,y]=md(),{reviveFeature:b}=Eke(),[w,S]=m.useState(v.get("search")||""),k=m.useCallback(async V=>{try{await b(V),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(j){d(ht(j))}},[n,b,d,u]),A=m.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:V})=>l(Ka,{...V()}),Cell:({row:V})=>{var j;return l(Pke,{...(j=V==null?void 0:V.getToggleRowSelectedProps)==null?void 0:j.call(V)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",width:85,canSort:!0,Cell:H9,accessor:"lastSeenAt",align:"center"},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:K9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:V,row:{original:j}})=>l(gs,{value:V,subtitle:j.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:th,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Tke,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:V})=>l(Rs,{title:V,to:`/projects/${V}`})}],{Header:"State",accessor:"stale",Cell:eL,sortType:"boolean",maxWidth:120,filterName:"state",filterParsing:V=>V?"stale":"active"},{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:V}})=>l(Cke,{project:V.project,onRevive:()=>k(V.name),onDelete:()=>{g(V),f(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a]),{data:T,getSearchText:R,getSearchContext:P}=jh(A,w,e),_=m.useMemo(()=>t?sL:T,[T,t]),[I]=m.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),$=m.useCallback(V=>V.name,[]),{headerGroups:U,rows:M,state:{sortBy:D,selectedRowIds:K},prepareRow:H,setHiddenColumns:Q}=Yt.useTable({columns:A,data:_,initialState:I,sortTypes:si,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:$},Yt.useFlexLayout,Yt.useSortBy,Yt.useRowSelect);return Ed([{condition:s,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],Q,A),m.useEffect(()=>{if(t)return;const V={};V.sort=D[0].id,D[0].desc&&(V.order="desc"),w&&(V.search=w),y(V,{replace:!0}),o({id:D[0].id,desc:D[0].desc||!1})},[t,D,w]),x(ve,{children:[x(Or,{isLoading:t,header:l(Dn,{titleElement:`${i} (${M.length<_.length?`${M.length} of ${_.length}`:_.length})`,actions:l(vo,{initialValue:w,onChange:S,hasFilters:!0,getSearchContext:P})}),children:[l(Xa,{value:R(w),children:l(b1,{rows:M,headerGroups:U,prepareRow:H})}),l(q,{condition:M.length===0,show:()=>l(q,{condition:(w==null?void 0:w.length)>0,show:x(Kn,{children:["No feature toggles found matching “",w,"”"]}),elseShow:l(Kn,{children:"None of the feature toggles were archived yet."})})}),l(wD,{deletedFeatures:[h==null?void 0:h.name],projectId:a??(h==null?void 0:h.project),open:p,setOpen:f,refetch:n})]}),l(q,{condition:!!a,show:l(Mke,{count:Object.keys(K).length,children:l(Dke,{selectedIds:Object.keys(K),projectId:a})})})]})},Fke={id:"createdAt"},{value:zke,setValue:jke}=Rc("FeaturesArchiveTable:v1",Fke),Uke=()=>{Y9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=bD();return l(Bke,{title:"Archive",archivedFeatures:e,loading:t,storedParams:zke,setStoredParams:jke,refetch:n})},Wke=m.lazy(()=>import("./Playground-6602cb1a.js")),Hke=C(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},justifyContent:"space-between"})),Vke=({label:e,selected:t,onClick:n})=>l(Hke,{selected:!!t,onClick:n,disableRipple:!0,disableElevation:!0,disableFocusRipple:!0,disableTouchRipple:!0,fullWidth:!0,children:e}),Gke=C("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),qke=C("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),Kke=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),Yke=({tabs:e,value:t,onChange:n,children:r})=>x(Gke,{children:[l(Kke,{children:e.filter(o=>!o.hidden).map(o=>l(Vke,{label:o.label,selected:o.id===t,onClick:()=>n(o)},o.id))}),l(qke,{children:r})]}),SD=(e,t={})=>{const n=async()=>{const u=Bt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(Rn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=An(r,n,t),[a,s]=m.useState(!i&&!o),c=()=>{io(r)};return m.useEffect(()=>{s(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},Xke=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(s){throw s}},errors:n,loading:r}},Jke=C("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),Qke=()=>{const{config:e,loading:t}=SD("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=$t(),[a,s]=m.useState(!1),[c,u]=m.useState(),[d,p]=m.useState(""),[f,h]=m.useState(""),{changePassword:g}=Xke(),v=async y=>{if(y.preventDefault(),d===f){if(!a)u(RL);else{r(!0),u(void 0);try{await g({password:d,confirmPassword:f}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(b){const w=ht(b);u(w),i(w)}}r(!1)}};return t?null:l(Or,{isLoading:n,header:"Change password",children:l(q,{condition:e.disabled,show:l(tn,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:x(Jke,{children:[l(_L,{password:d,callback:s,"data-loading":!0}),l(Zu,{"data-loading":!0,label:"Password",name:"password",value:d,error:!!c,helperText:c,autoComplete:"new-password",onChange:y=>p(y.target.value)}),l(Zu,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:f,autoComplete:"new-password",onChange:y=>h(y.target.value)}),l(IL,{"data-loading":!0,started:!!(d&&f),matchingPasswords:d===f}),l(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:v,children:"Save"})]})})})},Zke=10,UT=()=>{const{data:e,error:t,mutate:n}=An(Bt("api/admin/user/tokens"),eAe);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},eAe=e=>fetch(e).then(Rn("Personal API Tokens")).then(t=>t.json()),xD=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{createPersonalAPIToken:async c=>{const u=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(c)});try{return await(await e(u.caller,u.id)).json()}catch(d){throw d}},deletePersonalAPIToken:async c=>{const u=t(`api/admin/user/tokens/${c}`,{method:"DELETE"});try{await e(u.caller,u.id)}catch(d){throw d}},createUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat`,{method:"POST",body:JSON.stringify(u)});try{return await(await e(d.caller,d.id)).json()}catch(p){throw p}},deleteUserPersonalAPIToken:async(c,u)=>{const d=t(`api/admin/user-admin/${c}/pat/${u}`,{method:"DELETE"});try{await e(d.caller,d.id)}catch(p){throw p}},errors:n,loading:r}},tAe=e=>{const t=new Date(e);return eh(t,"yyyy-MM-dd")},nAe=e=>{const t=new Date(e);return eh(t,"yyyy-MM-dd")+"T"+eh(t,"HH:mm")},rAe=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:s,...c})=>{const u=t==="datetime"?nAe:tAe;return l(wn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=zL(p.target.value);s(f??a)},FormHelperTextProps:{["data-testid"]:ON},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},R3=C("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),oAe=C(Sr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),iAe=C("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),aAe=C(YE)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),sAe=C(rAe)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),lAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var CD=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(CD||{});const ED=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],_x=e=>{const t=new Date,n=ED.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},cAe=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:s,setErrors:c})=>{const{locationSettings:u}=Ja(),d=v=>{c(y=>({...y,[v]:void 0}))},p=(v,y)=>{c(b=>({...b,[v]:y}))};m.useEffect(()=>{d("expiresAt"),a(_x(r))},[r]);const f=v=>{d("description"),n&&!n(v)&&p("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return x(ve,{children:[l(R3,{children:"Describe what this token will be used for"}),l(oAe,{autoFocus:!0,label:"Description",error:!!s.description,errorText:s.description,value:e,onChange:v=>f(v.target.value),required:!0}),l(R3,{children:"Token expiration date"}),x(iAe,{custom:h,children:[l(aAe,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:ED}),l(q,{condition:h,show:()=>l(sAe,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&p("expiresAt","Invalid date, must be in the future"),a(v)},min:new Date,error:!!s.expiresAt,errorText:s.expiresAt,required:!0}),elseShow:l(q,{condition:g,show:x(se,{variant:"body2",children:["The token will ",l("strong",{children:"never"})," ","expire!"]}),elseShow:()=>x(se,{variant:"body2",children:["Token will expire on"," ",l("strong",{children:Xu(i,u.locale)})]})})})]}),l(q,{condition:g,show:l(lAe,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},uAe=C("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),dAe=C("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),pAe=C(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),cg=CD["30DAYS"],fAe=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=UT(),{createPersonalAPIToken:i,loading:a}=xD(),{setToastApiError:s}=$t(),{uiConfig:c}=Ot(),[u,d]=m.useState(""),[p,f]=m.useState(cg),[h,g]=m.useState(_x(cg)),[v,y]=m.useState({});m.useEffect(()=>{d(""),f(cg),g(_x(cg)),y({})},[e]);const b=()=>({description:u,expiresAt:h}),w=async R=>{R.preventDefault();try{const P=await i(b());n(P),o(),t(!1)}catch(P){s(ht(P))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
357
357
  --header 'Authorization: INSERT_API_KEY' \\
358
358
  --header 'Content-Type: application/json' \\
359
359
  --data-raw '${JSON.stringify(b(),void 0,2)}'`,k=R=>R.length,A=R=>!(r!=null&&r.some(P=>P.description===R)),T=k(u)&&A(u)&&h>new Date;return l(X1,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:l(Yr,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
360
360
  yourself. A personal API token has the same access privileges as
361
- your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:x(uAe,{onSubmit:w,children:[l("div",{children:l(cAe,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:g,errors:v,setErrors:y})}),x(dAe,{children:[l(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!T,children:"Create token"}),l(pAe,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},hAe=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=UT(),{deletePersonalAPIToken:o}=xD(),{setToastData:i,setToastApiError:a}=$t();return l(gr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(ht(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:x(se,{children:['Any applications or scripts using this token "',l("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},mAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(3)})),gAe=({open:e,setOpen:t,token:n})=>x(gr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[l(mAe,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),l(se,{variant:"body1",children:"Your token:"}),l(gD,{token:(n==null?void 0:n.secret)||""})]}),TD=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=Xu})=>{const{locationSettings:i}=Ja();if(!e)return l(rr,{children:n});const a=o(e,i.locale);return l(rr,{children:l(xt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:l(se,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:l(x1,{date:new Date(e),live:t,title:""})})})})},vAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(3)})),yAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),bAe=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),wAe=C(se)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),SAe=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),xAe={id:"createdAt"},{value:_3,setValue:CAe}=Rc("PersonalAPITokensTable:v1",xAe),EAe=()=>{const e=gn(),t=or(e.breakpoints.down("md")),n=or(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=UT(),[i,a]=md(),[s]=m.useState(()=>({sortBy:[{id:i.get("sort")||_3.id,desc:i.has("order")?i.get("order")==="desc":_3.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(s.globalFilter),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[y,b]=m.useState(),[w,S]=m.useState(),k=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:gs,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:D})=>new Date(D).getFullYear()>new Date().getFullYear()+100?l(rr,{children:"Never"}):l(th,{value:D}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:th,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:TD,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:D}})=>l(Ha,{children:l(xt,{title:"Delete token",arrow:!0,describeChild:!0,children:l("span",{children:l(Ht,{onClick:()=>{S(D),v(!0)},children:l(go,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:A,getSearchText:T,getSearchContext:R}=jh(k,c,r),P=m.useMemo(()=>(A==null?void 0:A.length)===0&&o?SAe:A,[A,o]),{headerGroups:_,rows:I,prepareRow:$,state:{sortBy:U},setHiddenColumns:M}=Yt.useTable({columns:k,data:P,initialState:s,sortTypes:si,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Yt.useSortBy,Yt.useFlexLayout);return Ed([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],M,k),m.useEffect(()=>{const D={};D.sort=U[0].id,U[0].desc&&(D.order="desc"),c&&(D.search=c),a(D,{replace:!0}),CAe({id:U[0].id,desc:U[0].desc||!1})},[U,c,a]),x(Or,{isLoading:o,header:l(Dn,{title:`Personal API tokens (${I.length<P.length?`${I.length} of ${P.length}`:P.length})`,actions:x(ve,{children:[l(q,{condition:!t,show:x(ve,{children:[l(vo,{initialValue:c,onChange:u,getSearchContext:R}),l(Dn.Divider,{})]})}),l(Ve,{variant:"contained",color:"primary",disabled:r.length>=Zke,onClick:()=>p(!0),children:"New token"})]}),children:l(q,{condition:t,show:l(vo,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:R})})}),children:[l(vAe,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),l(Xa,{value:T(c),children:l(b1,{rows:I,headerGroups:_,prepareRow:$})}),l(q,{condition:I.length===0,show:l(q,{condition:(c==null?void 0:c.length)>0,show:x(Kn,{children:["No tokens found matching “",c,"”"]}),elseShow:x(yAe,{children:[l(bAe,{children:"You have no personal API tokens yet."}),l(wAe,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),l(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),l(fAe,{open:d,setOpen:p,newToken:D=>{b(D),h(!0)}}),l(gAe,{open:f,setOpen:h,token:y}),l(hAe,{open:g,setOpen:v,token:w})]})},TAe=()=>{const{data:e,error:t,mutate:n}=An(Bt("api/admin/user/profile"),kAe);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},kAe=e=>fetch(e).then(Rn("Profile")).then(t=>t.json());var WT={},AAe=En;Object.defineProperty(WT,"__esModule",{value:!0});var Bs=WT.default=void 0,RAe=AAe(Tn()),_Ae=kn,PAe=(0,RAe.default)((0,_Ae.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");Bs=WT.default=PAe;var HT={},IAe=En;Object.defineProperty(HT,"__esModule",{value:!0});var kD=HT.default=void 0,OAe=IAe(Tn()),$Ae=kn,NAe=(0,OAe.default)((0,$Ae.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");kD=HT.default=NAe;const LAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),MAe=C("div")(()=>({flexGrow:1})),DAe=C(se)(({theme:e})=>({fontSize:e.spacing(3.75)})),BAe=C(cE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),P3=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),FAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),zAe=C(Zt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),jAe=C("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),UAe=C(ks)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),WAe=C(Ih)(({theme:e})=>({backgroundColor:e.palette.background.paper})),HAe=({user:e})=>{const{profile:t}=TAe(),n=gt(),{locationSettings:r,setLocationSettings:o}=Ja(),[i,a]=m.useState(),[s,c]=m.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);m.useEffect(()=>{const d=s.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return x(ve,{children:[x(LAe,{children:[l(BAe,{user:e}),x(MAe,{children:[l(DAe,{children:e.name||e.username}),l(se,{variant:"body1",children:e.email})]})]}),x(Or,{children:[l(P3,{children:"Access"}),x(FAe,{children:[x(Le,{sx:{width:"50%"},children:[l(se,{variant:"body2",children:"Your root role"}),l(xt,{title:(t==null?void 0:t.rootRole.description)||"",arrow:!0,placement:"bottom-end",describeChild:!0,children:l(Zt,{color:"success",icon:l(Bs,{}),iconRight:!0,children:t==null?void 0:t.rootRole.name})})]}),x(Le,{children:[l(se,{variant:"body2",children:"Projects"}),l(q,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>l(xt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:l(zAe,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:l(kD,{}),children:d})},d)),elseShow:l(xt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:l(Zt,{children:"No projects"})})})]})]}),l(jAe,{}),l(P3,{children:"Settings"}),l(se,{variant:"body2",children:"This is the format used across the system for time and date"}),x(UAe,{variant:"outlined",size:"small",children:[l(WAe,{htmlFor:"locale-select",children:"Date/Time formatting"}),l(Oh,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:s.map(d=>l("option",{value:d,children:d},d))})]})]})]})},VAe=()=>{const{user:e}=pi(),t=Ho(),n=gt(),{config:r,loading:o}=SD("simple"),{uiConfig:i}=Ot(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],s=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:x(Yke,{tabs:a,value:u,onChange:s,children:[l(q,{condition:u==="profile",show:l(HAe,{user:e})}),l(q,{condition:u==="password",show:l(Qke,{})}),l(q,{condition:u==="pat",show:l(EAe,{})})]})},GAe=m.lazy(()=>import("./CreateProject-3c093214.js")),qAe=m.lazy(()=>import("./FeatureViewLazyExport-e52ae7b0.js")),KAe=m.lazy(()=>import("./LazyAdminExport-2554e446.js")),YAe=m.lazy(()=>import("./LazyProjectExport-682e75c0.js")),XAe=()=>l(kc,{to:"/admin/users",replace:!0}),JAe=()=>{const{isEnterprise:e}=Ot(),{data:t,error:n,mutate:r}=zh(e(),{events:[]},Bt("api/admin/logins"),QAe);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},QAe=e=>fetch(e).then(Rn("Login History")).then(t=>t.json()),I3=C(Le)(()=>({display:"flex",justifyContent:"center"})),ZAe=({row:e,value:t})=>{const{searchQuery:n}=Al();return t?l(I3,{children:l(Zt,{color:"success",children:"True"})}):l(I3,{children:l(Fh,{arrow:!0,title:l(Ua,{search:n,children:e.original.failure_reason}),children:l(Zt,{color:"error",children:"False"})})})},eRe=C(Le)(()=>({display:"flex",justifyContent:"center"})),tRe=({onDelete:e})=>l(eRe,{children:l(Ir,{"data-loading":!0,onClick:e,permission:fi,tooltipProps:{title:"Remove event"},children:l(go,{})})}),nRe=({event:e,open:t,setOpen:n,onConfirm:r})=>x(gr,{title:"Delete event?",open:t,primaryButtonText:"Delete event",secondaryButtonText:"Cancel",onClick:()=>r(e),onClose:()=>{n(!1)},children:["You are about to delete event: ",x("strong",{children:["#",e==null?void 0:e.id]})]}),rRe=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=Yn({propagateErrors:!0});return{downloadCSV:async()=>{const c=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),u=await(await t(c.caller,c.id)).blob(),d=window.URL.createObjectURL(u);window.location.assign(d)},removeEvent:async s=>{const c="removeEvent",u=n(`api/admin/logins/${s}`,{method:"DELETE"},c);await t(u.caller,u.id)},removeAllEvents:async()=>{const c=n("api/admin/logins",{method:"DELETE"},"removeAllEvents");await t(c.caller,c.id)},errors:r,loading:e}},oRe=({open:e,setOpen:t,onConfirm:n})=>x(gr,{title:"Clear login history?",open:e,primaryButtonText:"Clear login history",secondaryButtonText:"Cancel",onClick:n,onClose:()=>{t(!1)},children:["You are about to clear the login history.",l("br",{}),"This will delete all the login events."]}),iRe={id:"created_at"},{value:O3,setValue:aRe}=Rc("LoginHistoryTable:v1",iRe),sRe={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},lRe=()=>{const{setToastData:e,setToastApiError:t}=$t(),{events:n,loading:r,refetch:o}=JAe(),{removeEvent:i,removeAllEvents:a,downloadCSV:s}=rRe(),[c,u]=md(),[d]=m.useState(()=>({sortBy:[{id:c.get("sort")||O3.id,desc:c.has("order")?c.get("order")==="desc":O3.desc}],hiddenColumns:["failure_reason"],globalFilter:c.get("search")||""})),[p,f]=m.useState(d.globalFilter),[h,g]=m.useState(),[v,y]=m.useState(!1),[b,w]=m.useState(!1),S=async H=>{try{await i(H.id),e({title:"Event has been deleted",type:"success"}),o(),y(!1)}catch(Q){t(ht(Q))}},k=async()=>{try{await a(),e({title:"History has been cleared",type:"success"}),o(),w(!1)}catch(H){t(ht(H))}},A=or(ml.breakpoints.down("sm")),T=or(ml.breakpoints.down("md")),R=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:H})=>l(TD,{value:H,dateFormat:S1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:gs,searchable:!0},{Header:"Authentication",accessor:H=>sRe[H.auth_type]||H.auth_type,width:150,maxWidth:150,Cell:gs,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:gs,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:ZAe,filterName:"success",filterParsing:H=>H.toString()},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:H}})=>l(tRe,{onDelete:()=>{g(H),y(!0)}}),width:150,disableSortBy:!0},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:P,getSearchText:_,getSearchContext:I}=jh(R,p,n),{headerGroups:$,rows:U,prepareRow:M,state:{sortBy:D},setHiddenColumns:K}=Yt.useTable({columns:R,data:P,initialState:d,sortTypes:si,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:rr}},Yt.useSortBy,Yt.useFlexLayout);return Ed([{condition:A,columns:["role","seenAt"]},{condition:T,columns:["imageUrl","tokens","createdAt"]}],K,R),m.useEffect(()=>{const H={};H.sort=D[0].id,D[0].desc&&(H.order="desc"),p&&(H.search=p),u(H,{replace:!0}),aRe({id:D[0].id,desc:D[0].desc||!1})},[D,p,u]),x(Or,{isLoading:r,header:l(Dn,{title:`Login history (${U.length})`,actions:x(ve,{children:[l(q,{condition:!T,show:l(vo,{initialValue:p,onChange:f,hasFilters:!0,getSearchContext:I})}),l(q,{condition:U.length>0,show:x(ve,{children:[l(q,{condition:!T,show:l(Dn.Divider,{})}),l(xt,{title:"Download login history",arrow:!0,children:l(Ht,{onClick:s,children:l(tle,{})})}),l(xt,{title:"Clear login history",arrow:!0,children:l(Ht,{onClick:()=>w(!0),children:l(go,{})})})]})})]}),children:l(q,{condition:T,show:l(vo,{initialValue:p,onChange:f,hasFilters:!0,getSearchContext:I})})}),children:[l(Xa,{value:_(p),children:l(b1,{rows:U,headerGroups:$,prepareRow:M})}),l(q,{condition:U.length===0,show:l(q,{condition:(p==null?void 0:p.length)>0,show:x(Kn,{children:["No login events found matching “",p,"”"]}),elseShow:l(Kn,{children:"No login events available."})})}),l(nRe,{event:h,open:v,setOpen:y,onConfirm:S}),l(oRe,{open:b,setOpen:w,onConfirm:k})]})},cRe=()=>{const{hasAccess:e}=m.useContext(yo);return l("div",{children:l(q,{condition:e(fi),show:l(lRe,{}),elseShow:l(uM,{})})})},ch=[{path:"/splash/:splashId",title:"Unleash",component:sbe,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:GAe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/edit",parent:"/projects",title:":projectId",component:$ye,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:Xge,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/:activeTab/copy",parent:"/projects/:projectId/features/:featureId/:activeTab",title:"Copy",component:c0e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:c1e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:qAe,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature toggle",component:Vye,type:"protected",menu:{}},{path:"/projects/:projectId/features2/:featureId",parent:"/features",title:":featureId",component:fP,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:YAe,flag:Lme,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:Yge,type:"protected",menu:{mobile:!0}},{path:"/features/:activeTab/:featureId",parent:"/features",title:":featureId",component:fP,type:"protected",menu:{}},{path:"/features",title:"Feature toggles",component:nfe,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:Wke,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/applications/:name",title:":name",parent:"/applications",component:m1e,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:g1e,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:ube,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:aye,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:b1e,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:W0e,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:V0e,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:Ufe,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:Ehe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:zve,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:Wve,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:rke,type:"protected",flag:Mme,menu:{mobile:!0,advanced:!0}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:gye,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:mye,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:Ahe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:e0e,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:t0e,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:Bhe,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/segments/create",title:"Segments",component:iTe,hidden:!1,type:"protected",layout:"main",menu:{},flag:Hb},{path:"/segments/edit/:segmentId",title:"Segments",component:lTe,hidden:!1,type:"protected",layout:"main",menu:{},flag:Hb},{path:"/segments",title:"Segments",component:Ske,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0},flag:Hb},{path:"/history",title:"Event log",component:k0e,type:"protected",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",component:cRe,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived toggles",component:Uke,type:"protected",menu:{}},{path:"/admin",title:"Admin",component:XAe,hidden:!1,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:KAe,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:VAe,type:"protected",menu:{}},{path:"/login",title:"Log in",component:Nme,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:uge,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:fge,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:wge,type:"unprotected",menu:{},isStandalone:!0}],uRe=[{path:"/history",title:"Event log",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/users",title:"Users",menu:{adminSettings:!0}},{path:"/admin/groups",title:"Groups",menu:{adminSettings:!0,mode:["enterprise"]},flag:Bme},{path:"/admin/roles",title:"Project roles",flag:Dme,menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/auth",title:"Single sign-on",menu:{adminSettings:!0}},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0}},{path:"/admin/service-accounts",title:"Service accounts",menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/network/*",title:"Network",menu:{adminSettings:!0,mode:["pro","enterprise"]},configFlag:"networkViewEnabled"},{path:"/admin/maintenance",title:"Maintenance",menu:{adminSettings:!0}},{path:"/admin/cors",title:"CORS origins",flag:"embedProxyFrontend",menu:{adminSettings:!0}},{path:"/admin/admin-invoices",title:"Billing & invoices",menu:{adminSettings:!0,mode:["pro"]}}],dRe=ch.filter(e=>!e.hidden),pRe=()=>{const e=dRe.filter(o=>o.menu.advanced),t=ch.filter(o=>o.menu.adminSettings),n=ch.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},$3=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag})),fRe=pRe(),hRe=(e={})=>{const t=Bt("api/admin/notifications"),{data:n,error:r,mutate:o}=An(t,mRe,e),i=m.useCallback(()=>{o().catch(console.warn)},[o]);return{notifications:n,error:r,loading:!r&&!n,refetchNotifications:i,mutateNotifications:o}},mRe=async e=>await(await fetch(e).then(Rn("Notifications"))).json();var VT={},gRe=En;Object.defineProperty(VT,"__esModule",{value:!0});var GT=VT.default=void 0,vRe=gRe(Tn()),yRe=kn,bRe=(0,vRe.default)((0,yRe.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"}),"Notifications");GT=VT.default=bRe;const wRe=C(Le)(({theme:e})=>({padding:e.spacing(1,1.5,1,3),display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",boxShadow:e.boxShadows.separator})),SRe=({children:e})=>l(ve,{children:x(wRe,{children:[l(se,{fontWeight:"bold",children:"Notifications"}),e]})}),xRe=C(ia)(({theme:e})=>({padding:e.spacing(1,1,3,1)})),CRe=({children:e})=>l(xRe,{"data-testid":"NOTIFICATIONS_LIST",children:e}),ERe=e=>m.createElement("svg",{width:18,height:14,viewBox:"0 0 18 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M0.59 2.00016L2 0.590157L5.41 4.00016L4 5.41016L0.59 2.00016ZM13 11.5002L13 8.00016L7.41 8.00016L2 13.4102L0.59 12.0002L6.59 6.00016L13 6.00016L13 2.50016L17.5 7.00016L13 11.5002Z",fill:"currentColor"})),N3=C(Le,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({padding:e.spacing(.5),marginRight:e.spacing(1.5),backgroundColor:t?e.palette.neutral.light:e.palette.secondary.light,width:"30px",height:"30px",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:`${e.shape.borderRadius}px`,top:3,left:7})),TRe=C(Aee)(({theme:e})=>({position:"relative",cursor:"pointer",padding:e.spacing(2.5,2,3,2),borderRadius:e.shape.borderRadiusMedium,width:"100%","&:after":{content:'""',width:`calc(100% - ${e.spacing(4)})`,height:"1px",position:"absolute",bottom:0,backgroundColor:e.palette.divider}})),kRe=C(Le)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%"})),ARe=C(Le)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(1,0,0,5.25)})),RRe=C(se,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,fontWeight:t?"normal":"bold",textDecoration:"none",color:"inherit",wordBreak:"break-all"})),_Re=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),PRe=C(Le)(({theme:e})=>({...Ac})),IRe=C(Sd)(({theme:e})=>({width:"18px",height:"18px"})),ORe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.neutral.main,marginLeft:e.spacing(1)})),$Re=({notification:e,onNotificationClick:t})=>{const n=gn(),{readAt:r}=e;return l(TRe,{onClick:()=>t(e),children:x(kRe,{children:[x(RRe,{readAt:!!r,children:[(i=>{if(i==="change-request")return l(N3,{readAt:!!r,children:l(ERe,{color:e.readAt?n.palette.neutral.main:n.palette.primary.main,style:{transform:"scale(0.8)"}})});if(i==="toggle")return l(N3,{readAt:!!r,children:l(wle,{sx:a=>({height:"20px",width:"20px",color:r?a.palette.neutral.main:a.palette.primary.main})})})})(e.notificationType)," ",e.message]}),x(ARe,{children:[x(PRe,{children:[l(IRe,{src:e.createdBy.imageUrl||""}),x(ORe,{children:["Created by ",e.createdBy.username]})]}),l(_Re,{children:l(x1,{date:new Date(e.createdAt)})})]})]})})},NRe=C(Le)(()=>({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",minHeight:"150px"})),LRe=C(GT)(({theme:e})=>({height:"30px",width:"30px",color:e.palette.neutral.main,marginBottom:e.spacing(1)})),MRe=({text:e})=>x(NRe,{children:[l(LRe,{}),l(se,{color:"neutral.main",children:e})]}),DRe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{loading:r,errors:n,markAsRead:async i=>{const s=t("api/admin/notifications/read",{method:"POST",body:JSON.stringify(i)});try{await e(s.caller,s.id)}catch(c){throw c}}}},BRe=C(Le)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginTop:e.spacing(.5)})),FRe=({id:e,localStorageKey:t,eventName:n})=>{var d;const{uiConfig:r}=Ot(),{value:o,setValue:i}=Rc(`${r.baseUriPath}:${t}:v1:${e}`,{}),[a,s]=m.useState(o.value),{trackEvent:c}=Dr();if(!((d=r==null?void 0:r.flags)!=null&&d.T)||a)return null;const u=p=>{s(p),i({value:p}),c(n,{props:{eventType:e,wasHelpful:p==="yes"}})};return x(wr,{elevation:0,sx:{background:p=>p.palette.neutral.light,padding:p=>p.spacing(1.5,2),marginTop:p=>p.spacing(1.5)},children:["Was this information useful to you?",x(BRe,{children:[l(Ve,{size:"small",variant:a==="yes"?"contained":"outlined",sx:{padding:0},onClick:()=>u("yes"),disabled:!!a,children:"Yes"}),l(Ve,{size:"small",variant:a==="no"?"contained":"outlined",sx:{padding:0},onClick:()=>u("no"),disabled:!!a,children:"No"})]})]})},zRe=C(Le)(()=>({position:"relative"})),jRe=C(Le)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,display:"flex",justifyContent:"center"})),URe=C(se)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,textAlign:"center"})),WRe=C(wr)(({theme:e})=>({width:"420px",boxShadow:e.boxShadows.popup,borderRadius:`${e.shape.borderRadiusLarge}px`,position:"absolute",right:-100,top:60,maxHeight:"80vh",overflowY:"auto"})),HRe=C(Le)(({theme:e})=>({backgroundColor:e.palette.primary.main,borderRadius:"100%",width:"7px",height:"7px",position:"absolute",top:7,right:4})),VRe=C(Le)(()=>({...Ac})),GRe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),qRe=C(Ht)(({theme:e})=>({"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),KRe=()=>{const[e,t]=m.useState(!1),{notifications:n,refetchNotifications:r}=hRe({refreshInterval:15e3}),o=gt(),{markAsRead:i}=DRe(),{uiConfig:a}=Ot(),{trackEvent:s}=Dr(),[c,u]=m.useState(!1),d=async w=>{var S;w.link&&o(w.link),(S=a==null?void 0:a.flags)!=null&&S.T&&s("notifications",{props:{eventType:w.notificationType}}),t(!1);try{await i({notifications:[w.id]}),r()}catch(k){console.error("Error marking notification as read: ",k)}},p=async()=>{try{n&&n.length>0&&(await i({notifications:n.map(w=>w.id)}),r())}catch(w){console.error("Error marking all notification as read: ",w)}},f=w=>{w.key==="Escape"&&t(!1)},h=n==null?void 0:n.filter(w=>w.readAt===null),g=!!(h&&h.length>0),v=w=>c?!w.readAt:!0,y=n==null?void 0:n.filter(v).map(w=>l($Re,{notification:w,onNotificationClick:d},w.id)),b=!!(n&&n.length>0&&!c);return x(zRe,{children:[x(qRe,{onClick:()=>t(!e),"data-testid":"NOTIFICATIONS_BUTTON",disableFocusRipple:!0,children:[l(q,{condition:g,show:l(HRe,{})}),l(GT,{})]}),l(q,{condition:e,show:l(k6,{onClickAway:()=>t(!1),children:x(WRe,{className:"dropdown-outline",onKeyDown:f,"data-testid":"NOTIFICATIONS_MODAL",children:[l(SRe,{children:x(VRe,{children:[l(GRe,{children:"Show only unread"}),l(Ya,{onClick:()=>u(!c),checked:c})]})}),l(q,{condition:g,show:l(jRe,{"data-testid":"UNREAD_NOTIFICATIONS",children:l(Ve,{onClick:p,children:x(URe,{children:["Mark all as read (",h==null?void 0:h.length,")"]})})})})," ",l(q,{condition:(y==null?void 0:y.length)===0,show:l(MRe,{text:c?"No unread notifications":"No new notifications"})}),l(CRe,{children:y}),l(q,{condition:b,show:x(ve,{children:[l(FRe,{eventName:"notifications",id:"useful",localStorageKey:"NotificationsUsefulPrompt"}),l("br",{})]})})]})})})]})},L3=C(VK)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300})),M3=C(mJ)(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:1280,"&&&":{padding:0}})),D3=C("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),YRe=C("nav")({display:"flex",alignItems:"center",flexGrow:1}),XRe=C(vse)({width:"150px"}),JRe=C(gse)({width:"150px"}),QRe=C("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),ZRe=C("button")(({theme:e})=>({...ji(e),border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),B3=e=>({color:e.palette.neutral.main}),ug=C(hn)(({theme:e})=>ji(e)),e_e=C(Ht)(({theme:e})=>({...ji(e),borderRadius:100})),t_e=()=>{const{onSetThemeMode:e,themeMode:t}=_N(),n=gn(),r=gl(),o=gl(),[i,a]=m.useState(null),[s,c]=m.useState(null),[u,d]=m.useState(!1),{permissions:p}=T1(),{uiConfig:f,isOss:h,isPro:g,isEnterprise:v}=Ot(),y=or(n.breakpoints.down("md")),[b,w]=m.useState(!1),S=()=>w(_=>!_),k=()=>a(null),A=()=>c(null);m.useEffect(()=>{(p==null?void 0:p.find(I=>I.permission===fi))&&d(!0)},[p]);const T=fRe(),R=_=>{const{mode:I}=_.menu;return!I||I.includes("pro")&&g()||I.includes("enterprise")&&v()},P={mainNavRoutes:$3(T.mainNavRoutes).concat([{path:"/admin/api",title:"API access",menu:{}}]).filter(Kb(f)),mobileRoutes:$3(T.mobileRoutes).filter(Kb(f)),adminRoutes:uRe.filter(Kb(f)).filter(R).map(_=>({..._,path:_.path.replace("/*","")}))};return y?l(L3,{position:"static",children:x(M3,{children:[l(xt,{title:"Menu",arrow:!0,children:l(Ht,{sx:{color:_=>_.palette.text.primary},onClick:S,"aria-controls":"header-drawer","aria-expanded":b,size:"large",children:l(QN,{})})}),l(Gse,{title:f.name,flags:f.flags,links:f.links,open:b,toggleDrawer:S,admin:u,routes:P}),l(D3,{children:l(g5,{})})]})}):l(L3,{position:"static",children:x(M3,{children:[l(ug,{to:"/",sx:Ac,"aria-label":"Home",children:l(Lh,{darkmode:l(XRe,{"aria-label":"Unleash logo"}),lightmode:l(JRe,{"aria-label":"Unleash logo"})})}),x(YRe,{children:[x(QRe,{children:[l(ug,{to:"/projects",children:"Projects"}),l(ug,{to:"/features",children:"Feature toggles"}),l(ug,{to:"/playground",children:"Playground"}),x(ZRe,{onClick:_=>c(_.currentTarget),"aria-controls":s?o:void 0,"aria-expanded":!!s,children:["Configure",l(rx,{sx:B3})]}),l(C5,{id:o,options:P.mainNavRoutes,anchorEl:s,handleClose:A,style:{top:10}})]}),x(D3,{children:[l(xt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:l(Ht,{onClick:e,sx:ji,children:l(q,{condition:t==="dark",show:l(Zse,{}),elseShow:l(ple,{})})})})," ",l(q,{condition:!h(),show:l(KRe,{})}),l(xt,{title:"Documentation",arrow:!0,children:l(Ht,{href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",disableRipple:!0,sx:ji,children:l(dE,{})})}),l(q,{condition:u,show:l(xt,{title:"Settings",arrow:!0,children:x(e_e,{onClick:_=>a(_.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":!!i,size:"large",disableRipple:!0,children:[l(ZN,{}),l(rx,{sx:B3})]})})}),l(C5,{id:r,options:P.adminRoutes,anchorEl:i,handleClose:k,style:{top:5,left:-100}})," ",l(g5,{})]})]})]})})},n_e=e=>{var n;const t=(n=e.versionInfo)==null?void 0:n.current;return t!=null&&t.enterprise?`${e.name} ${t.enterprise}`:t!=null&&t.oss?`${e.name} ${t.oss}`:`${e.name} ${e.version}`},r_e=e=>{var r,o;const t=(r=e.versionInfo)==null?void 0:r.latest,n=(o=e.versionInfo)==null?void 0:o.isLatest;if(t!=null&&t.enterprise&&!n)return`Upgrade available - Latest Enterprise release: ${t.enterprise}`;if(t!=null&&t.oss&&!n)return`Upgrade available - Latest OSS release: ${t.oss}`},Dg=C("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),o_e=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=n_e(e.uiConfig),r=e.uiConfig.environment,o=r_e(e.uiConfig);return x("section",{title:"API details",children:[x(Dg,{children:[n," ",l(q,{condition:!!r,show:x("small",{children:["(",r,")"]})})]}),l(q,{condition:!!o,show:x("small",{children:[o,l("br",{})]})}),l("br",{}),l("small",{children:e.uiConfig.slogan}),l("br",{}),l(q,{condition:!!t,show:l("small",{children:`${t}`})})]})},i_e=C("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.background.paper})),gw=C(ia)({padding:0,margin:0}),cr=C(_a)(({theme:e})=>({padding:0,margin:0,"& a":{...ji(e),textDecoration:"none",color:e.palette.text.primary,"&:hover":{textDecoration:"underline"}}})),a_e=()=>{const{uiConfig:e}=Ot();return l(i_e,{children:x(Wn,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[l(Wn,{item:!0,md:4,xs:12,children:l(o_e,{uiConfig:e})}),l(Wn,{item:!0,xs:12,md:"auto",children:x(Wn,{container:!0,spacing:7,direction:"row",children:[l(Wn,{item:!0,children:x("section",{title:"Unleash SDK",children:[l(Dg,{children:"Server SDKs"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",rel:"noreferrer",children:"Node.js"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",rel:"noreferrer",children:"Java"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",rel:"noreferrer",children:"Go"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/rust",target:"_blank",rel:"noreferrer",children:"Rust"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",rel:"noreferrer",children:"Ruby"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",rel:"noreferrer",children:"Python"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",rel:"noreferrer",children:".NET"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",rel:"noreferrer",children:"PHP"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"All SDKs"})})})]})]})}),l(Wn,{item:!0,children:x("section",{title:"Unleash SDK",children:[l(Dg,{children:"Frontend SDKs"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",rel:"noreferrer",children:"Unleash Proxy"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",rel:"noreferrer",children:"JavaScript"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",rel:"noreferrer",children:"React"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/next-js",target:"_blank",rel:"noreferrer",children:"Next.js"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/vue",target:"_blank",rel:"noreferrer",children:"Vue"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",rel:"noreferrer",children:"iOS"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",rel:"noreferrer",children:"Android"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/flutter",target:"_blank",rel:"noreferrer",children:"Flutter"})})})]})]})}),l(Wn,{item:!0,children:x("section",{children:[l(Dg,{children:"About"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://www.getunleash.io/",target:"_blank",rel:"noreferrer",children:"getunleash.io"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://twitter.com/getunleash",target:"_blank",rel:"noreferrer",children:"Twitter"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",rel:"noreferrer",children:"LinkedIn"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://github.com/Unleash/unleash",target:"_blank",rel:"noreferrer",children:"GitHub"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Slack Community"})})})]})]})})]})})]})})},s_e=C(tn)(({theme:e})=>({marginBottom:e.spacing(2)})),l_e=C(se)(({theme:e})=>({maxWidth:"800px"})),c_e=C("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),u_e=e=>!(!e||localStorage&&localStorage.getItem(e)),d_e=({toast:e})=>{const[t,n]=m.useState(!1);m.useEffect(()=>{n(u_e((e==null?void 0:e.id)||""))},[e==null?void 0:e.id]);const r=()=>{localStorage&&localStorage.setItem((e==null?void 0:e.id)||"","seen"),n(!1)};return e?l(q,{condition:t,show:x(s_e,{severity:e.severity,onClose:r,children:[l(l_e,{variant:"body2",children:e.message}),l(c_e,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},p_e=C("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),f_e=C(yX)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),F3=C("p")(TN),h_e=C(hn)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),m_e=()=>{const{isAdmin:e}=m.useContext(yo),t=Ho(),n=t.pathname.split("/").filter(r=>r).filter(r=>r!=="create"&&r!=="edit"&&r!=="view"&&r!=="variants"&&r!=="logs"&&r!=="metrics"&&r!=="copy"&&r!=="features"&&r!=="features2"&&r!=="create-toggle"&&r!=="settings"&&r!=="profile");return l(p_e,{children:l(q,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:l(q,{condition:n.length>1,show:l(f_e,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return l(F3,{children:r},r);let a="/";return n.forEach((s,c)=>{c!==o&&c<o?a+=s+"/":c===o&&(a+=s)}),l(h_e,{to:a,children:l(F3,{children:r})},r)})})})})})},z3="/static/texture-c29e66c0.png",AD="skip-nav-target-id",g_e=()=>l("div",{id:AD}),v_e=C("a")(({theme:e})=>({position:"fixed",overflow:"hidden",zIndex:1e3,top:e.spacing(2.25),left:e.spacing(2.25),padding:e.spacing(1,2),whiteSpace:"nowrap",textDecoration:"none",background:e.palette.background.alternative,color:e.palette.common.white,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallBody,...ji(e),[e.breakpoints.down(960)]:{top:"0.8rem",left:"0.8rem"},"&:not(:focus):not(:active)":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0}})),y_e=()=>x(v_e,{href:`#${AD}`,children:["Skip to content ",l("span",{"aria-hidden":!0,children:"↓"})]}),b_e=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>x(G6,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[x(Le,{sx:i=>({backgroundColor:i.palette.neutral.light,borderRadius:a=>`${a.shape.borderRadiusLarge}px ${a.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:a=>n?a.palette.warning.border:a.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[l(q,{condition:!!n,show:x(tn,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"}},children:[l("strong",{children:"Conflict!"})," ",n,"."]})}),x(Le,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[l(se,{children:"Feature toggle name: "}),l(Vr,{component:hn,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:l("strong",{children:e})})]})]}),l(Le,{children:o})]});var qT={},w_e=En;Object.defineProperty(qT,"__esModule",{value:!0});var RD=qT.default=void 0,S_e=w_e(Tn()),x_e=kn,C_e=(0,S_e.default)((0,x_e.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}),"Block");RD=qT.default=C_e;var KT={},E_e=En;Object.defineProperty(KT,"__esModule",{value:!0});var _D=KT.default=void 0,T_e=E_e(Tn()),k_e=kn,A_e=(0,T_e.default)((0,k_e.jsx)("path",{d:"m19.07 4.93-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"}),"TrackChanges");_D=KT.default=A_e;var R_e=200,YT="__lodash_hash_undefined__",__e=1/0,PD=9007199254740991,P_e="[object Arguments]",I_e="[object Function]",O_e="[object GeneratorFunction]",$_e="[object Symbol]",N_e=/[\\^$.*+?()[\]{}|]/g,L_e=/^\[object .+?Constructor\]$/,M_e=/^(?:0|[1-9]\d*)$/,D_e=typeof Ci=="object"&&Ci&&Ci.Object===Object&&Ci,B_e=typeof self=="object"&&self&&self.Object===Object&&self,XT=D_e||B_e||Function("return this")();function F_e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function z_e(e,t){var n=e?e.length:0;return!!n&&W_e(e,t,0)>-1}function j_e(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function ID(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function JT(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function U_e(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function W_e(e,t,n){if(t!==t)return U_e(e,H_e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function H_e(e){return e!==e}function V_e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function G_e(e){return function(t){return e(t)}}function q_e(e,t){return e.has(t)}function K_e(e,t){return e==null?void 0:e[t]}function Y_e(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function OD(e,t){return function(n){return e(t(n))}}var X_e=Array.prototype,J_e=Function.prototype,J1=Object.prototype,vw=XT["__core-js_shared__"],j3=function(){var e=/[^.]+$/.exec(vw&&vw.keys&&vw.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),$D=J_e.toString,Nd=J1.hasOwnProperty,QT=J1.toString,Q_e=RegExp("^"+$D.call(Nd).replace(N_e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U3=XT.Symbol,Z_e=OD(Object.getPrototypeOf,Object),e5e=J1.propertyIsEnumerable,t5e=X_e.splice,W3=U3?U3.isConcatSpreadable:void 0,Px=Object.getOwnPropertySymbols,H3=Math.max,n5e=LD(XT,"Map"),uh=LD(Object,"create");function yc(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function r5e(){this.__data__=uh?uh(null):{}}function o5e(e){return this.has(e)&&delete this.__data__[e]}function i5e(e){var t=this.__data__;if(uh){var n=t[e];return n===YT?void 0:n}return Nd.call(t,e)?t[e]:void 0}function a5e(e){var t=this.__data__;return uh?t[e]!==void 0:Nd.call(t,e)}function s5e(e,t){var n=this.__data__;return n[e]=uh&&t===void 0?YT:t,this}yc.prototype.clear=r5e;yc.prototype.delete=o5e;yc.prototype.get=i5e;yc.prototype.has=a5e;yc.prototype.set=s5e;function Ld(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function l5e(){this.__data__=[]}function c5e(e){var t=this.__data__,n=Q1(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():t5e.call(t,n,1),!0}function u5e(e){var t=this.__data__,n=Q1(t,e);return n<0?void 0:t[n][1]}function d5e(e){return Q1(this.__data__,e)>-1}function p5e(e,t){var n=this.__data__,r=Q1(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ld.prototype.clear=l5e;Ld.prototype.delete=c5e;Ld.prototype.get=u5e;Ld.prototype.has=d5e;Ld.prototype.set=p5e;function Md(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function f5e(){this.__data__={hash:new yc,map:new(n5e||Ld),string:new yc}}function h5e(e){return Z1(this,e).delete(e)}function m5e(e){return Z1(this,e).get(e)}function g5e(e){return Z1(this,e).has(e)}function v5e(e,t){return Z1(this,e).set(e,t),this}Md.prototype.clear=f5e;Md.prototype.delete=h5e;Md.prototype.get=m5e;Md.prototype.has=g5e;Md.prototype.set=v5e;function Uv(e){var t=-1,n=e?e.length:0;for(this.__data__=new Md;++t<n;)this.add(e[t])}function y5e(e){return this.__data__.set(e,YT),this}function b5e(e){return this.__data__.has(e)}Uv.prototype.add=Uv.prototype.push=y5e;Uv.prototype.has=b5e;function w5e(e,t){var n=ZT(e)||MD(e)?V_e(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Nd.call(e,i))&&!(o&&(i=="length"||O5e(i,r)))&&n.push(i);return n}function Q1(e,t){for(var n=e.length;n--;)if(F5e(e[n][0],t))return n;return-1}function S5e(e,t,n,r){var o=-1,i=z_e,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=ID(t,G_e(n))),r?(i=j_e,a=!1):t.length>=R_e&&(i=q_e,a=!1,t=new Uv(t));e:for(;++o<s;){var d=e[o],p=n?n(d):d;if(d=r||d!==0?d:0,a&&p===p){for(var f=u;f--;)if(t[f]===p)continue e;c.push(d)}else i(t,p,r)||c.push(d)}return c}function ND(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=I5e),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?ND(s,t-1,n,r,o):JT(o,s):r||(o[o.length]=s)}return o}function x5e(e,t,n){var r=t(e);return ZT(e)?r:JT(r,n(e))}function C5e(e){if(!ek(e)||N5e(e))return!1;var t=BD(e)||Y_e(e)?Q_e:L_e;return t.test(B5e(e))}function E5e(e){if(!ek(e))return M5e(e);var t=L5e(e),n=[];for(var r in e)r=="constructor"&&(t||!Nd.call(e,r))||n.push(r);return n}function T5e(e,t){return e=Object(e),k5e(e,t,function(n,r){return r in e})}function k5e(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=e[a];n(s,a)&&(i[a]=s)}return i}function A5e(e,t){return t=H3(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=H3(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i,F_e(e,this,a)}}function R5e(e){return x5e(e,W5e,P5e)}function Z1(e,t){var n=e.__data__;return $5e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function LD(e,t){var n=K_e(e,t);return C5e(n)?n:void 0}var _5e=Px?OD(Px,Object):zD,P5e=Px?function(e){for(var t=[];e;)JT(t,_5e(e)),e=Z_e(e);return t}:zD;function I5e(e){return ZT(e)||MD(e)||!!(W3&&e&&e[W3])}function O5e(e,t){return t=t??PD,!!t&&(typeof e=="number"||M_e.test(e))&&e>-1&&e%1==0&&e<t}function $5e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function N5e(e){return!!j3&&j3 in e}function L5e(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||J1;return e===n}function M5e(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function D5e(e){if(typeof e=="string"||U5e(e))return e;var t=e+"";return t=="0"&&1/e==-__e?"-0":t}function B5e(e){if(e!=null){try{return $D.call(e)}catch{}try{return e+""}catch{}}return""}function F5e(e,t){return e===t||e!==e&&t!==t}function MD(e){return z5e(e)&&Nd.call(e,"callee")&&(!e5e.call(e,"callee")||QT.call(e)==P_e)}var ZT=Array.isArray;function DD(e){return e!=null&&j5e(e.length)&&!BD(e)}function z5e(e){return FD(e)&&DD(e)}function BD(e){var t=ek(e)?QT.call(e):"";return t==I_e||t==O_e}function j5e(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=PD}function ek(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function FD(e){return!!e&&typeof e=="object"}function U5e(e){return typeof e=="symbol"||FD(e)&&QT.call(e)==$_e}function W5e(e){return DD(e)?w5e(e,!0):E5e(e)}var H5e=A5e(function(e,t){return e==null?{}:(t=ID(ND(t,1),D5e),T5e(e,S5e(R5e(e),t)))});function zD(){return[]}var V5e=H5e;const G5e=qr(V5e),q5e=C("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),yw=({change:e,currentStrategy:t})=>{const n=e.action==="deleteStrategy"?void 0:e.payload;return l(q5e,{children:l(D1,{entry:{preData:G5e(t,"sortOrder"),data:n}})})},K5e=C("div")(({theme:e})=>({display:"grid",gridAutoFlow:"column",gridTemplateColumns:"auto 1fr",gap:e.spacing(1),alignItems:"center"})),bw=C("div")(()=>({...TN,maxWidth:500})),ww=({change:e,previousTitle:t,children:n})=>x(K5e,{children:[l(dhe,{strategyName:e.payload.name}),x(bw,{children:[l(q,{condition:!!(t&&t!==e.payload.title||!t&&e.payload.title),show:x(bw,{children:[l(se,{component:"s",color:"text.secondary",children:t||yl(e.payload.name)})," "]})}),l(bw,{children:l(Uh,{tooltip:n,tooltipProps:{maxWidth:500,maxHeight:600},children:l(se,{component:"span",children:e.payload.title||yl(e.payload.name)})})})]})]}),V3=({percentage:e,size:t="4rem"})=>{const n=gn(),r={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:n.palette.background.elevation2},o=100/(2*Math.PI),i=2*o;return l("svg",{viewBox:`0 0 ${i} ${i}`,style:r,"aria-hidden":!0,children:l("circle",{r:o,cx:o,cy:o,fill:"none",stroke:n.palette.primary.light,strokeWidth:i,strokeDasharray:`${e} 100`})})},Y5e=C("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),X5e=C("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),J5e=C(Ts)(({theme:e})=>({margin:e.spacing(.5)})),Sw=({value:e,text:t})=>l(Y5e,{children:l(q,{condition:e.length===0,show:x("p",{children:["No ",t,"s added yet."]}),elseShow:x("div",{children:[x(X5e,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>l(J5e,{label:l(Ca,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),Q5e=({segments:e})=>!e||e.length===0?null:l(ve,{children:e.map((t,n)=>x(m.Fragment,{children:[l(q,{condition:n>0,show:l(DT,{text:"AND"})}),l(nD,{segment:t})]},t.id))}),G3=()=>l(Le,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),Bl=C(Le)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium})),xw=C("span")(({theme:e})=>({color:e.palette.neutral.main})),q3=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,{strategies:r}=Ad(),{uiConfig:o}=Ot(),{segments:i}=_l(),a=i==null?void 0:i.filter(p=>{var f;return(f=e.segments)==null?void 0:f.includes(p.id)}),s=r.find(p=>p.name===e.name),c=m.useMemo(()=>!t||s!=null&&s.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":const f=ff(t[p]);return x(Bl,{sx:{display:"flex",alignItems:"center"},children:[l(Le,{sx:{mr:2},children:l(V3,{percentage:f,size:"2rem"})}),x("div",{children:[x(Zt,{color:"success",children:[f,"%"]})," of your base"," ",n.length>0?"who match constraints":""," ","is included."]})]});case"userIds":case"UserIds":const h=Ks(t[p]);return l(Sw,{value:h,text:"user"},p);case"hostNames":case"HostNames":const g=Ks(t[p]);return l(Sw,{value:g,text:"host"},p);case"IPs":const v=Ks(t[p]);return l(Sw,{value:v,text:"IP"},p);case"stickiness":case"groupId":return null;default:return null}}),[t,s,n]),u=m.useMemo(()=>{if(!t||!(s!=null&&s.editable))return null;const p=l(xw,{children:" is set to "});return s==null?void 0:s.parameters.map(f=>{const{type:h,name:g}={...f};if(!h||!g||t[g]===void 0)return null;const v=l(Ca,{maxLength:15,maxWidth:"150",text:g});switch(f==null?void 0:f.type){case"list":const y=Ks(t[g]);return y.length>0?x(Bl,{children:[v," ",x(xw,{children:["has ",y.length," ",y.length>1?"items":"item",":"," ",y.map(k=>l(Ts,{label:l(Ca,{maxWidth:"300",text:k,maxLength:50}),sx:{mr:.5}},k))]})]}):null;case"percentage":const b=ff(t[g]);return t[g]!==""?x(Bl,{sx:{display:"flex",alignItems:"center"},children:[l(Le,{sx:{mr:2},children:l(V3,{percentage:b,size:"2rem"})}),x("div",{children:[v,p,x(Zt,{color:"success",children:[b,"%"]})]})]}):null;case"boolean":return t[g]==="true"||t[g]==="false"?x(Bl,{children:[l(Ca,{maxLength:15,maxWidth:"150",text:g}),p,l(Zt,{color:t[g]==="true"?"success":"error",children:t[g]})]}):null;case"string":const w=ol(t[g]);return typeof t[g]<"u"?x(Bl,{children:[v,l(q,{condition:w==="",show:l(xw,{children:" is an empty string"}),elseShow:x(ve,{children:[p,l(Ca,{maxWidth:"300",text:w,maxLength:50})]})})]}):null;case"number":const S=ff(t[g]);return t[g]!==""&&S!==void 0?x(Bl,{children:[v,p,l(Ca,{maxWidth:"300",text:String(S),maxLength:50})]}):null;case"default":return null}return null})},[t,s]);if(!t)return l(G3,{});const d=[!!o.flags.SE&&a&&a.length>0&&l(Q5e,{segments:a}),n.length>0&&l(K1,{constraints:n,showLabel:!1}),e.name==="default"&&l(ve,{children:x(Bl,{sx:{width:"100%"},children:["The standard strategy is ",l(Zt,{color:"success",children:"ON"})," ","for all users."]})}),...c??[],...u??[]].filter(Boolean);return l(q,{condition:d.length>0,show:l(ve,{children:d.map((p,f)=>x(m.Fragment,{children:[l(q,{condition:f>0,show:l(DT,{text:"AND"})}),p]},f))}),elseShow:l(G3,{})})},Z5e=(e,t,n,r)=>{var a,s;return(s=(a=Ss(t,n).feature)==null?void 0:a.environments.find(c=>c.name===r))==null?void 0:s.strategies.find(c=>"id"in e.payload&&c.id===e.payload.id)},jD=C(Le)({display:"flex",justifyContent:"space-between",alignItems:"center"}),K3=C(Le)(({theme:e})=>({display:"grid",gridTemplateColumns:"auto 40px",gap:e.spacing(1),alignItems:"center",marginBottom:e.spacing(2),width:"100%"})),Cw=C(Le)(({theme:e})=>({display:"grid",gridTemplateColumns:"150px auto",gridAutoFlow:"column",alignItems:"center",flexGrow:1,gap:e.spacing(1)})),ePe=e=>typeof e=="object"&&e!==null&&"name"in e,Y3=({show:e=!0,disabled:t})=>e?t?l(xt,{title:"This strategy will not be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:l(Zt,{color:"disabled",icon:l(RD,{}),children:"Disabled"})}):l(xt,{title:"This was disabled before and with this change it will be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:l(Zt,{color:"success",icon:l(_D,{}),children:"Enabled"})}):null,tPe=({wasDisabled:e=!1,willBeDisabled:t=!1})=>e&&t?l(se,{color:"action.disabled",children:"Editing strategy:"}):!e&&t?l(se,{color:"error.dark",children:"Editing strategy:"}):e&&!t?l(se,{color:"success.dark",children:"Editing strategy:"}):l(se,{children:"Editing strategy:"}),nPe=({discard:e,change:t,featureName:n,environmentName:r,projectId:o})=>{var a,s,c,u,d;const i=Z5e(t,o,n,r);return x(ve,{children:[t.action==="addStrategy"&&x(ve,{children:[x(K3,{children:[x(Cw,{children:[l(se,{color:(a=t.payload)!=null&&a.disabled?"action.disabled":"success.dark",children:"+ Adding strategy:"}),l(ww,{change:t,children:l(yw,{change:t,currentStrategy:i})}),l("div",{children:l(Y3,{disabled:!0,show:((s=t.payload)==null?void 0:s.disabled)===!0})})]}),l("div",{children:e})]}),l(q3,{strategy:t.payload})]}),t.action==="deleteStrategy"&&x(jD,{children:[x(Cw,{children:[l(se,{sx:p=>({color:p.palette.error.main}),children:"- Deleting strategy:"}),ePe(t.payload)&&l(ww,{change:t,children:l(yw,{change:t,currentStrategy:i})})]}),l("div",{children:e})]}),t.action==="updateStrategy"&&x(ve,{children:[x(K3,{children:[x(Cw,{children:[l(tPe,{wasDisabled:i==null?void 0:i.disabled,willBeDisabled:(c=t.payload)==null?void 0:c.disabled}),l(ww,{change:t,previousTitle:i==null?void 0:i.title,children:l(yw,{change:t,currentStrategy:i})})]}),l("div",{children:e})]}),l(q,{condition:((u=t.payload)==null?void 0:u.disabled)!==(i==null?void 0:i.disabled),show:x(se,{sx:{marginTop:p=>p.spacing(2),marginBottom:p=>p.spacing(2),...Ac,gap:p=>p.spacing(1)},children:["This strategy will be"," ",l(Y3,{disabled:((d=t.payload)==null?void 0:d.disabled)||!1})]})}),l(q3,{strategy:t.payload})]})]})},rPe=({enabled:e,discard:t})=>x(jD,{children:[x(Le,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",l(Zt,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),oPe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,whiteSpace:"pre-wrap"})),iPe=({value:e})=>{const{searchQuery:t}=Al();return e?e.type==="string"&&e.value.length<20?l(rr,{children:l(Ua,{search:t,children:e.value})}):l(rr,{children:l(Uh,{tooltip:l(ve,{children:l(oPe,{children:l(Ua,{search:t,children:e.value})})}),highlighted:t.length>0&&e.value.toLowerCase().includes(t.toLowerCase()),children:e.type})}):l(rr,{})},aPe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),sPe=({value:e})=>{const{searchQuery:t}=Al();if(!e||e.length===0)return l(rr,{});const n=r=>`${r.contextName}:${r.values.join()}`;return l(rr,{children:l(Uh,{tooltip:l(ve,{children:e.map((r,o)=>l(aPe,{children:l(Ua,{search:t,children:n(r)})},r.contextName+o))}),highlighted:t.length>0&&(e==null?void 0:e.map(n).join(`
361
+ your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:x(uAe,{onSubmit:w,children:[l("div",{children:l(cAe,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:g,errors:v,setErrors:y})}),x(dAe,{children:[l(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!T,children:"Create token"}),l(pAe,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},hAe=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=UT(),{deletePersonalAPIToken:o}=xD(),{setToastData:i,setToastApiError:a}=$t();return l(gr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(ht(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:x(se,{children:['Any applications or scripts using this token "',l("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},mAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(3)})),gAe=({open:e,setOpen:t,token:n})=>x(gr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[l(mAe,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),l(se,{variant:"body1",children:"Your token:"}),l(gD,{token:(n==null?void 0:n.secret)||""})]}),TD=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=Xu})=>{const{locationSettings:i}=Ja();if(!e)return l(rr,{children:n});const a=o(e,i.locale);return l(rr,{children:l(xt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:l(se,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:l(x1,{date:new Date(e),live:t,title:""})})})})},vAe=C(tn)(({theme:e})=>({marginBottom:e.spacing(3)})),yAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),bAe=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),wAe=C(se)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),SAe=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),xAe={id:"createdAt"},{value:_3,setValue:CAe}=Rc("PersonalAPITokensTable:v1",xAe),EAe=()=>{const e=gn(),t=or(e.breakpoints.down("md")),n=or(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=UT(),[i,a]=md(),[s]=m.useState(()=>({sortBy:[{id:i.get("sort")||_3.id,desc:i.has("order")?i.get("order")==="desc":_3.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(s.globalFilter),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,v]=m.useState(!1),[y,b]=m.useState(),[w,S]=m.useState(),k=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:gs,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:D})=>new Date(D).getFullYear()>new Date().getFullYear()+100?l(rr,{children:"Never"}):l(th,{value:D}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:th,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:TD,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:D}})=>l(Ha,{children:l(xt,{title:"Delete token",arrow:!0,describeChild:!0,children:l("span",{children:l(Ht,{onClick:()=>{S(D),v(!0)},children:l(go,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:A,getSearchText:T,getSearchContext:R}=jh(k,c,r),P=m.useMemo(()=>(A==null?void 0:A.length)===0&&o?SAe:A,[A,o]),{headerGroups:_,rows:I,prepareRow:$,state:{sortBy:U},setHiddenColumns:M}=Yt.useTable({columns:k,data:P,initialState:s,sortTypes:si,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Yt.useSortBy,Yt.useFlexLayout);return Ed([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],M,k),m.useEffect(()=>{const D={};D.sort=U[0].id,U[0].desc&&(D.order="desc"),c&&(D.search=c),a(D,{replace:!0}),CAe({id:U[0].id,desc:U[0].desc||!1})},[U,c,a]),x(Or,{isLoading:o,header:l(Dn,{title:`Personal API tokens (${I.length<P.length?`${I.length} of ${P.length}`:P.length})`,actions:x(ve,{children:[l(q,{condition:!t,show:x(ve,{children:[l(vo,{initialValue:c,onChange:u,getSearchContext:R}),l(Dn.Divider,{})]})}),l(Ve,{variant:"contained",color:"primary",disabled:r.length>=Zke,onClick:()=>p(!0),children:"New token"})]}),children:l(q,{condition:t,show:l(vo,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:R})})}),children:[l(vAe,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),l(Xa,{value:T(c),children:l(b1,{rows:I,headerGroups:_,prepareRow:$})}),l(q,{condition:I.length===0,show:l(q,{condition:(c==null?void 0:c.length)>0,show:x(Kn,{children:["No tokens found matching “",c,"”"]}),elseShow:x(yAe,{children:[l(bAe,{children:"You have no personal API tokens yet."}),l(wAe,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),l(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),l(fAe,{open:d,setOpen:p,newToken:D=>{b(D),h(!0)}}),l(gAe,{open:f,setOpen:h,token:y}),l(hAe,{open:g,setOpen:v,token:w})]})},TAe=()=>{const{data:e,error:t,mutate:n}=An(Bt("api/admin/user/profile"),kAe);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},kAe=e=>fetch(e).then(Rn("Profile")).then(t=>t.json());var WT={},AAe=En;Object.defineProperty(WT,"__esModule",{value:!0});var Bs=WT.default=void 0,RAe=AAe(Tn()),_Ae=kn,PAe=(0,RAe.default)((0,_Ae.jsx)("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");Bs=WT.default=PAe;var HT={},IAe=En;Object.defineProperty(HT,"__esModule",{value:!0});var kD=HT.default=void 0,OAe=IAe(Tn()),$Ae=kn,NAe=(0,OAe.default)((0,$Ae.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");kD=HT.default=NAe;const LAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),MAe=C("div")(()=>({flexGrow:1})),DAe=C(se)(({theme:e})=>({fontSize:e.spacing(3.75)})),BAe=C(cE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),P3=C(se)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),FAe=C("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),zAe=C(Zt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),jAe=C("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),UAe=C(ks)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),WAe=C(Ih)(({theme:e})=>({backgroundColor:e.palette.background.paper})),HAe=({user:e})=>{const{profile:t}=TAe(),n=gt(),{locationSettings:r,setLocationSettings:o}=Ja(),[i,a]=m.useState(),[s,c]=m.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);m.useEffect(()=>{const d=s.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return x(ve,{children:[x(LAe,{children:[l(BAe,{user:e}),x(MAe,{children:[l(DAe,{children:e.name||e.username}),l(se,{variant:"body1",children:e.email})]})]}),x(Or,{children:[l(P3,{children:"Access"}),x(FAe,{children:[x(Le,{sx:{width:"50%"},children:[l(se,{variant:"body2",children:"Your root role"}),l(xt,{title:(t==null?void 0:t.rootRole.description)||"",arrow:!0,placement:"bottom-end",describeChild:!0,children:l(Zt,{color:"success",icon:l(Bs,{}),iconRight:!0,children:t==null?void 0:t.rootRole.name})})]}),x(Le,{children:[l(se,{variant:"body2",children:"Projects"}),l(q,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>l(xt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:l(zAe,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:l(kD,{}),children:d})},d)),elseShow:l(xt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:l(Zt,{children:"No projects"})})})]})]}),l(jAe,{}),l(P3,{children:"Settings"}),l(se,{variant:"body2",children:"This is the format used across the system for time and date"}),x(UAe,{variant:"outlined",size:"small",children:[l(WAe,{htmlFor:"locale-select",children:"Date/Time formatting"}),l(Oh,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:s.map(d=>l("option",{value:d,children:d},d))})]})]})]})},VAe=()=>{const{user:e}=pi(),t=Ho(),n=gt(),{config:r,loading:o}=SD("simple"),{uiConfig:i}=Ot(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],s=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:x(Yke,{tabs:a,value:u,onChange:s,children:[l(q,{condition:u==="profile",show:l(HAe,{user:e})}),l(q,{condition:u==="password",show:l(Qke,{})}),l(q,{condition:u==="pat",show:l(EAe,{})})]})},GAe=m.lazy(()=>import("./CreateProject-217f67b6.js")),qAe=m.lazy(()=>import("./FeatureViewLazyExport-06cf4baa.js")),KAe=m.lazy(()=>import("./LazyAdminExport-04c8032d.js")),YAe=m.lazy(()=>import("./LazyProjectExport-d9663a8c.js")),XAe=()=>l(kc,{to:"/admin/users",replace:!0}),JAe=()=>{const{isEnterprise:e}=Ot(),{data:t,error:n,mutate:r}=zh(e(),{events:[]},Bt("api/admin/logins"),QAe);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},QAe=e=>fetch(e).then(Rn("Login History")).then(t=>t.json()),I3=C(Le)(()=>({display:"flex",justifyContent:"center"})),ZAe=({row:e,value:t})=>{const{searchQuery:n}=Al();return t?l(I3,{children:l(Zt,{color:"success",children:"True"})}):l(I3,{children:l(Fh,{arrow:!0,title:l(Ua,{search:n,children:e.original.failure_reason}),children:l(Zt,{color:"error",children:"False"})})})},eRe=C(Le)(()=>({display:"flex",justifyContent:"center"})),tRe=({onDelete:e})=>l(eRe,{children:l(Ir,{"data-loading":!0,onClick:e,permission:fi,tooltipProps:{title:"Remove event"},children:l(go,{})})}),nRe=({event:e,open:t,setOpen:n,onConfirm:r})=>x(gr,{title:"Delete event?",open:t,primaryButtonText:"Delete event",secondaryButtonText:"Cancel",onClick:()=>r(e),onClose:()=>{n(!1)},children:["You are about to delete event: ",x("strong",{children:["#",e==null?void 0:e.id]})]}),rRe=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=Yn({propagateErrors:!0});return{downloadCSV:async()=>{const c=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),u=await(await t(c.caller,c.id)).blob(),d=window.URL.createObjectURL(u);window.location.assign(d)},removeEvent:async s=>{const c="removeEvent",u=n(`api/admin/logins/${s}`,{method:"DELETE"},c);await t(u.caller,u.id)},removeAllEvents:async()=>{const c=n("api/admin/logins",{method:"DELETE"},"removeAllEvents");await t(c.caller,c.id)},errors:r,loading:e}},oRe=({open:e,setOpen:t,onConfirm:n})=>x(gr,{title:"Clear login history?",open:e,primaryButtonText:"Clear login history",secondaryButtonText:"Cancel",onClick:n,onClose:()=>{t(!1)},children:["You are about to clear the login history.",l("br",{}),"This will delete all the login events."]}),iRe={id:"created_at"},{value:O3,setValue:aRe}=Rc("LoginHistoryTable:v1",iRe),sRe={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},lRe=()=>{const{setToastData:e,setToastApiError:t}=$t(),{events:n,loading:r,refetch:o}=JAe(),{removeEvent:i,removeAllEvents:a,downloadCSV:s}=rRe(),[c,u]=md(),[d]=m.useState(()=>({sortBy:[{id:c.get("sort")||O3.id,desc:c.has("order")?c.get("order")==="desc":O3.desc}],hiddenColumns:["failure_reason"],globalFilter:c.get("search")||""})),[p,f]=m.useState(d.globalFilter),[h,g]=m.useState(),[v,y]=m.useState(!1),[b,w]=m.useState(!1),S=async H=>{try{await i(H.id),e({title:"Event has been deleted",type:"success"}),o(),y(!1)}catch(Q){t(ht(Q))}},k=async()=>{try{await a(),e({title:"History has been cleared",type:"success"}),o(),w(!1)}catch(H){t(ht(H))}},A=or(ml.breakpoints.down("sm")),T=or(ml.breakpoints.down("md")),R=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:H})=>l(TD,{value:H,dateFormat:S1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:gs,searchable:!0},{Header:"Authentication",accessor:H=>sRe[H.auth_type]||H.auth_type,width:150,maxWidth:150,Cell:gs,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:gs,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:ZAe,filterName:"success",filterParsing:H=>H.toString()},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:H}})=>l(tRe,{onDelete:()=>{g(H),y(!0)}}),width:150,disableSortBy:!0},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:P,getSearchText:_,getSearchContext:I}=jh(R,p,n),{headerGroups:$,rows:U,prepareRow:M,state:{sortBy:D},setHiddenColumns:K}=Yt.useTable({columns:R,data:P,initialState:d,sortTypes:si,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:rr}},Yt.useSortBy,Yt.useFlexLayout);return Ed([{condition:A,columns:["role","seenAt"]},{condition:T,columns:["imageUrl","tokens","createdAt"]}],K,R),m.useEffect(()=>{const H={};H.sort=D[0].id,D[0].desc&&(H.order="desc"),p&&(H.search=p),u(H,{replace:!0}),aRe({id:D[0].id,desc:D[0].desc||!1})},[D,p,u]),x(Or,{isLoading:r,header:l(Dn,{title:`Login history (${U.length})`,actions:x(ve,{children:[l(q,{condition:!T,show:l(vo,{initialValue:p,onChange:f,hasFilters:!0,getSearchContext:I})}),l(q,{condition:U.length>0,show:x(ve,{children:[l(q,{condition:!T,show:l(Dn.Divider,{})}),l(xt,{title:"Download login history",arrow:!0,children:l(Ht,{onClick:s,children:l(tle,{})})}),l(xt,{title:"Clear login history",arrow:!0,children:l(Ht,{onClick:()=>w(!0),children:l(go,{})})})]})})]}),children:l(q,{condition:T,show:l(vo,{initialValue:p,onChange:f,hasFilters:!0,getSearchContext:I})})}),children:[l(Xa,{value:_(p),children:l(b1,{rows:U,headerGroups:$,prepareRow:M})}),l(q,{condition:U.length===0,show:l(q,{condition:(p==null?void 0:p.length)>0,show:x(Kn,{children:["No login events found matching “",p,"”"]}),elseShow:l(Kn,{children:"No login events available."})})}),l(nRe,{event:h,open:v,setOpen:y,onConfirm:S}),l(oRe,{open:b,setOpen:w,onConfirm:k})]})},cRe=()=>{const{hasAccess:e}=m.useContext(yo);return l("div",{children:l(q,{condition:e(fi),show:l(lRe,{}),elseShow:l(uM,{})})})},ch=[{path:"/splash/:splashId",title:"Unleash",component:sbe,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:GAe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/edit",parent:"/projects",title:":projectId",component:$ye,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:Xge,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/:activeTab/copy",parent:"/projects/:projectId/features/:featureId/:activeTab",title:"Copy",component:c0e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:c1e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:qAe,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature toggle",component:Vye,type:"protected",menu:{}},{path:"/projects/:projectId/features2/:featureId",parent:"/features",title:":featureId",component:fP,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:YAe,flag:Lme,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:Yge,type:"protected",menu:{mobile:!0}},{path:"/features/:activeTab/:featureId",parent:"/features",title:":featureId",component:fP,type:"protected",menu:{}},{path:"/features",title:"Feature toggles",component:nfe,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:Wke,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/applications/:name",title:":name",parent:"/applications",component:m1e,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:g1e,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:ube,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:aye,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:b1e,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:W0e,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:V0e,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:Ufe,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:Ehe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:zve,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:Wve,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:rke,type:"protected",flag:Mme,menu:{mobile:!0,advanced:!0}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:gye,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:mye,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:Ahe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:e0e,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:t0e,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:Bhe,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/segments/create",title:"Segments",component:iTe,hidden:!1,type:"protected",layout:"main",menu:{},flag:Hb},{path:"/segments/edit/:segmentId",title:"Segments",component:lTe,hidden:!1,type:"protected",layout:"main",menu:{},flag:Hb},{path:"/segments",title:"Segments",component:Ske,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0},flag:Hb},{path:"/history",title:"Event log",component:k0e,type:"protected",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",component:cRe,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived toggles",component:Uke,type:"protected",menu:{}},{path:"/admin",title:"Admin",component:XAe,hidden:!1,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:KAe,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:VAe,type:"protected",menu:{}},{path:"/login",title:"Log in",component:Nme,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:uge,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:fge,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:wge,type:"unprotected",menu:{},isStandalone:!0}],uRe=[{path:"/history",title:"Event log",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/users",title:"Users",menu:{adminSettings:!0}},{path:"/admin/groups",title:"Groups",menu:{adminSettings:!0,mode:["enterprise"]},flag:Bme},{path:"/admin/roles",title:"Project roles",flag:Dme,menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/auth",title:"Single sign-on",menu:{adminSettings:!0}},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0}},{path:"/admin/service-accounts",title:"Service accounts",menu:{adminSettings:!0,mode:["enterprise"]}},{path:"/admin/network/*",title:"Network",menu:{adminSettings:!0,mode:["pro","enterprise"]},configFlag:"networkViewEnabled"},{path:"/admin/maintenance",title:"Maintenance",menu:{adminSettings:!0}},{path:"/admin/cors",title:"CORS origins",flag:"embedProxyFrontend",menu:{adminSettings:!0}},{path:"/admin/admin-invoices",title:"Billing & invoices",menu:{adminSettings:!0,mode:["pro"]}}],dRe=ch.filter(e=>!e.hidden),pRe=()=>{const e=dRe.filter(o=>o.menu.advanced),t=ch.filter(o=>o.menu.adminSettings),n=ch.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},$3=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag})),fRe=pRe(),hRe=(e={})=>{const t=Bt("api/admin/notifications"),{data:n,error:r,mutate:o}=An(t,mRe,e),i=m.useCallback(()=>{o().catch(console.warn)},[o]);return{notifications:n,error:r,loading:!r&&!n,refetchNotifications:i,mutateNotifications:o}},mRe=async e=>await(await fetch(e).then(Rn("Notifications"))).json();var VT={},gRe=En;Object.defineProperty(VT,"__esModule",{value:!0});var GT=VT.default=void 0,vRe=gRe(Tn()),yRe=kn,bRe=(0,vRe.default)((0,yRe.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"}),"Notifications");GT=VT.default=bRe;const wRe=C(Le)(({theme:e})=>({padding:e.spacing(1,1.5,1,3),display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",boxShadow:e.boxShadows.separator})),SRe=({children:e})=>l(ve,{children:x(wRe,{children:[l(se,{fontWeight:"bold",children:"Notifications"}),e]})}),xRe=C(ia)(({theme:e})=>({padding:e.spacing(1,1,3,1)})),CRe=({children:e})=>l(xRe,{"data-testid":"NOTIFICATIONS_LIST",children:e}),ERe=e=>m.createElement("svg",{width:18,height:14,viewBox:"0 0 18 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M0.59 2.00016L2 0.590157L5.41 4.00016L4 5.41016L0.59 2.00016ZM13 11.5002L13 8.00016L7.41 8.00016L2 13.4102L0.59 12.0002L6.59 6.00016L13 6.00016L13 2.50016L17.5 7.00016L13 11.5002Z",fill:"currentColor"})),N3=C(Le,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({padding:e.spacing(.5),marginRight:e.spacing(1.5),backgroundColor:t?e.palette.neutral.light:e.palette.secondary.light,width:"30px",height:"30px",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:`${e.shape.borderRadius}px`,top:3,left:7})),TRe=C(Aee)(({theme:e})=>({position:"relative",cursor:"pointer",padding:e.spacing(2.5,2,3,2),borderRadius:e.shape.borderRadiusMedium,width:"100%","&:after":{content:'""',width:`calc(100% - ${e.spacing(4)})`,height:"1px",position:"absolute",bottom:0,backgroundColor:e.palette.divider}})),kRe=C(Le)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%"})),ARe=C(Le)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(1,0,0,5.25)})),RRe=C(se,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,fontWeight:t?"normal":"bold",textDecoration:"none",color:"inherit",wordBreak:"break-all"})),_Re=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),PRe=C(Le)(({theme:e})=>({...Ac})),IRe=C(Sd)(({theme:e})=>({width:"18px",height:"18px"})),ORe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.neutral.main,marginLeft:e.spacing(1)})),$Re=({notification:e,onNotificationClick:t})=>{const n=gn(),{readAt:r}=e;return l(TRe,{onClick:()=>t(e),children:x(kRe,{children:[x(RRe,{readAt:!!r,children:[(i=>{if(i==="change-request")return l(N3,{readAt:!!r,children:l(ERe,{color:e.readAt?n.palette.neutral.main:n.palette.primary.main,style:{transform:"scale(0.8)"}})});if(i==="toggle")return l(N3,{readAt:!!r,children:l(wle,{sx:a=>({height:"20px",width:"20px",color:r?a.palette.neutral.main:a.palette.primary.main})})})})(e.notificationType)," ",e.message]}),x(ARe,{children:[x(PRe,{children:[l(IRe,{src:e.createdBy.imageUrl||""}),x(ORe,{children:["Created by ",e.createdBy.username]})]}),l(_Re,{children:l(x1,{date:new Date(e.createdAt)})})]})]})})},NRe=C(Le)(()=>({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",minHeight:"150px"})),LRe=C(GT)(({theme:e})=>({height:"30px",width:"30px",color:e.palette.neutral.main,marginBottom:e.spacing(1)})),MRe=({text:e})=>x(NRe,{children:[l(LRe,{}),l(se,{color:"neutral.main",children:e})]}),DRe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Yn({propagateErrors:!0});return{loading:r,errors:n,markAsRead:async i=>{const s=t("api/admin/notifications/read",{method:"POST",body:JSON.stringify(i)});try{await e(s.caller,s.id)}catch(c){throw c}}}},BRe=C(Le)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginTop:e.spacing(.5)})),FRe=({id:e,localStorageKey:t,eventName:n})=>{var d;const{uiConfig:r}=Ot(),{value:o,setValue:i}=Rc(`${r.baseUriPath}:${t}:v1:${e}`,{}),[a,s]=m.useState(o.value),{trackEvent:c}=Dr();if(!((d=r==null?void 0:r.flags)!=null&&d.T)||a)return null;const u=p=>{s(p),i({value:p}),c(n,{props:{eventType:e,wasHelpful:p==="yes"}})};return x(wr,{elevation:0,sx:{background:p=>p.palette.neutral.light,padding:p=>p.spacing(1.5,2),marginTop:p=>p.spacing(1.5)},children:["Was this information useful to you?",x(BRe,{children:[l(Ve,{size:"small",variant:a==="yes"?"contained":"outlined",sx:{padding:0},onClick:()=>u("yes"),disabled:!!a,children:"Yes"}),l(Ve,{size:"small",variant:a==="no"?"contained":"outlined",sx:{padding:0},onClick:()=>u("no"),disabled:!!a,children:"No"})]})]})},zRe=C(Le)(()=>({position:"relative"})),jRe=C(Le)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,display:"flex",justifyContent:"center"})),URe=C(se)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,textAlign:"center"})),WRe=C(wr)(({theme:e})=>({width:"420px",boxShadow:e.boxShadows.popup,borderRadius:`${e.shape.borderRadiusLarge}px`,position:"absolute",right:-100,top:60,maxHeight:"80vh",overflowY:"auto"})),HRe=C(Le)(({theme:e})=>({backgroundColor:e.palette.primary.main,borderRadius:"100%",width:"7px",height:"7px",position:"absolute",top:7,right:4})),VRe=C(Le)(()=>({...Ac})),GRe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),qRe=C(Ht)(({theme:e})=>({"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),KRe=()=>{const[e,t]=m.useState(!1),{notifications:n,refetchNotifications:r}=hRe({refreshInterval:15e3}),o=gt(),{markAsRead:i}=DRe(),{uiConfig:a}=Ot(),{trackEvent:s}=Dr(),[c,u]=m.useState(!1),d=async w=>{var S;w.link&&o(w.link),(S=a==null?void 0:a.flags)!=null&&S.T&&s("notifications",{props:{eventType:w.notificationType}}),t(!1);try{await i({notifications:[w.id]}),r()}catch(k){console.error("Error marking notification as read: ",k)}},p=async()=>{try{n&&n.length>0&&(await i({notifications:n.map(w=>w.id)}),r())}catch(w){console.error("Error marking all notification as read: ",w)}},f=w=>{w.key==="Escape"&&t(!1)},h=n==null?void 0:n.filter(w=>w.readAt===null),g=!!(h&&h.length>0),v=w=>c?!w.readAt:!0,y=n==null?void 0:n.filter(v).map(w=>l($Re,{notification:w,onNotificationClick:d},w.id)),b=!!(n&&n.length>0&&!c);return x(zRe,{children:[x(qRe,{onClick:()=>t(!e),"data-testid":"NOTIFICATIONS_BUTTON",disableFocusRipple:!0,children:[l(q,{condition:g,show:l(HRe,{})}),l(GT,{})]}),l(q,{condition:e,show:l(k6,{onClickAway:()=>t(!1),children:x(WRe,{className:"dropdown-outline",onKeyDown:f,"data-testid":"NOTIFICATIONS_MODAL",children:[l(SRe,{children:x(VRe,{children:[l(GRe,{children:"Show only unread"}),l(Ya,{onClick:()=>u(!c),checked:c})]})}),l(q,{condition:g,show:l(jRe,{"data-testid":"UNREAD_NOTIFICATIONS",children:l(Ve,{onClick:p,children:x(URe,{children:["Mark all as read (",h==null?void 0:h.length,")"]})})})})," ",l(q,{condition:(y==null?void 0:y.length)===0,show:l(MRe,{text:c?"No unread notifications":"No new notifications"})}),l(CRe,{children:y}),l(q,{condition:b,show:x(ve,{children:[l(FRe,{eventName:"notifications",id:"useful",localStorageKey:"NotificationsUsefulPrompt"}),l("br",{})]})})]})})})]})},L3=C(VK)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300})),M3=C(mJ)(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:1280,"&&&":{padding:0}})),D3=C("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),YRe=C("nav")({display:"flex",alignItems:"center",flexGrow:1}),XRe=C(vse)({width:"150px"}),JRe=C(gse)({width:"150px"}),QRe=C("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),ZRe=C("button")(({theme:e})=>({...ji(e),border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),B3=e=>({color:e.palette.neutral.main}),ug=C(hn)(({theme:e})=>ji(e)),e_e=C(Ht)(({theme:e})=>({...ji(e),borderRadius:100})),t_e=()=>{const{onSetThemeMode:e,themeMode:t}=_N(),n=gn(),r=gl(),o=gl(),[i,a]=m.useState(null),[s,c]=m.useState(null),[u,d]=m.useState(!1),{permissions:p}=T1(),{uiConfig:f,isOss:h,isPro:g,isEnterprise:v}=Ot(),y=or(n.breakpoints.down("md")),[b,w]=m.useState(!1),S=()=>w(_=>!_),k=()=>a(null),A=()=>c(null);m.useEffect(()=>{(p==null?void 0:p.find(I=>I.permission===fi))&&d(!0)},[p]);const T=fRe(),R=_=>{const{mode:I}=_.menu;return!I||I.includes("pro")&&g()||I.includes("enterprise")&&v()},P={mainNavRoutes:$3(T.mainNavRoutes).concat([{path:"/admin/api",title:"API access",menu:{}}]).filter(Kb(f)),mobileRoutes:$3(T.mobileRoutes).filter(Kb(f)),adminRoutes:uRe.filter(Kb(f)).filter(R).map(_=>({..._,path:_.path.replace("/*","")}))};return y?l(L3,{position:"static",children:x(M3,{children:[l(xt,{title:"Menu",arrow:!0,children:l(Ht,{sx:{color:_=>_.palette.text.primary},onClick:S,"aria-controls":"header-drawer","aria-expanded":b,size:"large",children:l(QN,{})})}),l(Gse,{title:f.name,flags:f.flags,links:f.links,open:b,toggleDrawer:S,admin:u,routes:P}),l(D3,{children:l(g5,{})})]})}):l(L3,{position:"static",children:x(M3,{children:[l(ug,{to:"/",sx:Ac,"aria-label":"Home",children:l(Lh,{darkmode:l(XRe,{"aria-label":"Unleash logo"}),lightmode:l(JRe,{"aria-label":"Unleash logo"})})}),x(YRe,{children:[x(QRe,{children:[l(ug,{to:"/projects",children:"Projects"}),l(ug,{to:"/features",children:"Feature toggles"}),l(ug,{to:"/playground",children:"Playground"}),x(ZRe,{onClick:_=>c(_.currentTarget),"aria-controls":s?o:void 0,"aria-expanded":!!s,children:["Configure",l(rx,{sx:B3})]}),l(C5,{id:o,options:P.mainNavRoutes,anchorEl:s,handleClose:A,style:{top:10}})]}),x(D3,{children:[l(xt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:l(Ht,{onClick:e,sx:ji,children:l(q,{condition:t==="dark",show:l(Zse,{}),elseShow:l(ple,{})})})})," ",l(q,{condition:!h(),show:l(KRe,{})}),l(xt,{title:"Documentation",arrow:!0,children:l(Ht,{href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",disableRipple:!0,sx:ji,children:l(dE,{})})}),l(q,{condition:u,show:l(xt,{title:"Settings",arrow:!0,children:x(e_e,{onClick:_=>a(_.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":!!i,size:"large",disableRipple:!0,children:[l(ZN,{}),l(rx,{sx:B3})]})})}),l(C5,{id:r,options:P.adminRoutes,anchorEl:i,handleClose:k,style:{top:5,left:-100}})," ",l(g5,{})]})]})]})})},n_e=e=>{var n;const t=(n=e.versionInfo)==null?void 0:n.current;return t!=null&&t.enterprise?`${e.name} ${t.enterprise}`:t!=null&&t.oss?`${e.name} ${t.oss}`:`${e.name} ${e.version}`},r_e=e=>{var r,o;const t=(r=e.versionInfo)==null?void 0:r.latest,n=(o=e.versionInfo)==null?void 0:o.isLatest;if(t!=null&&t.enterprise&&!n)return`Upgrade available - Latest Enterprise release: ${t.enterprise}`;if(t!=null&&t.oss&&!n)return`Upgrade available - Latest OSS release: ${t.oss}`},Dg=C("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),o_e=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=n_e(e.uiConfig),r=e.uiConfig.environment,o=r_e(e.uiConfig);return x("section",{title:"API details",children:[x(Dg,{children:[n," ",l(q,{condition:!!r,show:x("small",{children:["(",r,")"]})})]}),l(q,{condition:!!o,show:x("small",{children:[o,l("br",{})]})}),l("br",{}),l("small",{children:e.uiConfig.slogan}),l("br",{}),l(q,{condition:!!t,show:l("small",{children:`${t}`})})]})},i_e=C("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.background.paper})),gw=C(ia)({padding:0,margin:0}),cr=C(_a)(({theme:e})=>({padding:0,margin:0,"& a":{...ji(e),textDecoration:"none",color:e.palette.text.primary,"&:hover":{textDecoration:"underline"}}})),a_e=()=>{const{uiConfig:e}=Ot();return l(i_e,{children:x(Wn,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[l(Wn,{item:!0,md:4,xs:12,children:l(o_e,{uiConfig:e})}),l(Wn,{item:!0,xs:12,md:"auto",children:x(Wn,{container:!0,spacing:7,direction:"row",children:[l(Wn,{item:!0,children:x("section",{title:"Unleash SDK",children:[l(Dg,{children:"Server SDKs"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",rel:"noreferrer",children:"Node.js"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",rel:"noreferrer",children:"Java"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",rel:"noreferrer",children:"Go"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/rust",target:"_blank",rel:"noreferrer",children:"Rust"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",rel:"noreferrer",children:"Ruby"})})})," ",l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",rel:"noreferrer",children:"Python"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",rel:"noreferrer",children:".NET"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",rel:"noreferrer",children:"PHP"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"All SDKs"})})})]})]})}),l(Wn,{item:!0,children:x("section",{title:"Unleash SDK",children:[l(Dg,{children:"Frontend SDKs"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",rel:"noreferrer",children:"Unleash Proxy"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",rel:"noreferrer",children:"JavaScript"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",rel:"noreferrer",children:"React"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/next-js",target:"_blank",rel:"noreferrer",children:"Next.js"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/vue",target:"_blank",rel:"noreferrer",children:"Vue"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",rel:"noreferrer",children:"iOS"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",rel:"noreferrer",children:"Android"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://docs.getunleash.io/reference/sdks/flutter",target:"_blank",rel:"noreferrer",children:"Flutter"})})})]})]})}),l(Wn,{item:!0,children:x("section",{children:[l(Dg,{children:"About"}),x(gw,{dense:!0,children:[l(cr,{children:l(rn,{primary:l("a",{href:"https://www.getunleash.io/",target:"_blank",rel:"noreferrer",children:"getunleash.io"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://twitter.com/getunleash",target:"_blank",rel:"noreferrer",children:"Twitter"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",rel:"noreferrer",children:"LinkedIn"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://github.com/Unleash/unleash",target:"_blank",rel:"noreferrer",children:"GitHub"})})}),l(cr,{children:l(rn,{primary:l("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Slack Community"})})})]})]})})]})})]})})},s_e=C(tn)(({theme:e})=>({marginBottom:e.spacing(2)})),l_e=C(se)(({theme:e})=>({maxWidth:"800px"})),c_e=C("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),u_e=e=>!(!e||localStorage&&localStorage.getItem(e)),d_e=({toast:e})=>{const[t,n]=m.useState(!1);m.useEffect(()=>{n(u_e((e==null?void 0:e.id)||""))},[e==null?void 0:e.id]);const r=()=>{localStorage&&localStorage.setItem((e==null?void 0:e.id)||"","seen"),n(!1)};return e?l(q,{condition:t,show:x(s_e,{severity:e.severity,onClose:r,children:[l(l_e,{variant:"body2",children:e.message}),l(c_e,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},p_e=C("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),f_e=C(yX)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),F3=C("p")(TN),h_e=C(hn)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),m_e=()=>{const{isAdmin:e}=m.useContext(yo),t=Ho(),n=t.pathname.split("/").filter(r=>r).filter(r=>r!=="create"&&r!=="edit"&&r!=="view"&&r!=="variants"&&r!=="logs"&&r!=="metrics"&&r!=="copy"&&r!=="features"&&r!=="features2"&&r!=="create-toggle"&&r!=="settings"&&r!=="profile");return l(p_e,{children:l(q,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:l(q,{condition:n.length>1,show:l(f_e,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return l(F3,{children:r},r);let a="/";return n.forEach((s,c)=>{c!==o&&c<o?a+=s+"/":c===o&&(a+=s)}),l(h_e,{to:a,children:l(F3,{children:r})},r)})})})})})},z3="/static/texture-c29e66c0.png",AD="skip-nav-target-id",g_e=()=>l("div",{id:AD}),v_e=C("a")(({theme:e})=>({position:"fixed",overflow:"hidden",zIndex:1e3,top:e.spacing(2.25),left:e.spacing(2.25),padding:e.spacing(1,2),whiteSpace:"nowrap",textDecoration:"none",background:e.palette.background.alternative,color:e.palette.common.white,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallBody,...ji(e),[e.breakpoints.down(960)]:{top:"0.8rem",left:"0.8rem"},"&:not(:focus):not(:active)":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0}})),y_e=()=>x(v_e,{href:`#${AD}`,children:["Skip to content ",l("span",{"aria-hidden":!0,children:"↓"})]}),b_e=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>x(G6,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[x(Le,{sx:i=>({backgroundColor:i.palette.neutral.light,borderRadius:a=>`${a.shape.borderRadiusLarge}px ${a.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:a=>n?a.palette.warning.border:a.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[l(q,{condition:!!n,show:x(tn,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"}},children:[l("strong",{children:"Conflict!"})," ",n,"."]})}),x(Le,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[l(se,{children:"Feature toggle name: "}),l(Vr,{component:hn,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:l("strong",{children:e})})]})]}),l(Le,{children:o})]});var qT={},w_e=En;Object.defineProperty(qT,"__esModule",{value:!0});var RD=qT.default=void 0,S_e=w_e(Tn()),x_e=kn,C_e=(0,S_e.default)((0,x_e.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}),"Block");RD=qT.default=C_e;var KT={},E_e=En;Object.defineProperty(KT,"__esModule",{value:!0});var _D=KT.default=void 0,T_e=E_e(Tn()),k_e=kn,A_e=(0,T_e.default)((0,k_e.jsx)("path",{d:"m19.07 4.93-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"}),"TrackChanges");_D=KT.default=A_e;var R_e=200,YT="__lodash_hash_undefined__",__e=1/0,PD=9007199254740991,P_e="[object Arguments]",I_e="[object Function]",O_e="[object GeneratorFunction]",$_e="[object Symbol]",N_e=/[\\^$.*+?()[\]{}|]/g,L_e=/^\[object .+?Constructor\]$/,M_e=/^(?:0|[1-9]\d*)$/,D_e=typeof Ci=="object"&&Ci&&Ci.Object===Object&&Ci,B_e=typeof self=="object"&&self&&self.Object===Object&&self,XT=D_e||B_e||Function("return this")();function F_e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function z_e(e,t){var n=e?e.length:0;return!!n&&W_e(e,t,0)>-1}function j_e(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function ID(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function JT(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function U_e(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function W_e(e,t,n){if(t!==t)return U_e(e,H_e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function H_e(e){return e!==e}function V_e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function G_e(e){return function(t){return e(t)}}function q_e(e,t){return e.has(t)}function K_e(e,t){return e==null?void 0:e[t]}function Y_e(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function OD(e,t){return function(n){return e(t(n))}}var X_e=Array.prototype,J_e=Function.prototype,J1=Object.prototype,vw=XT["__core-js_shared__"],j3=function(){var e=/[^.]+$/.exec(vw&&vw.keys&&vw.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),$D=J_e.toString,Nd=J1.hasOwnProperty,QT=J1.toString,Q_e=RegExp("^"+$D.call(Nd).replace(N_e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U3=XT.Symbol,Z_e=OD(Object.getPrototypeOf,Object),e5e=J1.propertyIsEnumerable,t5e=X_e.splice,W3=U3?U3.isConcatSpreadable:void 0,Px=Object.getOwnPropertySymbols,H3=Math.max,n5e=LD(XT,"Map"),uh=LD(Object,"create");function yc(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function r5e(){this.__data__=uh?uh(null):{}}function o5e(e){return this.has(e)&&delete this.__data__[e]}function i5e(e){var t=this.__data__;if(uh){var n=t[e];return n===YT?void 0:n}return Nd.call(t,e)?t[e]:void 0}function a5e(e){var t=this.__data__;return uh?t[e]!==void 0:Nd.call(t,e)}function s5e(e,t){var n=this.__data__;return n[e]=uh&&t===void 0?YT:t,this}yc.prototype.clear=r5e;yc.prototype.delete=o5e;yc.prototype.get=i5e;yc.prototype.has=a5e;yc.prototype.set=s5e;function Ld(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function l5e(){this.__data__=[]}function c5e(e){var t=this.__data__,n=Q1(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():t5e.call(t,n,1),!0}function u5e(e){var t=this.__data__,n=Q1(t,e);return n<0?void 0:t[n][1]}function d5e(e){return Q1(this.__data__,e)>-1}function p5e(e,t){var n=this.__data__,r=Q1(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Ld.prototype.clear=l5e;Ld.prototype.delete=c5e;Ld.prototype.get=u5e;Ld.prototype.has=d5e;Ld.prototype.set=p5e;function Md(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function f5e(){this.__data__={hash:new yc,map:new(n5e||Ld),string:new yc}}function h5e(e){return Z1(this,e).delete(e)}function m5e(e){return Z1(this,e).get(e)}function g5e(e){return Z1(this,e).has(e)}function v5e(e,t){return Z1(this,e).set(e,t),this}Md.prototype.clear=f5e;Md.prototype.delete=h5e;Md.prototype.get=m5e;Md.prototype.has=g5e;Md.prototype.set=v5e;function Uv(e){var t=-1,n=e?e.length:0;for(this.__data__=new Md;++t<n;)this.add(e[t])}function y5e(e){return this.__data__.set(e,YT),this}function b5e(e){return this.__data__.has(e)}Uv.prototype.add=Uv.prototype.push=y5e;Uv.prototype.has=b5e;function w5e(e,t){var n=ZT(e)||MD(e)?V_e(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Nd.call(e,i))&&!(o&&(i=="length"||O5e(i,r)))&&n.push(i);return n}function Q1(e,t){for(var n=e.length;n--;)if(F5e(e[n][0],t))return n;return-1}function S5e(e,t,n,r){var o=-1,i=z_e,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=ID(t,G_e(n))),r?(i=j_e,a=!1):t.length>=R_e&&(i=q_e,a=!1,t=new Uv(t));e:for(;++o<s;){var d=e[o],p=n?n(d):d;if(d=r||d!==0?d:0,a&&p===p){for(var f=u;f--;)if(t[f]===p)continue e;c.push(d)}else i(t,p,r)||c.push(d)}return c}function ND(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=I5e),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?ND(s,t-1,n,r,o):JT(o,s):r||(o[o.length]=s)}return o}function x5e(e,t,n){var r=t(e);return ZT(e)?r:JT(r,n(e))}function C5e(e){if(!ek(e)||N5e(e))return!1;var t=BD(e)||Y_e(e)?Q_e:L_e;return t.test(B5e(e))}function E5e(e){if(!ek(e))return M5e(e);var t=L5e(e),n=[];for(var r in e)r=="constructor"&&(t||!Nd.call(e,r))||n.push(r);return n}function T5e(e,t){return e=Object(e),k5e(e,t,function(n,r){return r in e})}function k5e(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],s=e[a];n(s,a)&&(i[a]=s)}return i}function A5e(e,t){return t=H3(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=H3(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i,F_e(e,this,a)}}function R5e(e){return x5e(e,W5e,P5e)}function Z1(e,t){var n=e.__data__;return $5e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function LD(e,t){var n=K_e(e,t);return C5e(n)?n:void 0}var _5e=Px?OD(Px,Object):zD,P5e=Px?function(e){for(var t=[];e;)JT(t,_5e(e)),e=Z_e(e);return t}:zD;function I5e(e){return ZT(e)||MD(e)||!!(W3&&e&&e[W3])}function O5e(e,t){return t=t??PD,!!t&&(typeof e=="number"||M_e.test(e))&&e>-1&&e%1==0&&e<t}function $5e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function N5e(e){return!!j3&&j3 in e}function L5e(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||J1;return e===n}function M5e(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function D5e(e){if(typeof e=="string"||U5e(e))return e;var t=e+"";return t=="0"&&1/e==-__e?"-0":t}function B5e(e){if(e!=null){try{return $D.call(e)}catch{}try{return e+""}catch{}}return""}function F5e(e,t){return e===t||e!==e&&t!==t}function MD(e){return z5e(e)&&Nd.call(e,"callee")&&(!e5e.call(e,"callee")||QT.call(e)==P_e)}var ZT=Array.isArray;function DD(e){return e!=null&&j5e(e.length)&&!BD(e)}function z5e(e){return FD(e)&&DD(e)}function BD(e){var t=ek(e)?QT.call(e):"";return t==I_e||t==O_e}function j5e(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=PD}function ek(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function FD(e){return!!e&&typeof e=="object"}function U5e(e){return typeof e=="symbol"||FD(e)&&QT.call(e)==$_e}function W5e(e){return DD(e)?w5e(e,!0):E5e(e)}var H5e=A5e(function(e,t){return e==null?{}:(t=ID(ND(t,1),D5e),T5e(e,S5e(R5e(e),t)))});function zD(){return[]}var V5e=H5e;const G5e=qr(V5e),q5e=C("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),yw=({change:e,currentStrategy:t})=>{const n=e.action==="deleteStrategy"?void 0:e.payload;return l(q5e,{children:l(D1,{entry:{preData:G5e(t,"sortOrder"),data:n}})})},K5e=C("div")(({theme:e})=>({display:"grid",gridAutoFlow:"column",gridTemplateColumns:"auto 1fr",gap:e.spacing(1),alignItems:"center"})),bw=C("div")(()=>({...TN,maxWidth:500})),ww=({change:e,previousTitle:t,children:n})=>x(K5e,{children:[l(dhe,{strategyName:e.payload.name}),x(bw,{children:[l(q,{condition:!!(t&&t!==e.payload.title||!t&&e.payload.title),show:x(bw,{children:[l(se,{component:"s",color:"text.secondary",children:t||yl(e.payload.name)})," "]})}),l(bw,{children:l(Uh,{tooltip:n,tooltipProps:{maxWidth:500,maxHeight:600},children:l(se,{component:"span",children:e.payload.title||yl(e.payload.name)})})})]})]}),V3=({percentage:e,size:t="4rem"})=>{const n=gn(),r={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:n.palette.background.elevation2},o=100/(2*Math.PI),i=2*o;return l("svg",{viewBox:`0 0 ${i} ${i}`,style:r,"aria-hidden":!0,children:l("circle",{r:o,cx:o,cy:o,fill:"none",stroke:n.palette.primary.light,strokeWidth:i,strokeDasharray:`${e} 100`})})},Y5e=C("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),X5e=C("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),J5e=C(Ts)(({theme:e})=>({margin:e.spacing(.5)})),Sw=({value:e,text:t})=>l(Y5e,{children:l(q,{condition:e.length===0,show:x("p",{children:["No ",t,"s added yet."]}),elseShow:x("div",{children:[x(X5e,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>l(J5e,{label:l(Ca,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),Q5e=({segments:e})=>!e||e.length===0?null:l(ve,{children:e.map((t,n)=>x(m.Fragment,{children:[l(q,{condition:n>0,show:l(DT,{text:"AND"})}),l(nD,{segment:t})]},t.id))}),G3=()=>l(Le,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),Bl=C(Le)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium})),xw=C("span")(({theme:e})=>({color:e.palette.neutral.main})),q3=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,{strategies:r}=Ad(),{uiConfig:o}=Ot(),{segments:i}=_l(),a=i==null?void 0:i.filter(p=>{var f;return(f=e.segments)==null?void 0:f.includes(p.id)}),s=r.find(p=>p.name===e.name),c=m.useMemo(()=>!t||s!=null&&s.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":const f=ff(t[p]);return x(Bl,{sx:{display:"flex",alignItems:"center"},children:[l(Le,{sx:{mr:2},children:l(V3,{percentage:f,size:"2rem"})}),x("div",{children:[x(Zt,{color:"success",children:[f,"%"]})," of your base"," ",n.length>0?"who match constraints":""," ","is included."]})]});case"userIds":case"UserIds":const h=Ks(t[p]);return l(Sw,{value:h,text:"user"},p);case"hostNames":case"HostNames":const g=Ks(t[p]);return l(Sw,{value:g,text:"host"},p);case"IPs":const v=Ks(t[p]);return l(Sw,{value:v,text:"IP"},p);case"stickiness":case"groupId":return null;default:return null}}),[t,s,n]),u=m.useMemo(()=>{if(!t||!(s!=null&&s.editable))return null;const p=l(xw,{children:" is set to "});return s==null?void 0:s.parameters.map(f=>{const{type:h,name:g}={...f};if(!h||!g||t[g]===void 0)return null;const v=l(Ca,{maxLength:15,maxWidth:"150",text:g});switch(f==null?void 0:f.type){case"list":const y=Ks(t[g]);return y.length>0?x(Bl,{children:[v," ",x(xw,{children:["has ",y.length," ",y.length>1?"items":"item",":"," ",y.map(k=>l(Ts,{label:l(Ca,{maxWidth:"300",text:k,maxLength:50}),sx:{mr:.5}},k))]})]}):null;case"percentage":const b=ff(t[g]);return t[g]!==""?x(Bl,{sx:{display:"flex",alignItems:"center"},children:[l(Le,{sx:{mr:2},children:l(V3,{percentage:b,size:"2rem"})}),x("div",{children:[v,p,x(Zt,{color:"success",children:[b,"%"]})]})]}):null;case"boolean":return t[g]==="true"||t[g]==="false"?x(Bl,{children:[l(Ca,{maxLength:15,maxWidth:"150",text:g}),p,l(Zt,{color:t[g]==="true"?"success":"error",children:t[g]})]}):null;case"string":const w=ol(t[g]);return typeof t[g]<"u"?x(Bl,{children:[v,l(q,{condition:w==="",show:l(xw,{children:" is an empty string"}),elseShow:x(ve,{children:[p,l(Ca,{maxWidth:"300",text:w,maxLength:50})]})})]}):null;case"number":const S=ff(t[g]);return t[g]!==""&&S!==void 0?x(Bl,{children:[v,p,l(Ca,{maxWidth:"300",text:String(S),maxLength:50})]}):null;case"default":return null}return null})},[t,s]);if(!t)return l(G3,{});const d=[!!o.flags.SE&&a&&a.length>0&&l(Q5e,{segments:a}),n.length>0&&l(K1,{constraints:n,showLabel:!1}),e.name==="default"&&l(ve,{children:x(Bl,{sx:{width:"100%"},children:["The standard strategy is ",l(Zt,{color:"success",children:"ON"})," ","for all users."]})}),...c??[],...u??[]].filter(Boolean);return l(q,{condition:d.length>0,show:l(ve,{children:d.map((p,f)=>x(m.Fragment,{children:[l(q,{condition:f>0,show:l(DT,{text:"AND"})}),p]},f))}),elseShow:l(G3,{})})},Z5e=(e,t,n,r)=>{var a,s;return(s=(a=Ss(t,n).feature)==null?void 0:a.environments.find(c=>c.name===r))==null?void 0:s.strategies.find(c=>"id"in e.payload&&c.id===e.payload.id)},jD=C(Le)({display:"flex",justifyContent:"space-between",alignItems:"center"}),K3=C(Le)(({theme:e})=>({display:"grid",gridTemplateColumns:"auto 40px",gap:e.spacing(1),alignItems:"center",marginBottom:e.spacing(2),width:"100%"})),Cw=C(Le)(({theme:e})=>({display:"grid",gridTemplateColumns:"150px auto",gridAutoFlow:"column",alignItems:"center",flexGrow:1,gap:e.spacing(1)})),ePe=e=>typeof e=="object"&&e!==null&&"name"in e,Y3=({show:e=!0,disabled:t})=>e?t?l(xt,{title:"This strategy will not be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:l(Zt,{color:"disabled",icon:l(RD,{}),children:"Disabled"})}):l(xt,{title:"This was disabled before and with this change it will be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:l(Zt,{color:"success",icon:l(_D,{}),children:"Enabled"})}):null,tPe=({wasDisabled:e=!1,willBeDisabled:t=!1})=>e&&t?l(se,{color:"action.disabled",children:"Editing strategy:"}):!e&&t?l(se,{color:"error.dark",children:"Editing strategy:"}):e&&!t?l(se,{color:"success.dark",children:"Editing strategy:"}):l(se,{children:"Editing strategy:"}),nPe=({discard:e,change:t,featureName:n,environmentName:r,projectId:o})=>{var a,s,c,u,d;const i=Z5e(t,o,n,r);return x(ve,{children:[t.action==="addStrategy"&&x(ve,{children:[x(K3,{children:[x(Cw,{children:[l(se,{color:(a=t.payload)!=null&&a.disabled?"action.disabled":"success.dark",children:"+ Adding strategy:"}),l(ww,{change:t,children:l(yw,{change:t,currentStrategy:i})}),l("div",{children:l(Y3,{disabled:!0,show:((s=t.payload)==null?void 0:s.disabled)===!0})})]}),l("div",{children:e})]}),l(q3,{strategy:t.payload})]}),t.action==="deleteStrategy"&&x(jD,{children:[x(Cw,{children:[l(se,{sx:p=>({color:p.palette.error.main}),children:"- Deleting strategy:"}),ePe(t.payload)&&l(ww,{change:t,children:l(yw,{change:t,currentStrategy:i})})]}),l("div",{children:e})]}),t.action==="updateStrategy"&&x(ve,{children:[x(K3,{children:[x(Cw,{children:[l(tPe,{wasDisabled:i==null?void 0:i.disabled,willBeDisabled:(c=t.payload)==null?void 0:c.disabled}),l(ww,{change:t,previousTitle:i==null?void 0:i.title,children:l(yw,{change:t,currentStrategy:i})})]}),l("div",{children:e})]}),l(q,{condition:((u=t.payload)==null?void 0:u.disabled)!==(i==null?void 0:i.disabled),show:x(se,{sx:{marginTop:p=>p.spacing(2),marginBottom:p=>p.spacing(2),...Ac,gap:p=>p.spacing(1)},children:["This strategy will be"," ",l(Y3,{disabled:((d=t.payload)==null?void 0:d.disabled)||!1})]})}),l(q3,{strategy:t.payload})]})]})},rPe=({enabled:e,discard:t})=>x(jD,{children:[x(Le,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",l(Zt,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),oPe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,whiteSpace:"pre-wrap"})),iPe=({value:e})=>{const{searchQuery:t}=Al();return e?e.type==="string"&&e.value.length<20?l(rr,{children:l(Ua,{search:t,children:e.value})}):l(rr,{children:l(Uh,{tooltip:l(ve,{children:l(oPe,{children:l(Ua,{search:t,children:e.value})})}),highlighted:t.length>0&&e.value.toLowerCase().includes(t.toLowerCase()),children:e.type})}):l(rr,{})},aPe=C(se)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),sPe=({value:e})=>{const{searchQuery:t}=Al();if(!e||e.length===0)return l(rr,{});const n=r=>`${r.contextName}:${r.values.join()}`;return l(rr,{children:l(Uh,{tooltip:l(ve,{children:e.map((r,o)=>l(aPe,{children:l(Ua,{search:t,children:n(r)})},r.contextName+o))}),highlighted:t.length>0&&(e==null?void 0:e.map(n).join(`
362
362
  `).toLowerCase().includes(t.toLowerCase())),children:e.length===1?"1 override":`${e.length} overrides`})})},lPe=({variants:e,searchValue:t=""})=>{const n=ir("projectId"),r=gn(),o=or(r.breakpoints.down("md")),i=or(r.breakpoints.down("lg")),a=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:gs,sortType:"alphanumeric",minWidth:350,searchable:!0},{Header:"Payload",accessor:"payload",Cell:iPe,disableSortBy:!0,searchable:!0,filterParsing:y=>y==null?void 0:y.value},{Header:"Overrides",accessor:"overrides",Cell:sPe,disableSortBy:!0,searchable:!0,filterParsing:y=>(y==null?void 0:y.map(({contextName:b,values:w})=>`${b}:${w.join()}`).join(`
363
363
  `))||""},{Header:"Weight",accessor:"weight",Cell:({row:{original:{name:y,weight:b}}})=>x(rr,{"data-testid":`VARIANT_WEIGHT_${y}`,children:[rve(b)," %"]}),sortType:"number"},{Header:"Type",accessor:y=>y.weightType==="fix"?"Fixed":"Variable",Cell:rr,sortType:"alphanumeric"}],[n,e]),s=m.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{data:c,getSearchText:u}=jh(a,t,e),{getTableProps:d,getTableBodyProps:p,headerGroups:f,rows:h,prepareRow:g,setHiddenColumns:v}=Yt.useTable({columns:a,data:c,initialState:s,sortTypes:si,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},Yt.useSortBy);return Ed([{condition:o,columns:["payload","overrides"]},{condition:i,columns:["weightType"]}],v,a),x(ve,{children:[l(Xa,{value:u(t),children:x(la,{...d(),children:[l(sa,{headerGroups:f}),l(aa,{...p(),children:h.map(y=>(g(y),l(zi,{hover:!0,...y.getRowProps(),children:y.cells.map(b=>l(Wi,{...b.getCellProps(),children:b.render("Cell")}))})))})]})}),l(q,{condition:h.length===0,show:l(q,{condition:(t==null?void 0:t.length)>0,show:x(Kn,{children:["No variants found matching “",t,"”"]})})})]})},cPe=C("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),X3=e=>e.reduce((t,{name:n,...r})=>({...t,[n]:r}),{}),uPe=({preData:e,data:t})=>l(cPe,{children:l(D1,{entry:{preData:X3(e),data:X3(t)},sort:(n,r)=>n.index-r.index})}),dPe=C(Le)({display:"flex",flexDirection:"column"}),pPe=C(Le)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2),lineHeight:e.spacing(3)})),fPe=C("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",alignItems:"center",gap:e.spacing(1.5),marginBottom:e.spacing(.5),fontSize:e.fontSizes.smallBody})),hPe=({feature:e,project:t,environment:n,change:r,discard:o})=>{var s,c;const{feature:i}=Ss(t,e),a=((s=i.environments.find(({name:u})=>n===u))==null?void 0:s.variants)??[];return x(dPe,{children:[x(pPe,{children:[l(Uh,{tooltip:l(uPe,{preData:a,data:r.payload.variants}),tooltipProps:{maxWidth:500,maxHeight:600},children:"Updating variants to:"}),o]}),l(lPe,{variants:r.payload.variants}),l(q,{condition:r.payload.variants.length>1,show:l(ve,{children:x(fPe,{children:[l("p",{children:"Stickiness:"}),l(Zt,{children:((c=r.payload.variants[0])==null?void 0:c.stickiness)||"default"})]})})})]})},mPe=C(Le,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$hasConflict:t,$isInConflictFeature:n,$isAfterWarning:r,$isLast:o})=>({borderLeft:"1px solid",borderRight:"1px solid",borderTop:"1px solid",borderBottom:o?"1px solid":"none",borderRadius:o?`0 0
364
364
  ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`:0,borderColor:t||n?e.palette.warning.border:e.palette.divider,borderTopColor:(t||r)&&!n?e.palette.warning.border:e.palette.divider})),gPe=C(tn)(({theme:e})=>({borderRadius:0,padding:e.spacing(0,2),"&.MuiAlert-standardWarning":{borderStyle:"none none solid none"}})),J3=({index:e,change:t,feature:n,changeRequest:r,discard:o})=>{var a;const i=n.defaultChange?n.changes.length+1:n.changes.length;return x(mPe,{$hasConflict:!!t.conflict,$isInConflictFeature:!!n.conflict,$isAfterWarning:!!((a=n.changes[e-1])!=null&&a.conflict),$isLast:e+1===i,children:[l(q,{condition:!!t.conflict&&!n.conflict,show:x(gPe,{severity:"warning",children:[l("strong",{children:"Conflict!"})," This change can’t be applied."," ",t.conflict,"."]})}),x(Le,{sx:s=>({padding:s.spacing(3)}),children:[t.action==="updateEnabled"&&l(rPe,{enabled:t.payload.enabled,discard:o}),t.action==="addStrategy"||t.action==="deleteStrategy"||t.action==="updateStrategy"?l(nPe,{discard:o,change:t,featureName:n.name,environmentName:r.environment,projectId:r.project}):null,t.action==="patchVariant"&&l(hPe,{feature:n.name,project:r.project,environment:r.environment,change:t,discard:o})]})]},QM(t))},tk=e=>e.features.flatMap(t=>t.changes).length,vPe=({change:e,changeRequestId:t,environment:n,open:r,onSubmit:o,onClose:i,featureId:a})=>{const s=ir("projectId"),{editChange:c}=qh(),[u,d]=m.useState(e.payload),{segments:p}=_l(),f=(p==null?void 0:p.filter(D=>{var K;return(K=e.payload.segments)==null?void 0:K.includes(D.id)}))||[],[h,g]=m.useState(f),v={parameters:e.payload.parameters,name:e.payload.name},{setToastData:y,setToastApiError:b}=$t(),w=sD(),{uiConfig:S}=Ot(),{unleashUrl:k}=S,{isChangeRequestConfigured:A}=_c(s),{feature:T,refetchFeature:R}=Ss(s,a),P=m.useRef(T),{data:_,staleDataNotification:I,forceRefreshCache:$}=lD({unleashGetter:Ss,params:[s,a],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},T,{afterSubmitAction:R},cD);m.useEffect(()=>{P.current.name===""&&T.name&&($(T),P.current=T)},[T]);const U={...u,segments:h.map(D=>D.id)},M=async()=>{try{await c(s,t,e.id,{action:u.id?"updateStrategy":"addStrategy",feature:a,payload:U}),o(),y({title:"Change updated",type:"success"})}catch(D){b(ht(D))}};return!v||!_?null:l(X1,{open:r,onClose:i,label:"Edit change",onClick:D=>{D.stopPropagation()},children:x(Yr,{modal:!0,title:yl(v.name??""),description:bPe,documentationLink:wPe,documentationLinkLabel:SPe,formatApiCode:()=>yPe(s,t,e.id,U,k),children:[l(aD,{projectId:s,feature:_,strategy:u,setStrategy:d,segments:h,setSegments:g,environmentId:n,onSubmit:M,onCancel:i,loading:!1,permission:v1,errors:w,isChangeRequest:A(n)}),I]})})},yPe=(e,t,n,r,o)=>{if(!o)return"";const i=`${o}/api/admin/projects/${e}/change-requests/${t}/changes/${n}`,a=JSON.stringify(r,void 0,2);return`curl --location --request PUT '${i}' \\
@@ -1 +1 @@
1
- import{cC as u,cF as g,cE as i}from"./index-66ec1ba9.js";function f(n,o){u(2,arguments);var e=g(n),a=i(o);if(isNaN(a))return new Date(NaN);if(!a)return e;var r=e.getDate(),t=new Date(e.getTime());t.setMonth(e.getMonth()+a+1,0);var s=t.getDate();return r>=s?t:(e.setFullYear(t.getFullYear(),t.getMonth(),r),e)}export{f as a};
1
+ import{cC as u,cF as g,cE as i}from"./index-1f392976.js";function f(n,o){u(2,arguments);var e=g(n),a=i(o);if(isNaN(a))return new Date(NaN);if(!a)return e;var r=e.getDate(),t=new Date(e.getTime());t.setMonth(e.getMonth()+a+1,0);var s=t.getDate();return r>=s?t:(e.setFullYear(t.getFullYear(),t.getMonth(),r),e)}export{f as a};
@@ -1 +1 @@
1
- import{cC as n,cF as s,cE as o}from"./index-66ec1ba9.js";function i(e,r){n(2,arguments);var a=s(e),t=o(r);return isNaN(t)?new Date(NaN):(t&&a.setDate(a.getDate()+t),a)}export{i as a};
1
+ import{cC as n,cF as s,cE as o}from"./index-1f392976.js";function i(e,r){n(2,arguments);var a=s(e),t=o(r);return isNaN(t)?new Date(NaN):(t&&a.setDate(a.getDate()+t),a)}export{i as a};
@@ -1 +1 @@
1
- import{aO as r,aP as a,r as o,aQ as c}from"./index-66ec1ba9.js";const u=(e={})=>{const{data:t,error:n,mutate:s}=r(a("api/admin/metrics/rps"),i,e);return o.useMemo(()=>({metrics:t,loading:!n&&!t,refetch:()=>s(),error:n}),[t,n,s])},i=e=>fetch(e).then(c("Instance Metrics")).then(t=>t.json()),f=e=>!e||e==="undefined"?"unknown":e;export{f as a,u};
1
+ import{aO as r,aP as a,r as o,aQ as c}from"./index-1f392976.js";const u=(e={})=>{const{data:t,error:n,mutate:s}=r(a("api/admin/metrics/rps"),i,e);return o.useMemo(()=>({metrics:t,loading:!n&&!t,refetch:()=>s(),error:n}),[t,n,s])},i=e=>fetch(e).then(c("Instance Metrics")).then(t=>t.json()),f=e=>!e||e==="undefined"?"unknown":e;export{f as a,u};