unleash-server 5.2.4 → 5.2.6
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.
- package/dist/lib/routes/admin-api/project/api-token.js +1 -2
- package/dist/lib/routes/admin-api/project/api-token.js.map +1 -1
- package/dist/lib/routes/admin-api/project/project-features.d.ts +5 -3
- package/dist/lib/routes/admin-api/project/project-features.js +23 -1
- package/dist/lib/routes/admin-api/project/project-features.js.map +1 -1
- package/dist/lib/routes/admin-api/tag.d.ts +0 -2
- package/dist/lib/routes/admin-api/tag.js +1 -21
- package/dist/lib/routes/admin-api/tag.js.map +1 -1
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js +43 -0
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js.map +1 -1
- package/dist/test/e2e/api/admin/tags.e2e.test.js +3 -3
- package/dist/test/e2e/api/admin/tags.e2e.test.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-b8d00f81.js → AdvancedPlayground-fa382438.js} +1 -1
- package/frontend/build/static/{CreateProject-fe1d0f0f.js → CreateProject-33102f1d.js} +1 -1
- package/frontend/build/static/{Error-6550f020.js → Error-cf795e47.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-42d2cf92.js → FeatureArchiveDialog-7c45ad83.js} +4 -4
- package/frontend/build/static/{FeatureMetricsChart-70a6747e.js → FeatureMetricsChart-098be7ad.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-60874e5e.js → FeatureViewLazyExport-c74a2e4d.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-c5eec10c.js → LazyAdminExport-c83e066d.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-7f66ff80.js → LazyProjectExport-0e097671.js} +1 -1
- package/frontend/build/static/{NetworkOverview-b82ebe0c.js → NetworkOverview-d29a2982.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-51a825ea.js → NetworkTraffic-75dedea1.js} +1 -1
- package/frontend/build/static/{Playground-2b482aeb.js → Playground-2547cabf.js} +1 -1
- package/frontend/build/static/{PlaygroundGuidancePopper-5673aca8.js → PlaygroundGuidancePopper-de0c6f7c.js} +1 -1
- package/frontend/build/static/RoleCell-86b02c95.js +1 -0
- package/frontend/build/static/{StrategyItemContainer-7b356e23.js → StrategyItemContainer-cada0ab5.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-04fda623.js → chartjs-adapter-date-fns.esm-d78073b7.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-68f1625d.js → flowchart-elk-definition-170a3958-3edd9f6d.js} +1 -1
- package/frontend/build/static/{index-b74e9af8.js → index-1023a005.js} +1 -1
- package/frontend/build/static/{index-545ad556.js → index-4f1029d3.js} +1 -1
- package/frontend/build/static/{index-78d048a4.js → index-6d9a536e.js} +2 -2
- package/frontend/build/static/{is_dark-77b9ee14.js → is_dark-4cf688db.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-4cca63a5.js → mindmap-definition-44684416-d564c247.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-31dad151.js → timeline-definition-8e5a9bc6-d80977bf.js} +1 -1
- package/frontend/build/static/{unknownify-53fb2d5d.js → unknownify-e541f268.js} +1 -1
- package/package.json +1 -1
- package/frontend/build/static/RoleCell-c9b26e7a.js +0 -1
package/frontend/build/static/{LazyProjectExport-7f66ff80.js → LazyProjectExport-0e097671.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as le,j as n,cH as e0,cJ as t0,t as h,cu as n0,cr as Xe,K as it,r as d,ef as a0,U as s1,f as t1,h as l,M as st,N as ct,O as lt,Q as dt,c2 as r0,bb as G1,A as w1,aR as de,aS as K1,aT as J1,eg as $3,aI as K,eh as R1,bW as S1,m as u1,cl as x1,au as ut,a6 as b1,ei as o0,H as Ae,cU as i2,ej as z3,ek as E1,o as o1,S as k1,P as l1,C as x,aO as D1,k as ue,i as C1,cp as i0,c as pt,el as s0,be as ke,bf as De,bg as Re,B as T,b4 as Y1,I as L1,bl as c0,x as ht,dA as mt,em as ae,cv as s2,ah as N1,en as It,b8 as re,e5 as l0,ba as oe,T as Z,cx as B3,aN as gt,v as q1,ao as V3,cc as c2,b as p1,d as y1,eo as d0,F as Y,ep as M3,z as Z1,ai as d1,eq as u0,bz as p0,n as m1,bQ as h0,y as l2,cf as ft,bR as L3,aZ as Fe,b2 as Pe,a_ as Ze,er as H3,dy as W3,bH as m0,as as I1,u as d2,es as g0,cs as f0,et as v0,eu as y0,ev as b0,ew as N3,ex as q3,L as U3,ey as C0,d2 as vt,e as yt,d3 as _0,cq as x0,bU as G3,V as bt,ez as w0,a3 as S0,aQ as T0,cm as A0,a as K3,eA as E0,p as j1,eB as J3,ap as Y3,eC as Q3,aq as k0,eD as D0,eE as R0,aU as X3,eF as u2,ac as F0,eG as en,eH as P0,eI as Z0,eJ as I0,eK as j0,bM as tn,eL as nn,eM as an,s as Ie,g as Ct,eN as O0,eO as $0,aK as z0,bu as B0,eP as _t,eQ as V0,eR as rn,eS as M0,aB as pe,aC as Q1,aL as O1,aD as he,aG as me,aH as ge,eT as L0,ci as Te,bT as on,eU as sn,eV as H0,bt as X1,ar as cn,bv as p2,eW as W0,eX as N0,eY as q0,eZ as U0,e_ as G0,e$ as K0,f0 as J0,dH as Y0,ch as Q0,du as et,f1 as X0,cz as h2,f2 as xt,bZ as U1,aM as V1,aP as wt,c0 as m2,dg as g2,am as ln,al as f2,dl as ea,aA as M1,av as dn,f3 as ta,f4 as na,dd as We,f5 as aa,f6 as ra,de as oa,df as ia,f7 as sa,f8 as ca,f9 as la,bX as fe,bY as X,fa as da,fb as O2,fc as un,a8 as v2,ax as ua,fd as pa,cX as ha,fe as $2,ff as ma,fg as ga,fh as fa,fi as va,fj as ya,br as ba,bs as Ca,bE as _a,bF as xa,bG as wa,a0 as Sa,fk as Ta,ct as pn,fl as Aa,da as hn,fm as ie,fn as J,fo as Ea,fp as ka,fq as Da,fr as Ra,fs as Fa,dp as Pa,ft as Za,fu as Ia,fv as ja,fw as Oa}from"./index-78d048a4.js";import{e as mn,W as z2,b as $a,u as gn,T as za,c as Ba,h as Va,F as Ma,V as La,a as Ha,g as Wa,C as Na,U as qa,E as Ua,i as Ga}from"./FeatureArchiveDialog-42d2cf92.js";import{a as Ka}from"./index-545ad556.js";import{m as Ja,h as Ya,b as Qa,c as Xa,d as er,e as tr,E as nr,f as ar,u as rr,a as or,R as ir,C as sr,A as cr,B as fn}from"./RoleCell-c9b26e7a.js";import{S as lr}from"./StrategyItemContainer-7b356e23.js";import{E as dr}from"./Error-6550f020.js";const ur=le(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),pr=le(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),hr=le(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),mr=le(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),gr=le(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),fr=le(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function vr(e,t){e0(2,arguments);var a=t0(t);return Ka(e,-a)}const B2=h("div")(()=>({display:"flex"})),yr=h("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));h("div")(()=>({display:"flex",flexDirection:"column"}));const br=h("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Cr=h("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));h(Cr)(({theme:e})=>({color:e.palette.neutral.dark}));const _r=h(n0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),xr=h("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),wr=h("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Sr=h("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),Tr=h("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Ar=h("div")(({theme:e})=>({padding:e.spacing(0,4)})),Er=h(Xe)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),kr=e=>e.reduce((t,a)=>a.enabled?t+1:t,0),Dr=h(it)(({theme:e})=>({marginTop:e.spacing(3)})),Rr=h("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),Fr=({environment:e,warnEnabledToggles:t})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:u}})=>n(a0,{environment:u})},{Header:"Name",accessor:"name",Cell:s1},{Header:"Type",accessor:"type",Cell:s1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:u})=>n(s1,{children:n(Rr,{warning:u>0,children:u===1?"1 toggle":`${u} toggles`})}),align:"center"}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:c}=t1.useTable({columns:a,data:[e],disableSortBy:!0});return l(Dr,{...r(),rowHeight:"compact",children:[n(st,{headerGroups:i}),n(ct,{...o(),children:s.map(u=>(c(u),n(lt,{hover:!0,...u.getRowProps(),children:u.cells.map(p=>n(dt,{...p.getCellProps(),children:p.render("Cell")}))})))})]})},Pr=h("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),Zr=h(r0)(()=>({width:"100%"})),Ir=({environment:e,open:t,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[t]),l(G1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[l(w1,{severity:"error",children:[n("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),n(Fr,{environment:e}),l(Pr,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",n("strong",{children:e==null?void 0:e.name})]}),n(Zr,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},jr=e=>{const{data:t,error:a,mutate:r}=de(K1(`api/admin/environments/project/${e}`),Or),o=d.useMemo(()=>t||[],[t]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!t,error:a}},Or=async e=>(await fetch(e).then(J1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),$r=h(w1)(({theme:e})=>({marginBottom:e.spacing(4)})),zr=h("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),Br=h($3)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),vn=()=>{const e=K("projectId"),t=R1(e);S1(`Project environments – ${t}`);const{setToastData:a,setToastApiError:r}=u1(),{environments:o,loading:i,error:s,refetchEnvironments:c}=jr(e),{project:u,refetch:p}=x1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:g}=ut(),[y,_]=d.useState(),[C,b]=d.useState(!1),{isOss:R}=b1(),f=d.useMemo(()=>o.map(P=>({...P,projectVisible:u==null?void 0:u.environments.map(W=>W.environment).includes(P.name)})),[o,u==null?void 0:u.environments]),F=()=>{c(),p()},E=()=>n(Br,{onClick:F,text:"Error fetching environments"}),O=P=>`Got an API error when trying to set the environment as ${P?"visible":"hidden"}`,M=async P=>{if(P.projectVisible){if(kr(f)>1){_(P),b(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await g(e,P.name),F(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(O(!0))}},S=async()=>{if(y)try{await m(e,y.name),F(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(O(!1))}finally{b(!1)}},I=P=>R()&&P==="default",j=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:P}})=>n(o0,{environment:P})},{Header:"Type",accessor:"type",Cell:Ae},{Header:"Project API tokens",accessor:P=>P.projectApiTokenCount===1?"1 token":`${P.projectApiTokenCount} tokens`,Cell:s1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:P}})=>n(i2,{children:n(z3,{tooltip:P.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:I(P.name),projectId:e,permission:E1,checked:P.projectVisible,onChange:()=>M(P)})}),disableGlobalFilter:!0}],[f]),{getTableProps:V,getTableBodyProps:H,headerGroups:B,rows:Q,prepareRow:U,state:{globalFilter:v},setGlobalFilter:w}=t1.useTable({columns:j,data:f,disableSortBy:!0},t1.useGlobalFilter),$=n(o1,{title:`Environments (${Q.length})`,actions:n(k1,{initialValue:v,onChange:w})});return n(l1,{header:$,isLoading:i,children:l(zr,{children:[n(x,{condition:!!s,show:E()}),l($r,{severity:"info",children:[n("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",n(D1,{to:"/admin/api",children:"API tokens here"}),".",n("br",{}),n("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",n(D1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(ue,{value:v,children:l(it,{...V(),rowHeight:"compact",children:[n(st,{headerGroups:B}),n(ct,{...H(),children:Q.map(P=>(U(P),n(lt,{hover:!0,...P.getRowProps(),children:P.cells.map(W=>n(dt,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),n(x,{condition:Q.length===0,show:n(x,{condition:(v==null?void 0:v.length)>0,show:l(C1,{children:["No environments found matching “",v,"”"]}),elseShow:n(C1,{children:"No environments available. Get started by adding one."})})}),n(Ir,{environment:y,open:C,setOpen:b,onConfirm:S})]})})},Vr={id:"archivedAt"},Mr=({projectId:e})=>{const{archivedFeatures:t,loading:a,refetchArchived:r}=i0(e),{value:o,setValue:i}=pt(`${e}:ProjectFeaturesArchiveTable`,Vr);return n(s0,{title:"Project archive",archivedFeatures:t||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},Lr=()=>{const e=K("projectId"),t=R1(e);return S1(`Project archive – ${t}`),n(Mr,{projectId:e})},Hr=(e=[])=>{var r;let t=e.map(o=>o.environment);const a=d.useRef(t);return t.join("")!==((r=a.current)==null?void 0:r.join(""))&&(a.current=t),a.current};var y2={},Wr=De;Object.defineProperty(y2,"__esModule",{value:!0});var yn=y2.default=void 0,Nr=Wr(ke()),qr=Re,Ur=(0,Nr.default)((0,qr.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");yn=y2.default=Ur;var b2={},Gr=De;Object.defineProperty(b2,"__esModule",{value:!0});var bn=b2.default=void 0,Kr=Gr(ke()),Jr=Re,Yr=(0,Kr.default)((0,Jr.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");bn=b2.default=Yr;const Qr=h(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),Xr=({projectId:e,row:t,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:s,stale:c}}=t,u=!!o,p=_=>{i(_.currentTarget)},m=()=>{i(null)},g=`feature-${s}-actions`,y=`${g}-menu`;return l(Qr,{children:[n(Y1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(L1,{id:g,"aria-controls":u?y:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:p,type:"button",children:n(c0,{})})}),n(ht,{id:y,anchorEl:o,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:l(mt,{"aria-labelledby":g,children:[n(ae,{projectId:e,permission:s2,children:({hasAccess:_})=>l(N1,{sx:It,onClick:m,disabled:!_,component:D1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(re,{children:n(l0,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Copy"})})]})}),n(ae,{projectId:e,permission:B3,children:({hasAccess:_})=>l(N1,{sx:It,onClick:()=>{a(s),m()},disabled:!_,children:[n(re,{children:n(yn,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Archive"})})]})}),n(ae,{projectId:e,permission:gt,children:({hasAccess:_})=>l(N1,{sx:It,onClick:()=>{m(),r({featureId:s,stale:c===!0})},disabled:!_,children:[n(re,{children:n(bn,{})}),n(oe,{children:l(Z,{variant:"body2",children:[c?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var C2={},eo=De;Object.defineProperty(C2,"__esModule",{value:!0});var Cn=C2.default=void 0,to=eo(ke()),no=Re,ao=(0,to.default)((0,no.jsx)("path",{d:"M5.33 20H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h1.33c1.1 0 2 .9 2 2v12c0 1.1-.89 2-2 2zM22 18V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2H20c1.11 0 2-.9 2-2zm-7.33 0V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h1.33c1.1 0 2-.9 2-2z"}),"ViewWeek");Cn=C2.default=ao;const ro=h(T)(()=>({...q1,justifyContent:"center"})),oo=h(L1)(({theme:e})=>({margin:e.spacing(-1,0)})),io=h(T)(({theme:e})=>({...q1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),so=h(N1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),V2=h(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),co=h(c2)(({theme:e})=>({padding:e.spacing(.75,1)})),lo={favorite:"Favorite"},uo=({allColumns:e,staticColumns:t=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[s,c]=d.useState(null),u=p1(),p=y1(u.breakpoints.down("sm")),m=y1(u.breakpoints.down("md")),g=y1(u.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const f=(F,E=0)=>{const O=e.filter(({id:S})=>S.startsWith("environments.")!==!1).map(({id:S})=>S).slice(0,E),M=e.map(({id:S})=>S).filter(S=>!F.includes(S)).filter(S=>!t.includes(S)).filter(S=>!O.includes(S));i(M)};if(p)return f(["createdAt"]);if(m)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[p,m,g]);const y=f=>{c(f.currentTarget)},_=()=>{c(null)},C=!!s,b="columns-menu",R=`columns-menu-list-${b}`;return l(ro,{children:[n(Y1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(oo,{id:b,"aria-controls":C?R:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:y,type:"button",size:"large","data-loading":!0,children:n(Cn,{})})}),l(ht,{id:R,open:C,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:f.shape.borderRadius,paddingBottom:f.spacing(2)})},children:[l(io,{children:[n(Z,{variant:"body2",children:n("strong",{children:"Columns"})}),n(L1,{onClick:_,children:n(d0,{})})]}),n(mt,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(x,{condition:a.includes(f.id),show:n(V2,{})}),l(so,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(re,{children:n(co,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(oe,{id:f.id,primary:n(Z,{variant:"body2",children:n(x,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Y,{children:f.Header}),elseShow:()=>lo[f.id]||f.id})})})]}),n(x,{condition:r.includes(f.id),show:n(V2,{})})])})]})]})},po=M3()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),ho=({projectId:e,features:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(!1),{trackEvent:i}=Z1();return l(Y,{children:[n(ae,{projectId:e,permission:B3,children:({hasAccess:c})=>n(d1,{disabled:!c||r,variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),n(mn,{projectId:e,featureIds:t,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},Ne="selection-actions-menu",mo=({projectId:e,data:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(null),{staleFeatures:i}=ut(),{setToastData:s,setToastApiError:c}=u1(),{trackEvent:u}=Z1(),p=!!r,m=t.map(({name:f})=>f),g=f=>{o(f.currentTarget)},y=()=>{o(null)},_=t.some(({stale:f})=>f===!0),C=t.some(({stale:f})=>f===!1),b=async()=>{try{y(),await i(e,m),await a(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features staled"}})}catch(f){c(m1(f))}},R=async()=>{try{y(),await i(e,m,!1),await a(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){c(m1(f))}};return l(Y,{children:[n(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(L1,{id:Ne,"aria-controls":p?Ne:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:g,type:"button","data-testid":u0,children:n(p0,{})})}),n(ht,{id:`${Ne}-menu`,anchorEl:r,open:p,onClose:y,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:n(mt,{"aria-labelledby":`${Ne}-menu`,children:n(ae,{projectId:e,permission:gt,children:({hasAccess:f})=>l(Y,{children:[n(x,{condition:C,show:()=>l(N1,{onClick:b,disabled:!f,sx:{borderRadius:F=>`${F.shape.borderRadius}px`},children:[n(re,{children:n(z2,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Mark as stale"})})]})}),n(x,{condition:_,show:()=>l(N1,{onClick:R,disabled:!f,sx:{borderRadius:F=>`${F.shape.borderRadius}px`},children:[n(re,{children:n(z2,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},go=h("section")(({theme:e})=>({["& > *"]:{margin:e.spacing(1,0)}})),M2="manage-tags-form",L2=(e,t)=>[...e,...e.some(a=>a.value===t.value&&a.type===t.type)?[]:[t]],H2=(e,t)=>e.filter(a=>!(a.value===t.value&&a.type===t.type)),fo=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:L2(e.addedTags,t.payload),removedTags:H2(e.removedTags,t.payload)};case"remove":return{...e,addedTags:H2(e.addedTags,t.payload),removedTags:L2(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},W2={name:"",description:"",icon:""},vo=({open:e,initialValues:t,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:s}=h0(),[c,u]=d.useState(W2),[p,m]=d.useState([]),[g,y]=d.useState([]),{tags:_,refetch:C}=$a(c.name),{createTag:b}=gn(),R=_.map(({value:j})=>({title:j})),[f,F]=d.useReducer(fo,{addedTags:[],removedTags:[]}),E=(j=i.length>0?i[0]:W2)=>{u(j);const V=a.filter(({type:H})=>H===j.name);m(t.filter(({type:H})=>H===j.name).filter(({type:H,value:B})=>!V.some(Q=>Q.value===B&&Q.type===H)).map(({value:H})=>({title:H}))),y(V.map(({value:H})=>({title:H}))),F({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&E()},[s]);const O=(j,V)=>{V!=null&&typeof V!="string"&&(j.preventDefault(),E(V))},M=(j,V)=>b({value:j,type:V}).then(async()=>{await C(),m(H=>[...H,{title:j}]),F({type:"add",payload:{value:j,type:V}})}),S=(j,V,H,B)=>{H==="selectOption"?V.forEach(Q=>{if(typeof Q!="string"&&typeof Q.inputValue=="string"&&Q.inputValue&&Q.title.startsWith("Create new value"))return M(Q.inputValue,c.name);m(V),y(U=>U.filter(({title:v})=>v!==Q.title)),B!=null&&B.option&&F({type:"add",payload:{value:B.option.title,type:c.name}})}):H==="clear"?(m([]),F({type:"clear",payload:t})):H==="removeOption"&&(m(V),B!=null&&B.option&&F({type:"remove",payload:{value:B.option.title,type:c.name}}))},I=()=>{E(),r()};return l(G1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:I,formId:M2,children:[n(Z,{paragraph:!0,sx:{marginBottom:j=>j.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:M2,onSubmit:()=>o(f),children:l(go,{children:[n(za,{options:i,disabled:s||i.length===0,value:c,onChange:O},s?"loading":i.length),n(x,{condition:!s&&i.length===0,show:l(Z,{variant:"body1",children:["No"," ",n(l2,{component:D1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Ba,{disabled:s,options:R,existingTags:t,indeterminateOptions:g,tagType:c,selectedOptions:p,onChange:S})})]})})]})},yo=({projectId:e,data:t})=>{const{bulkUpdateTags:a}=gn(),{refetch:r}=x1(e),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:s}=Z1(),[c,u]=d.useState(!1),[p,m]=d.useMemo(()=>{const y=t.flatMap(({tags:C})=>C||[]).reduce((C,b)=>[...C,...C.some(R=>R.type===b.type&&R.value===b.value)?[]:[b]],[]),_=y.filter(C=>!t.every(({tags:b})=>b==null?void 0:b.some(R=>R.type===C.type&&R.value===C.value)));return[y,_]},[t]);return l(Y,{children:[n(ae,{projectId:e,permission:gt,children:({hasAccess:y})=>n(d1,{disabled:!y||c,variant:"outlined",size:"small",onClick:()=>u(!0),children:"Tags"})}),n(vo,{open:c,onCancel:()=>u(!1),onSubmit:async({addedTags:y,removedTags:_})=>{const C=t.map(({name:R})=>R),b={features:C,tags:{addedTags:y,removedTags:_}};try{await a(b),r();const R=y.length?`Added tags: ${y.map(({type:F,value:E})=>`${F}:${E}`).join(", ")}.`:"",f=_.length?`Removed tags: ${_.map(({type:F,value:E})=>`${F}:${E}`).join(", ")}.`:"";o({title:"Tags updated",text:`${C.length} feature toggles updated. ${R} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(R){i(m1(R))}u(!1)},initialValues:p,initialIndeterminateValues:m},t.length)]})},bo=h(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),N2=h(w1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Co=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOff:u}=L3(),{addChange:p}=Fe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=u1(),{isChangeRequestConfigured:_}=Pe(i),{refetch:C}=Ze(i),b=t.filter(E=>{var O,M;return((M=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:M.enabled)===!1}).length,R=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await p(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!1}}))),C(),y({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),a(),r==null||r()}catch(E){g(m1(E))}},F=_(s)?"Add to change request":"Disable toggles";return n(G1,{open:e,title:"Disable feature toggles",onClose:a,onClick:f,primaryButtonText:F,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(Z,{children:"Select which environment to disable the features for:"}),n(bo,{options:R(),value:s,onChange:E=>c(E)}),n(x,{condition:_(s),show:n(N2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(x,{condition:b>0,show:l(N2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},_o=h(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),q2=h(w1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),xo=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOn:u}=L3(),{addChange:p}=Fe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=u1(),{isChangeRequestConfigured:_}=Pe(i),{refetch:C}=Ze(i),b=t.filter(E=>{var O,M;return((M=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:M.enabled)===!0}).length,R=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await p(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!0}}))),C(),y({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),a(),r==null||r()}catch(E){g(m1(E))}},F=_(s)?"Add to change request":"Enable toggles";return n(G1,{open:e,title:"Enable feature toggles",onClose:a,onClick:f,primaryButtonText:F,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(Z,{children:"Select which environment to enable the features for:"}),n(_o,{options:R(),value:s,onChange:E=>c(E)}),n(x,{condition:_(s),show:n(q2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(x,{condition:b>0,show:l(q2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},wo=({selectedIds:e,data:t,projectId:a})=>{var R,f;const{uiConfig:r}=b1(),[o,i]=d.useState(!1),[s,c]=d.useState(!1),[u,p]=d.useState(!1),{trackEvent:m}=Z1(),g=d.useMemo(()=>t.filter(F=>e.includes(F.name)),[t,e]),y=d.useMemo(()=>{const F=g.flatMap(E=>E.environments).map(E=>E==null?void 0:E.name).filter(E=>E!==void 0);return Array.from(new Set(F))},[g]),_=()=>{m("batch_operations",{props:{eventType:"features exported"}})},C=()=>{m("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{m("batch_operations",{props:{eventType:"features disabled"}})};return l(Y,{children:[n(x,{condition:!!((R=r==null?void 0:r.flags)!=null&&R.disableBulkToggle),show:null,elseShow:n(d1,{variant:"outlined",size:"small",onClick:()=>c(!0),children:"Enable"})}),n(x,{condition:!!((f=r==null?void 0:r.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(d1,{variant:"outlined",size:"small",onClick:()=>p(!0),children:"Disable"})}),n(ho,{projectId:a,features:e}),n(d1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(yo,{projectId:a,data:g}),n(mo,{projectId:a,data:g}),n(H3,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:y,onConfirm:_}),n(xo,{showExportDialog:s,data:g,onClose:()=>c(!1),environments:y,projectId:a,onConfirm:C}),n(Co,{showExportDialog:u,data:g,onClose:()=>p(!1),environments:y,projectId:a,onConfirm:b})]})},So=h(W3)(()=>({whiteSpace:"nowrap"})),To=h("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...q1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),qe=["Select","Actions","name","favorite"],Ao={id:"createdAt"},Eo=({features:e,loading:t,environments:a=[]})=>{var P1,te;const{classes:r}=po(),o=p1(),i=y1(o.breakpoints.down("md")),[s,c]=d.useState({open:!1,featureId:"",environmentName:""}),[u,p]=d.useState({}),[m,g]=d.useState(),y=K("projectId"),{value:_,setValue:C}=pt(`${y}:FeatureToggleListTable:v1`,Ao),{value:b,setValue:R}=m0(),f=I1(),[F,E]=d2(),O=Hr(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:a),{refetch:M}=x1(y),{isFavoritesPinned:S,sortTypes:I,onChangeIsFavoritePinned:j}=g0(F.has("favorites")?F.get("favorites")==="true":b.favorites),{favorite:V,unfavorite:H}=f0(),{onChangeRequestToggleClose:B,onChangeRequestToggleConfirm:Q,changeRequestDialogDetails:U}=Va(y),[v,w]=d.useState(!1),{uiConfig:$}=b1(),P=d.useCallback(async D=>{D!=null&&D.favorite?await H(y,D.name):await V(y,D.name),M()},[y,M]),W=d.useMemo(()=>e.some(D=>{var L;return(L=D==null?void 0:D.tags)==null?void 0:L.length}),[e]),k=d.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:D})=>n(c2,{...D()}),Cell:({row:D})=>{var L;return n(v0,{...(L=D==null?void 0:D.getToggleRowSelectedProps)==null?void 0:L.call(D)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(y0,{isActive:S,onClick:j}),accessor:"favorite",Cell:({row:{original:D}})=>n(b0,{value:D==null?void 0:D.favorite,onClick:()=>P(D)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:N3,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:q3,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:D})=>n(U3,{title:D,to:`/projects/${y}/features/${D}`}),minWidth:100,sortType:"alphanumeric",searchable:!0},...W?[{id:"tags",Header:"Tags",accessor:D=>{var L;return((L=D.tags)==null?void 0:L.map(({type:a1,value:q})=>`${a1}:${q}`).join(`
|
|
1
|
+
import{E as le,j as n,cH as e0,cJ as t0,t as h,cu as n0,cr as Xe,K as it,r as d,ef as a0,U as s1,f as t1,h as l,M as st,N as ct,O as lt,Q as dt,c2 as r0,bb as G1,A as w1,aR as de,aS as K1,aT as J1,eg as $3,aI as K,eh as R1,bW as S1,m as u1,cl as x1,au as ut,a6 as b1,ei as o0,H as Ae,cU as i2,ej as z3,ek as E1,o as o1,S as k1,P as l1,C as x,aO as D1,k as ue,i as C1,cp as i0,c as pt,el as s0,be as ke,bf as De,bg as Re,B as T,b4 as Y1,I as L1,bl as c0,x as ht,dA as mt,em as ae,cv as s2,ah as N1,en as It,b8 as re,e5 as l0,ba as oe,T as Z,cx as B3,aN as gt,v as q1,ao as V3,cc as c2,b as p1,d as y1,eo as d0,F as Y,ep as M3,z as Z1,ai as d1,eq as u0,bz as p0,n as m1,bQ as h0,y as l2,cf as ft,bR as L3,aZ as Fe,b2 as Pe,a_ as Ze,er as H3,dy as W3,bH as m0,as as I1,u as d2,es as g0,cs as f0,et as v0,eu as y0,ev as b0,ew as N3,ex as q3,L as U3,ey as C0,d2 as vt,e as yt,d3 as _0,cq as x0,bU as G3,V as bt,ez as w0,a3 as S0,aQ as T0,cm as A0,a as K3,eA as E0,p as j1,eB as J3,ap as Y3,eC as Q3,aq as k0,eD as D0,eE as R0,aU as X3,eF as u2,ac as F0,eG as en,eH as P0,eI as Z0,eJ as I0,eK as j0,bM as tn,eL as nn,eM as an,s as Ie,g as Ct,eN as O0,eO as $0,aK as z0,bu as B0,eP as _t,eQ as V0,eR as rn,eS as M0,aB as pe,aC as Q1,aL as O1,aD as he,aG as me,aH as ge,eT as L0,ci as Te,bT as on,eU as sn,eV as H0,bt as X1,ar as cn,bv as p2,eW as W0,eX as N0,eY as q0,eZ as U0,e_ as G0,e$ as K0,f0 as J0,dH as Y0,ch as Q0,du as et,f1 as X0,cz as h2,f2 as xt,bZ as U1,aM as V1,aP as wt,c0 as m2,dg as g2,am as ln,al as f2,dl as ea,aA as M1,av as dn,f3 as ta,f4 as na,dd as We,f5 as aa,f6 as ra,de as oa,df as ia,f7 as sa,f8 as ca,f9 as la,bX as fe,bY as X,fa as da,fb as O2,fc as un,a8 as v2,ax as ua,fd as pa,cX as ha,fe as $2,ff as ma,fg as ga,fh as fa,fi as va,fj as ya,br as ba,bs as Ca,bE as _a,bF as xa,bG as wa,a0 as Sa,fk as Ta,ct as pn,fl as Aa,da as hn,fm as ie,fn as J,fo as Ea,fp as ka,fq as Da,fr as Ra,fs as Fa,dp as Pa,ft as Za,fu as Ia,fv as ja,fw as Oa}from"./index-6d9a536e.js";import{e as mn,W as z2,b as $a,u as gn,T as za,c as Ba,h as Va,F as Ma,V as La,a as Ha,g as Wa,C as Na,U as qa,E as Ua,i as Ga}from"./FeatureArchiveDialog-7c45ad83.js";import{a as Ka}from"./index-4f1029d3.js";import{m as Ja,h as Ya,b as Qa,c as Xa,d as er,e as tr,E as nr,f as ar,u as rr,a as or,R as ir,C as sr,A as cr,B as fn}from"./RoleCell-86b02c95.js";import{S as lr}from"./StrategyItemContainer-cada0ab5.js";import{E as dr}from"./Error-cf795e47.js";const ur=le(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),pr=le(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),hr=le(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),mr=le(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),gr=le(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),fr=le(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function vr(e,t){e0(2,arguments);var a=t0(t);return Ka(e,-a)}const B2=h("div")(()=>({display:"flex"})),yr=h("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));h("div")(()=>({display:"flex",flexDirection:"column"}));const br=h("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Cr=h("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));h(Cr)(({theme:e})=>({color:e.palette.neutral.dark}));const _r=h(n0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),xr=h("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),wr=h("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Sr=h("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),Tr=h("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Ar=h("div")(({theme:e})=>({padding:e.spacing(0,4)})),Er=h(Xe)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),kr=e=>e.reduce((t,a)=>a.enabled?t+1:t,0),Dr=h(it)(({theme:e})=>({marginTop:e.spacing(3)})),Rr=h("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),Fr=({environment:e,warnEnabledToggles:t})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:u}})=>n(a0,{environment:u})},{Header:"Name",accessor:"name",Cell:s1},{Header:"Type",accessor:"type",Cell:s1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:u})=>n(s1,{children:n(Rr,{warning:u>0,children:u===1?"1 toggle":`${u} toggles`})}),align:"center"}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:c}=t1.useTable({columns:a,data:[e],disableSortBy:!0});return l(Dr,{...r(),rowHeight:"compact",children:[n(st,{headerGroups:i}),n(ct,{...o(),children:s.map(u=>(c(u),n(lt,{hover:!0,...u.getRowProps(),children:u.cells.map(p=>n(dt,{...p.getCellProps(),children:p.render("Cell")}))})))})]})},Pr=h("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),Zr=h(r0)(()=>({width:"100%"})),Ir=({environment:e,open:t,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[t]),l(G1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[l(w1,{severity:"error",children:[n("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),n(Fr,{environment:e}),l(Pr,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",n("strong",{children:e==null?void 0:e.name})]}),n(Zr,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},jr=e=>{const{data:t,error:a,mutate:r}=de(K1(`api/admin/environments/project/${e}`),Or),o=d.useMemo(()=>t||[],[t]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!t,error:a}},Or=async e=>(await fetch(e).then(J1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),$r=h(w1)(({theme:e})=>({marginBottom:e.spacing(4)})),zr=h("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),Br=h($3)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),vn=()=>{const e=K("projectId"),t=R1(e);S1(`Project environments – ${t}`);const{setToastData:a,setToastApiError:r}=u1(),{environments:o,loading:i,error:s,refetchEnvironments:c}=jr(e),{project:u,refetch:p}=x1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:g}=ut(),[y,_]=d.useState(),[C,b]=d.useState(!1),{isOss:R}=b1(),f=d.useMemo(()=>o.map(P=>({...P,projectVisible:u==null?void 0:u.environments.map(W=>W.environment).includes(P.name)})),[o,u==null?void 0:u.environments]),F=()=>{c(),p()},E=()=>n(Br,{onClick:F,text:"Error fetching environments"}),O=P=>`Got an API error when trying to set the environment as ${P?"visible":"hidden"}`,M=async P=>{if(P.projectVisible){if(kr(f)>1){_(P),b(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await g(e,P.name),F(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(O(!0))}},S=async()=>{if(y)try{await m(e,y.name),F(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(O(!1))}finally{b(!1)}},I=P=>R()&&P==="default",j=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:P}})=>n(o0,{environment:P})},{Header:"Type",accessor:"type",Cell:Ae},{Header:"Project API tokens",accessor:P=>P.projectApiTokenCount===1?"1 token":`${P.projectApiTokenCount} tokens`,Cell:s1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:P}})=>n(i2,{children:n(z3,{tooltip:P.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:I(P.name),projectId:e,permission:E1,checked:P.projectVisible,onChange:()=>M(P)})}),disableGlobalFilter:!0}],[f]),{getTableProps:V,getTableBodyProps:H,headerGroups:B,rows:Q,prepareRow:U,state:{globalFilter:v},setGlobalFilter:w}=t1.useTable({columns:j,data:f,disableSortBy:!0},t1.useGlobalFilter),$=n(o1,{title:`Environments (${Q.length})`,actions:n(k1,{initialValue:v,onChange:w})});return n(l1,{header:$,isLoading:i,children:l(zr,{children:[n(x,{condition:!!s,show:E()}),l($r,{severity:"info",children:[n("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",n(D1,{to:"/admin/api",children:"API tokens here"}),".",n("br",{}),n("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",n(D1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(ue,{value:v,children:l(it,{...V(),rowHeight:"compact",children:[n(st,{headerGroups:B}),n(ct,{...H(),children:Q.map(P=>(U(P),n(lt,{hover:!0,...P.getRowProps(),children:P.cells.map(W=>n(dt,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),n(x,{condition:Q.length===0,show:n(x,{condition:(v==null?void 0:v.length)>0,show:l(C1,{children:["No environments found matching “",v,"”"]}),elseShow:n(C1,{children:"No environments available. Get started by adding one."})})}),n(Ir,{environment:y,open:C,setOpen:b,onConfirm:S})]})})},Vr={id:"archivedAt"},Mr=({projectId:e})=>{const{archivedFeatures:t,loading:a,refetchArchived:r}=i0(e),{value:o,setValue:i}=pt(`${e}:ProjectFeaturesArchiveTable`,Vr);return n(s0,{title:"Project archive",archivedFeatures:t||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},Lr=()=>{const e=K("projectId"),t=R1(e);return S1(`Project archive – ${t}`),n(Mr,{projectId:e})},Hr=(e=[])=>{var r;let t=e.map(o=>o.environment);const a=d.useRef(t);return t.join("")!==((r=a.current)==null?void 0:r.join(""))&&(a.current=t),a.current};var y2={},Wr=De;Object.defineProperty(y2,"__esModule",{value:!0});var yn=y2.default=void 0,Nr=Wr(ke()),qr=Re,Ur=(0,Nr.default)((0,qr.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");yn=y2.default=Ur;var b2={},Gr=De;Object.defineProperty(b2,"__esModule",{value:!0});var bn=b2.default=void 0,Kr=Gr(ke()),Jr=Re,Yr=(0,Kr.default)((0,Jr.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");bn=b2.default=Yr;const Qr=h(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),Xr=({projectId:e,row:t,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:s,stale:c}}=t,u=!!o,p=_=>{i(_.currentTarget)},m=()=>{i(null)},g=`feature-${s}-actions`,y=`${g}-menu`;return l(Qr,{children:[n(Y1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(L1,{id:g,"aria-controls":u?y:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:p,type:"button",children:n(c0,{})})}),n(ht,{id:y,anchorEl:o,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:l(mt,{"aria-labelledby":g,children:[n(ae,{projectId:e,permission:s2,children:({hasAccess:_})=>l(N1,{sx:It,onClick:m,disabled:!_,component:D1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(re,{children:n(l0,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Copy"})})]})}),n(ae,{projectId:e,permission:B3,children:({hasAccess:_})=>l(N1,{sx:It,onClick:()=>{a(s),m()},disabled:!_,children:[n(re,{children:n(yn,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Archive"})})]})}),n(ae,{projectId:e,permission:gt,children:({hasAccess:_})=>l(N1,{sx:It,onClick:()=>{m(),r({featureId:s,stale:c===!0})},disabled:!_,children:[n(re,{children:n(bn,{})}),n(oe,{children:l(Z,{variant:"body2",children:[c?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var C2={},eo=De;Object.defineProperty(C2,"__esModule",{value:!0});var Cn=C2.default=void 0,to=eo(ke()),no=Re,ao=(0,to.default)((0,no.jsx)("path",{d:"M5.33 20H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h1.33c1.1 0 2 .9 2 2v12c0 1.1-.89 2-2 2zM22 18V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2H20c1.11 0 2-.9 2-2zm-7.33 0V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h1.33c1.1 0 2-.9 2-2z"}),"ViewWeek");Cn=C2.default=ao;const ro=h(T)(()=>({...q1,justifyContent:"center"})),oo=h(L1)(({theme:e})=>({margin:e.spacing(-1,0)})),io=h(T)(({theme:e})=>({...q1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),so=h(N1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),V2=h(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),co=h(c2)(({theme:e})=>({padding:e.spacing(.75,1)})),lo={favorite:"Favorite"},uo=({allColumns:e,staticColumns:t=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[s,c]=d.useState(null),u=p1(),p=y1(u.breakpoints.down("sm")),m=y1(u.breakpoints.down("md")),g=y1(u.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const f=(F,E=0)=>{const O=e.filter(({id:S})=>S.startsWith("environments.")!==!1).map(({id:S})=>S).slice(0,E),M=e.map(({id:S})=>S).filter(S=>!F.includes(S)).filter(S=>!t.includes(S)).filter(S=>!O.includes(S));i(M)};if(p)return f(["createdAt"]);if(m)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[p,m,g]);const y=f=>{c(f.currentTarget)},_=()=>{c(null)},C=!!s,b="columns-menu",R=`columns-menu-list-${b}`;return l(ro,{children:[n(Y1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(oo,{id:b,"aria-controls":C?R:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:y,type:"button",size:"large","data-loading":!0,children:n(Cn,{})})}),l(ht,{id:R,open:C,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:f.shape.borderRadius,paddingBottom:f.spacing(2)})},children:[l(io,{children:[n(Z,{variant:"body2",children:n("strong",{children:"Columns"})}),n(L1,{onClick:_,children:n(d0,{})})]}),n(mt,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(x,{condition:a.includes(f.id),show:n(V2,{})}),l(so,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(re,{children:n(co,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(oe,{id:f.id,primary:n(Z,{variant:"body2",children:n(x,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Y,{children:f.Header}),elseShow:()=>lo[f.id]||f.id})})})]}),n(x,{condition:r.includes(f.id),show:n(V2,{})})])})]})]})},po=M3()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),ho=({projectId:e,features:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(!1),{trackEvent:i}=Z1();return l(Y,{children:[n(ae,{projectId:e,permission:B3,children:({hasAccess:c})=>n(d1,{disabled:!c||r,variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),n(mn,{projectId:e,featureIds:t,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},Ne="selection-actions-menu",mo=({projectId:e,data:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(null),{staleFeatures:i}=ut(),{setToastData:s,setToastApiError:c}=u1(),{trackEvent:u}=Z1(),p=!!r,m=t.map(({name:f})=>f),g=f=>{o(f.currentTarget)},y=()=>{o(null)},_=t.some(({stale:f})=>f===!0),C=t.some(({stale:f})=>f===!1),b=async()=>{try{y(),await i(e,m),await a(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features staled"}})}catch(f){c(m1(f))}},R=async()=>{try{y(),await i(e,m,!1),await a(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){c(m1(f))}};return l(Y,{children:[n(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(L1,{id:Ne,"aria-controls":p?Ne:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:g,type:"button","data-testid":u0,children:n(p0,{})})}),n(ht,{id:`${Ne}-menu`,anchorEl:r,open:p,onClose:y,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:n(mt,{"aria-labelledby":`${Ne}-menu`,children:n(ae,{projectId:e,permission:gt,children:({hasAccess:f})=>l(Y,{children:[n(x,{condition:C,show:()=>l(N1,{onClick:b,disabled:!f,sx:{borderRadius:F=>`${F.shape.borderRadius}px`},children:[n(re,{children:n(z2,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Mark as stale"})})]})}),n(x,{condition:_,show:()=>l(N1,{onClick:R,disabled:!f,sx:{borderRadius:F=>`${F.shape.borderRadius}px`},children:[n(re,{children:n(z2,{})}),n(oe,{children:n(Z,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},go=h("section")(({theme:e})=>({["& > *"]:{margin:e.spacing(1,0)}})),M2="manage-tags-form",L2=(e,t)=>[...e,...e.some(a=>a.value===t.value&&a.type===t.type)?[]:[t]],H2=(e,t)=>e.filter(a=>!(a.value===t.value&&a.type===t.type)),fo=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:L2(e.addedTags,t.payload),removedTags:H2(e.removedTags,t.payload)};case"remove":return{...e,addedTags:H2(e.addedTags,t.payload),removedTags:L2(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},W2={name:"",description:"",icon:""},vo=({open:e,initialValues:t,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:s}=h0(),[c,u]=d.useState(W2),[p,m]=d.useState([]),[g,y]=d.useState([]),{tags:_,refetch:C}=$a(c.name),{createTag:b}=gn(),R=_.map(({value:j})=>({title:j})),[f,F]=d.useReducer(fo,{addedTags:[],removedTags:[]}),E=(j=i.length>0?i[0]:W2)=>{u(j);const V=a.filter(({type:H})=>H===j.name);m(t.filter(({type:H})=>H===j.name).filter(({type:H,value:B})=>!V.some(Q=>Q.value===B&&Q.type===H)).map(({value:H})=>({title:H}))),y(V.map(({value:H})=>({title:H}))),F({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&E()},[s]);const O=(j,V)=>{V!=null&&typeof V!="string"&&(j.preventDefault(),E(V))},M=(j,V)=>b({value:j,type:V}).then(async()=>{await C(),m(H=>[...H,{title:j}]),F({type:"add",payload:{value:j,type:V}})}),S=(j,V,H,B)=>{H==="selectOption"?V.forEach(Q=>{if(typeof Q!="string"&&typeof Q.inputValue=="string"&&Q.inputValue&&Q.title.startsWith("Create new value"))return M(Q.inputValue,c.name);m(V),y(U=>U.filter(({title:v})=>v!==Q.title)),B!=null&&B.option&&F({type:"add",payload:{value:B.option.title,type:c.name}})}):H==="clear"?(m([]),F({type:"clear",payload:t})):H==="removeOption"&&(m(V),B!=null&&B.option&&F({type:"remove",payload:{value:B.option.title,type:c.name}}))},I=()=>{E(),r()};return l(G1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:I,formId:M2,children:[n(Z,{paragraph:!0,sx:{marginBottom:j=>j.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:M2,onSubmit:()=>o(f),children:l(go,{children:[n(za,{options:i,disabled:s||i.length===0,value:c,onChange:O},s?"loading":i.length),n(x,{condition:!s&&i.length===0,show:l(Z,{variant:"body1",children:["No"," ",n(l2,{component:D1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Ba,{disabled:s,options:R,existingTags:t,indeterminateOptions:g,tagType:c,selectedOptions:p,onChange:S})})]})})]})},yo=({projectId:e,data:t})=>{const{bulkUpdateTags:a}=gn(),{refetch:r}=x1(e),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:s}=Z1(),[c,u]=d.useState(!1),[p,m]=d.useMemo(()=>{const y=t.flatMap(({tags:C})=>C||[]).reduce((C,b)=>[...C,...C.some(R=>R.type===b.type&&R.value===b.value)?[]:[b]],[]),_=y.filter(C=>!t.every(({tags:b})=>b==null?void 0:b.some(R=>R.type===C.type&&R.value===C.value)));return[y,_]},[t]);return l(Y,{children:[n(ae,{projectId:e,permission:gt,children:({hasAccess:y})=>n(d1,{disabled:!y||c,variant:"outlined",size:"small",onClick:()=>u(!0),children:"Tags"})}),n(vo,{open:c,onCancel:()=>u(!1),onSubmit:async({addedTags:y,removedTags:_})=>{const C=t.map(({name:R})=>R),b={features:C,tags:{addedTags:y,removedTags:_}};try{await a(b,e),r();const R=y.length?`Added tags: ${y.map(({type:F,value:E})=>`${F}:${E}`).join(", ")}.`:"",f=_.length?`Removed tags: ${_.map(({type:F,value:E})=>`${F}:${E}`).join(", ")}.`:"";o({title:"Tags updated",text:`${C.length} feature toggles updated. ${R} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(R){i(m1(R))}u(!1)},initialValues:p,initialIndeterminateValues:m},t.length)]})},bo=h(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),N2=h(w1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Co=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOff:u}=L3(),{addChange:p}=Fe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=u1(),{isChangeRequestConfigured:_}=Pe(i),{refetch:C}=Ze(i),b=t.filter(E=>{var O,M;return((M=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:M.enabled)===!1}).length,R=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await p(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!1}}))),C(),y({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),a(),r==null||r()}catch(E){g(m1(E))}},F=_(s)?"Add to change request":"Disable toggles";return n(G1,{open:e,title:"Disable feature toggles",onClose:a,onClick:f,primaryButtonText:F,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(Z,{children:"Select which environment to disable the features for:"}),n(bo,{options:R(),value:s,onChange:E=>c(E)}),n(x,{condition:_(s),show:n(N2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(x,{condition:b>0,show:l(N2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},_o=h(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),q2=h(w1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),xo=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOn:u}=L3(),{addChange:p}=Fe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=u1(),{isChangeRequestConfigured:_}=Pe(i),{refetch:C}=Ze(i),b=t.filter(E=>{var O,M;return((M=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:M.enabled)===!0}).length,R=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await p(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!0}}))),C(),y({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),a(),r==null||r()}catch(E){g(m1(E))}},F=_(s)?"Add to change request":"Enable toggles";return n(G1,{open:e,title:"Enable feature toggles",onClose:a,onClick:f,primaryButtonText:F,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(Z,{children:"Select which environment to enable the features for:"}),n(_o,{options:R(),value:s,onChange:E=>c(E)}),n(x,{condition:_(s),show:n(q2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(x,{condition:b>0,show:l(q2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},wo=({selectedIds:e,data:t,projectId:a})=>{var R,f;const{uiConfig:r}=b1(),[o,i]=d.useState(!1),[s,c]=d.useState(!1),[u,p]=d.useState(!1),{trackEvent:m}=Z1(),g=d.useMemo(()=>t.filter(F=>e.includes(F.name)),[t,e]),y=d.useMemo(()=>{const F=g.flatMap(E=>E.environments).map(E=>E==null?void 0:E.name).filter(E=>E!==void 0);return Array.from(new Set(F))},[g]),_=()=>{m("batch_operations",{props:{eventType:"features exported"}})},C=()=>{m("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{m("batch_operations",{props:{eventType:"features disabled"}})};return l(Y,{children:[n(x,{condition:!!((R=r==null?void 0:r.flags)!=null&&R.disableBulkToggle),show:null,elseShow:n(d1,{variant:"outlined",size:"small",onClick:()=>c(!0),children:"Enable"})}),n(x,{condition:!!((f=r==null?void 0:r.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(d1,{variant:"outlined",size:"small",onClick:()=>p(!0),children:"Disable"})}),n(ho,{projectId:a,features:e}),n(d1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(yo,{projectId:a,data:g}),n(mo,{projectId:a,data:g}),n(H3,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:y,onConfirm:_}),n(xo,{showExportDialog:s,data:g,onClose:()=>c(!1),environments:y,projectId:a,onConfirm:C}),n(Co,{showExportDialog:u,data:g,onClose:()=>p(!1),environments:y,projectId:a,onConfirm:b})]})},So=h(W3)(()=>({whiteSpace:"nowrap"})),To=h("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...q1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),qe=["Select","Actions","name","favorite"],Ao={id:"createdAt"},Eo=({features:e,loading:t,environments:a=[]})=>{var P1,te;const{classes:r}=po(),o=p1(),i=y1(o.breakpoints.down("md")),[s,c]=d.useState({open:!1,featureId:"",environmentName:""}),[u,p]=d.useState({}),[m,g]=d.useState(),y=K("projectId"),{value:_,setValue:C}=pt(`${y}:FeatureToggleListTable:v1`,Ao),{value:b,setValue:R}=m0(),f=I1(),[F,E]=d2(),O=Hr(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:a),{refetch:M}=x1(y),{isFavoritesPinned:S,sortTypes:I,onChangeIsFavoritePinned:j}=g0(F.has("favorites")?F.get("favorites")==="true":b.favorites),{favorite:V,unfavorite:H}=f0(),{onChangeRequestToggleClose:B,onChangeRequestToggleConfirm:Q,changeRequestDialogDetails:U}=Va(y),[v,w]=d.useState(!1),{uiConfig:$}=b1(),P=d.useCallback(async D=>{D!=null&&D.favorite?await H(y,D.name):await V(y,D.name),M()},[y,M]),W=d.useMemo(()=>e.some(D=>{var L;return(L=D==null?void 0:D.tags)==null?void 0:L.length}),[e]),k=d.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:D})=>n(c2,{...D()}),Cell:({row:D})=>{var L;return n(v0,{...(L=D==null?void 0:D.getToggleRowSelectedProps)==null?void 0:L.call(D)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(y0,{isActive:S,onClick:j}),accessor:"favorite",Cell:({row:{original:D}})=>n(b0,{value:D==null?void 0:D.favorite,onClick:()=>P(D)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:N3,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:q3,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:D})=>n(U3,{title:D,to:`/projects/${y}/features/${D}`}),minWidth:100,sortType:"alphanumeric",searchable:!0},...W?[{id:"tags",Header:"Tags",accessor:D=>{var L;return((L=D.tags)==null?void 0:L.map(({type:a1,value:q})=>`${a1}:${q}`).join(`
|
|
2
2
|
`))||""},Cell:C0,width:80,searchable:!0}]:[],{Header:"Created",accessor:"createdAt",Cell:vt,sortType:"date",minWidth:120},...O.map(D=>{const L=typeof D=="string"?D:D.environment;return{Header:t?()=>"":L,maxWidth:90,id:`environments.${L}`,accessor:a1=>{var q;return(q=a1.environments[L])==null?void 0:q.enabled},align:"center",Cell:({value:a1,row:{original:q}})=>{const h1=q.someEnabledEnvironmentHasVariants&&q.environments[L].variantCount===0&&q.environments[L].enabled;return l(To,{hasWarning:h1,children:[n(Ma,{value:a1,projectId:y,featureId:q.name,environmentName:L}),n(x,{condition:h1,show:n(La,{})})]})},sortType:"boolean",filterName:L,filterParsing:a1=>a1?"enabled":"disabled"}}),{id:"Actions",maxWidth:56,width:56,Cell:D=>n(Xr,{projectId:y,onOpenArchiveDialog:g,onOpenStaleDialog:p,...D}),disableSortBy:!0,hideInMenu:!0}],[y,O,t]),[N,c1]=d.useState(F.get("search")||""),g1=d.useMemo(()=>e.map(D=>{var L;return{...D,environments:Object.fromEntries(O.map(a1=>{const q=D==null?void 0:D.environments.find(h1=>(h1==null?void 0:h1.name)===a1);return[a1,{name:a1,enabled:(q==null?void 0:q.enabled)||!1,variantCount:(q==null?void 0:q.variantCount)||0}]})),someEnabledEnvironmentHasVariants:((L=D.environments)==null?void 0:L.some(a1=>a1.variantCount>0&&a1.enabled))||!1}}),[e,O]),{data:f1,getSearchText:$1,getSearchContext:Ce}=yt(k,N,g1),T1=d.useMemo(()=>t?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):f1,[t,f1]),Be=d.useMemo(()=>{var a1;const D=k.map(q=>(q==null?void 0:q.id)||(typeof(q==null?void 0:q.accessor)=="string"?q==null?void 0:q.accessor:"")).filter(Boolean);let L=O.filter((q,h1)=>h1>=3).map(q=>`environments.${q}`);if(F.has("columns")){const q=((a1=F.get("columns"))==null?void 0:a1.split(","))||[],h1=[...qe,...q];L=D.filter(A=>!h1.includes(A))}else if(_.columns){const q=[...qe,..._.columns];L=D.filter(h1=>!q.includes(h1))}return{sortBy:[{id:F.get("sort")||"createdAt",desc:F.has("order")?F.get("order")==="desc":_.desc}],hiddenColumns:L,selectedRowIds:{}}},[O]),Ve=d.useCallback(D=>D.name,[]),{allColumns:_e,headerGroups:ee,rows:z1,state:{selectedRowIds:F1,sortBy:B1,hiddenColumns:H1},prepareRow:Me,setHiddenColumns:Le}=t1.useTable({columns:k,data:T1,initialState:Be,sortTypes:I,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:Ve},t1.useFlexLayout,t1.useSortBy,t1.useRowSelect);return d.useEffect(()=>{if(t)return;const D={};D.sort=B1[0].id,B1[0].desc&&(D.order="desc"),N&&(D.search=N),S&&(D.favorites="true"),D.columns=_e.map(({id:L})=>L).filter(L=>!qe.includes(L)&&!(H1!=null&&H1.includes(L))).join(","),E(D,{replace:!0}),C(L=>({...L,id:B1[0].id,desc:B1[0].desc||!1,columns:D.columns.split(",")})),R(L=>({...L,favorites:!!S}))},[t,B1,H1,N,E,S]),l(Y,{children:[l(l1,{isLoading:t,className:r.container,header:n(o1,{titleElement:`Feature toggles (${z1.length})`,actions:l(Y,{children:[n(x,{condition:!i,show:n(k1,{initialValue:N,onChange:c1,hasFilters:!0,getSearchContext:Ce})}),n(uo,{allColumns:_e,staticColumns:qe,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:!!_.columns,setHiddenColumns:Le}),n(o1.Divider,{sx:{marginLeft:0}}),n(x,{condition:!!((P1=$==null?void 0:$.flags)!=null&&P1.featuresExportImport),show:n(Y1,{title:"Export toggles visible in the table below",arrow:!0,children:n(L1,{onClick:()=>w(!0),sx:D=>({marginRight:D.spacing(2)}),children:n(_0,{})})})}),n(So,{onClick:()=>f(x0(y)),maxWidth:"960px",Icon:G3,projectId:y,permission:s2,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:n(x,{condition:i,show:n(k1,{initialValue:N,onChange:c1,hasFilters:!0,getSearchContext:Ce})})}),children:[n(ue,{value:$1(N),children:n(bt,{rows:z1,headerGroups:ee,prepareRow:Me})}),n(x,{condition:z1.length===0,show:n(x,{condition:(N==null?void 0:N.length)>0,show:l(C1,{children:["No feature toggles found matching “",N,"”"]}),elseShow:n(C1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),n(Ha,{onClose:()=>c(D=>({...D,open:!1})),projectId:y,...s}),n(Wa,{isStale:u.stale===!0,isOpen:!!u.featureId,onClose:()=>{p({}),M()},featureId:u.featureId||"",projectId:y}),n(mn,{isOpen:!!m,onConfirm:()=>{M()},onClose:()=>{g(void 0)},featureIds:[m||""],projectId:y})," ",n(Na,{isOpen:U.isOpen,onClose:B,environment:U==null?void 0:U.environment,onConfirm:Q,messageComponent:n(qa,{featureName:U.featureName,enabled:U.enabled,environment:U==null?void 0:U.environment})}),n(x,{condition:!!((te=$==null?void 0:$.flags)!=null&&te.featuresExportImport)&&!t,show:n(H3,{showExportDialog:v,data:T1,onClose:()=>w(!1),environments:O})})]}),n(w0,{count:Object.keys(F1).length,children:n(wo,{selectedIds:Object.keys(F1),data:e,projectId:y})})]})},je=h("div")(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",minWidth:225,padding:e.spacing(3),[e.breakpoints.down("md")]:{display:"flex",flexDirection:"column",position:"relative",padding:e.spacing(1.5)}})),Oe=h("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),_2=h("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),St=({children:e,to:t})=>n(Z,{variant:"body2",textAlign:"center",sx:{paddingTop:a=>a.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:n(l2,{component:D1,to:t,children:e})}),ko=h("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),Do=h("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),Ro=({projectId:e,health:t})=>l(je,{children:[n(Oe,{"data-loading":!0,children:"Project health"}),l(T,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:a=>a.spacing(2)},children:[n(Do,{children:n(S0,{percentage:t})}),l(ko,{"data-loading":!0,children:[t,"%"]})]}),n(St,{to:`/projects/${e}/health`,children:"View project health"})]}),Fo=h(_2)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),Po=h("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),width:"100%",gridTemplateColumns:`${e.spacing(2.5)} auto auto`,margin:e.spacing(1,0),fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,alignItems:"center",[e.breakpoints.down("md")]:{margin:0}})),Zo=({type:e,Icon:t,count:a})=>l(Po,{"data-loading":!0,children:[n(t,{fontSize:"small","data-loading":!0}),n("div",{children:(o=>o.charAt(0).toUpperCase()+o.slice(1).replace("-"," "))(e)}),n(Fo,{children:a})]}),Io=({features:e})=>{const t=d.useMemo(()=>{const a=(e==null?void 0:e.filter(c=>c.type==="release").length)||0,r=(e==null?void 0:e.filter(c=>c.type==="experiment").length)||0,o=(e==null?void 0:e.filter(c=>c.type==="operational").length)||0,i=(e==null?void 0:e.filter(c=>c.type==="kill-switch").length)||0,s=(e==null?void 0:e.filter(c=>c.type==="permission").length)||0;return{release:a,experiment:r,operational:o,"kill-switch":i,permission:s}},[e]);return l(je,{sx:{padding:a=>a.spacing(3)},children:[n(Oe,{children:"Toggle types used"}),Object.keys(t).map(a=>n(Zo,{type:a,Icon:T0(a),count:t[a]},a))]})},jo=h("div")(({theme:e})=>({textAlign:"left",borderRadius:`${e.shape.borderRadius}px`,backgroundColor:`${e.palette.background.elevation2}`,padding:e.spacing(.5,2),fontSize:e.typography.body2.fontSize})),Oo=({id:e,description:t})=>l(je,{children:[n(Oe,{children:"Project Meta"}),l(jo,{children:[n(Z,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",n("code",{"data-loading":!0,children:e||"__________"})]}),n(x,{condition:!!t,show:n(Z,{variant:"body2",sx:{marginTop:a=>a.spacing(1.5),marginBottom:0,textAlign:"left"},children:t})}),n(x,{condition:!t,show:n(St,{to:`/projects/${e}/edit`,children:"Add description"})})]}),$o=h(Z)(({theme:e})=>({marginBottom:e.spacing(2.5)})),zo=h(T)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),jt=h(T)(({theme:e})=>({...q1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),U2=h(Z)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),Bo=h(Z)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),Vo=e=>e>0?n(pr,{sx:{color:"success.dark",height:20,width:20}}):n(fr,{sx:{color:"warning.dark",height:20,width:20}}),Mo=e=>e>0?"success.dark":"warning.dark",Se=({title:e,boxText:t,change:a,percentage:r,children:o,customChangeElement:i})=>l(Y,{children:[n(x,{condition:!!e,show:n($o,{children:e})}),o,l(T,{sx:{...q1,justifyContent:"center",width:"auto"},children:[n(zo,{children:t}),n(x,{condition:!!i,show:n(jt,{children:i}),elseShow:n(x,{condition:a!==void 0&&a!==0,show:l(jt,{children:[l(T,{sx:{...q1},children:[Vo(a),l(Bo,{color:Mo(a),children:[a>0?"+":"",a,r?"%":""]})]}),n(U2,{children:"this month"})]}),elseShow:n(jt,{children:n(U2,{children:"No change"})})})})]})]}),Lo=({projectId:e,memberCount:t,change:a=0})=>{var i,s;const{uiConfig:r}=b1();let o="/admin/users";return(s=(i=r==null?void 0:r.versionInfo)==null?void 0:i.current)!=null&&s.enterprise&&(o=`/projects/${e}/settings/access`),l(je,{children:[n(Oe,{"data-loading":!0,children:"Project members"}),n(T,{sx:{display:"flex",justifyContent:"center"},children:n(Se,{boxText:`${t}`,change:a})}),n(St,{to:o,children:"View all members"})]})},Ho=e=>fetch(e).then(J1("ChangeRequest")).then(t=>t.json()),_n=e=>{const{data:t,error:a,mutate:r}=A0([],K1(`api/admin/projects/${e}/change-requests`),Ho);return d.useMemo(()=>({changeRequests:t,loading:!a&&!t,refetch:r,error:a}),[t,a,r])},Ke="change-requests-widget",Wo=h(T)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),G2=h(T)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),K2=h(T)(({theme:e})=>({display:"flex",alignItems:"center"})),No=h(_2)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),qo=h(_2)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),J2=h(Z)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),Y2=()=>n(Z,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":Ke,children:"change requests"}),Uo=({projectId:e})=>{const{changeRequests:t,loading:a}=_n(e),r=K3(a,`[data-loading="${Ke}"]`),o=t==null?void 0:t.filter(s=>(s==null?void 0:s.state)==="Approved").length,i=t==null?void 0:t.filter(s=>(s==null?void 0:s.state)==="In review").length;return l(je,{ref:r,children:[n(Oe,{children:"Open change requests"}),l(Wo,{children:[l(G2,{sx:{background:s=>s.palette.success.light},children:[n(J2,{children:"To be applied"}),l(K2,{children:[n(No,{"data-loading":Ke,children:o||0})," ",n(Y2,{})]})]}),l(G2,{sx:{background:s=>s.palette.secondary.light},children:[n(J2,{children:"To be reviewed"}),l(K2,{children:[n(qo,{"data-loading":Ke,children:i||0})," ",n(Y2,{})]})]})]}),n(St,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},Go=h(T)(({theme:e})=>({...q1,width:"225px",flexDirection:"column",gap:e.spacing(2),boxShadow:"none",[e.breakpoints.down("md")]:{display:"grid",width:"100%",alignItems:"stretch",marginBottom:e.spacing(2)},[e.breakpoints.down("sm")]:{display:"flex"}})),Ko=({id:e,description:t,memberCount:a,health:r,features:o,stats:i})=>{const{isEnterprise:s}=b1(),c=p1(),u=y1(c.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:p}=Pe(e),m=s()&&p(),g=e!==E0;return n("aside",{children:l(Go,{sx:!m&&!g||u&&m&&g?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[n(x,{condition:m,show:n(T,{sx:{gridColumnStart:g?"span 2":"span 1",flex:1,display:"flex"},children:n(Uo,{projectId:e})})}),n(Oo,{id:e,description:t}),n(Ro,{projectId:e,health:r}),n(x,{condition:g,show:n(Lo,{projectId:e,memberCount:a,change:i==null?void 0:i.projectMembersAddedCurrentWindow})}),n(Io,{features:o})]})})},Jo=h(j1)(({theme:e})=>({padding:e.spacing(3,3),maxWidth:"350px",borderRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.neutral.border}`,fontSize:e.typography.body2.fontSize})),Q2=({children:e,id:t})=>{const[a,r]=d.useState(null),o=c=>r(c.currentTarget),i=()=>r(null);return l(T,{sx:{position:"absolute",top:c=>c.spacing(.5),right:c=>c.spacing(.5)},children:[n(L1,{onClick:o,"aria-describedby":t,size:"small",children:n(J3,{sx:{fontSize:c=>c.typography.body1.fontSize}})}),n(Y3,{id:t,open:!!a,anchorEl:a,sx:c=>({zIndex:c.zIndex.tooltip}),children:n(Q3,{onClickAway:i,children:l(Jo,{elevation:3,children:[n(L1,{onClick:i,sx:{position:"absolute",right:4,top:4},children:n(k0,{sx:{fontSize:c=>c.typography.body1.fontSize}})}),e,n(D0,{id:t,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},Yo=h(T)(({theme:e})=>({padding:e.spacing(0,0,2,2),display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("md")]:{padding:e.spacing(0,0,2)},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Ue=h(T)(({theme:e})=>({position:"relative",padding:e.spacing(3),backgroundColor:e.palette.background.paper,flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:`${e.shape.borderRadiusLarge}px`,[e.breakpoints.down("lg")]:{padding:e.spacing(2)}})),Qo=h(Z)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),Xo=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:t,projectActivityCurrentWindow:a,projectActivityPastWindow:r,createdCurrentWindow:o,createdPastWindow:i,archivedCurrentWindow:s,archivedPastWindow:c}=e;return l(Yo,{children:[n(Ue,{children:n(Se,{title:"Total changes",boxText:String(a),change:a-r,children:n(Q2,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),n(Ue,{children:n(Se,{title:"Avg. time to production",boxText:l(T,{sx:{display:"flex",alignItems:"center",gap:u=>u.spacing(1)},children:[t," ",n(Z,{component:"span",children:"days"})]}),customChangeElement:n(Qo,{children:"In project life"}),percentage:!0,children:n(Q2,{id:"avg-time-to-prod",children:'How long did it take on average from a feature toggle was created until it was enabled in an environment of type production. This is calculated only from feature toggles with the type of "release".'})})}),n(Ue,{children:n(Se,{title:"Features created",boxText:String(o),change:o-i})}),n(Ue,{children:n(Se,{title:"Features archived",boxText:String(s),change:s-c})})]})},e4=15*1e3,t4=h("div")(({theme:e})=>({display:"flex",[e.breakpoints.down("md")]:{flexDirection:"column"}})),n4=h("div")(()=>({width:"100%",minWidth:0})),a4=h(T)(()=>({display:"flex",flexDirection:"column",width:"100%",minWidth:0})),r4=()=>{const e=K("projectId"),t=R1(e),{project:a,loading:r}=x1(e,{refreshInterval:e4}),{members:o,features:i,health:s,description:c,environments:u,stats:p}=a;S1(`Project overview – ${t}`);const{setLastViewed:m}=R0();return d.useEffect(()=>{m(e)},[e,m]),l(t4,{children:[n(Ko,{id:e,description:c,memberCount:o,health:s,features:i,stats:p}),l(a4,{children:[n(Xo,{stats:a.stats}),n(n4,{children:n(Eo,{features:i,environments:u,loading:r})})]})]})},o4=(e,t)=>{const a=K1(`api/admin/projects/${e}/health-report`),{data:r,error:o}=de(a,i4,t),i=d.useCallback(()=>{X3(a).catch(console.warn)},[a]);return{healthReport:r,refetchHealthReport:i,loading:!o&&!r,error:o}},i4=e=>fetch(e).then(J1("Health report")).then(t=>t.json());var x2={},s4=De;Object.defineProperty(x2,"__esModule",{value:!0});var Qt=x2.default=void 0,c4=s4(ke()),l4=Re,d4=(0,c4.default)((0,l4.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");Qt=x2.default=d4;const u4=h(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),X2=h(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),p4=h(j1)(({theme:e})=>({padding:e.spacing(4),marginBottom:e.spacing(2),borderRadius:e.shape.borderRadiusLarge,boxShadow:"none",display:"flex",justifyContent:"space-between",[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(2)}})),Ot=h("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1)})),h4=h("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),m4=h("p")(({theme:e})=>({color:e.palette.text.secondary})),e3=h("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),t3=h("p")(({theme:e})=>({marginLeft:e.spacing(4)})),g4=({healthReport:e})=>{const t=e.health<50?"error.main":e.health<75?"warning.main":"success.main",a=()=>l(u4,{children:[n(F0,{}),l("span",{children:[e.activeCount," active toggles"]})]}),r=()=>l(X2,{children:[n(Qt,{}),l("span",{children:[e.staleCount," stale toggles"]})]}),o=()=>l(X2,{children:[n(Qt,{}),l("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]});return l(p4,{children:[l(T,{children:[n(Ot,{children:"Health rating"}),n(x,{condition:e.health>-1,show:l(Y,{children:[l(h4,{sx:{color:t},children:[e.health,"%"]}),l(m4,{children:["Last updated:"," ",n(u2,{date:e.updatedAt,live:!1})]})]})})]}),l(T,{children:[n(Ot,{children:"Toggle report"}),l(e3,{children:[n("li",{children:n(x,{condition:!!e.activeCount,show:a})}),n(x,{condition:!!e.activeCount,show:n(t3,{children:"Also includes potentially stale toggles."})}),n("li",{children:n(x,{condition:!!e.staleCount,show:r})})]})]}),l(T,{sx:{flexBasis:"40%"},children:[n(Ot,{children:"Potential actions"}),n(e3,{children:n("li",{children:n(x,{condition:!!e.potentiallyStaleCount,show:o})})}),n(x,{condition:!!e.potentiallyStaleCount,show:n(t3,{children:"Review your feature toggles and delete unused toggles."}),elseShow:n("span",{children:"No action is required"})})]})]})},f4=({row:e})=>{const t=p1();return e.original.expiredAt?n(vt,{value:e.original.expiredAt}):n(s1,{children:n(Z,{variant:"body2",color:t.palette.text.secondary,children:"N/A"})})},v4=h("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),y4=h("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),b4=({row:e})=>e.original.status==="potentially-stale"?n(s1,{children:l(v4,{children:[n(gr,{}),n("span",{children:"Potentially stale"})]})}):n(s1,{children:l(y4,{children:[n(en,{}),n("span",{children:"Healthy"})]})}),n3=40,C4=7,xn={[Z0]:n3,[I0]:n3,[j0]:C4},wn=(e,t)=>Math.abs(P0(e,t)),Sn=(e,t)=>e>=xn[t],_4=e=>{const{type:t,createdAt:a}=e,r=tn(a),i=wn(r,new Date);return Sn(i,t)&&t!==nn&&t!==an?"potentially-stale":"healthy"},x4=e=>{const{type:t,createdAt:a}=e;if(t===nn||t===an)return;const r=tn(a),o=new Date,i=wn(r,o);if(Sn(i,t)){const s=i-xn[t];return vr(o,s).toISOString()}},w4=({projectId:e,features:t})=>{const a=p1(),r=y1(a.breakpoints.down("sm")),o=y1(a.breakpoints.down("md")),i=y1(a.breakpoints.down("lg")),s=d.useMemo(()=>t.map(b=>({project:e,name:b.name,type:b.type,stale:b.stale,status:_4(b),lastSeenAt:b.lastSeenAt,createdAt:b.createdAt,expiredAt:x4(b)})),[e,t]),c=d.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt"}]}),[]),{headerGroups:u,rows:p,prepareRow:m,state:{globalFilter:g},setGlobalFilter:y,setHiddenColumns:_}=t1.useTable({columns:a3,data:s,initialState:c,sortTypes:Ie,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},t1.useGlobalFilter,t1.useFlexLayout,t1.useSortBy);Ct([{condition:r,columns:["stale"]},{condition:o,columns:["expiredAt","lastSeenAt"]},{condition:i,columns:["createdAt"]}],_,a3);const C=p.length<s.length?`Feature toggles (${p.length} of ${s.length})`:`Feature toggles (${s.length})`;return l(l1,{header:n(o1,{title:C,actions:n(k1,{initialValue:g,onChange:y})}),children:[n(ue,{value:g,children:n(bt,{headerGroups:u,prepareRow:m,rows:p})}),n(x,{condition:p.length===0,show:n(x,{condition:(g==null?void 0:g.length)>0,show:l(C1,{children:["No feature toggles found matching “",g,"”"]}),elseShow:n(C1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},a3=[{Header:"Seen",accessor:"lastSeenAt",sortType:"date",align:"center",Cell:N3,disableGlobalFilter:!0,maxWidth:85},{Header:"Type",accessor:"type",align:"center",Cell:q3,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:O0,minWidth:120},{Header:"Created",accessor:"createdAt",sortType:"date",Cell:vt,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:f4,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:b4,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:$0,disableGlobalFilter:!0,maxWidth:120}],S4=()=>{const e=K("projectId"),t=R1(e);S1(`Project health – ${t}`);const{healthReport:a,refetchHealthReport:r,error:o}=o4(e,{refreshInterval:15*1e3});return a?l("div",{children:[n(x,{condition:!!o,show:n($3,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:r,text:`Could not fetch health rating for ${e}`})}),n(g4,{healthReport:a}),n(w4,{projectId:e,features:a.features})]}):null},T4=h("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),A4=()=>{const e=K("projectId");return n(T4,{children:n(z0,{title:"Event Log",project:e,displayInline:!0})})},Tn=(e,t)=>{const{data:a,error:r,mutate:o}=de(K1(`api/admin/projects/${e}/change-requests/${t}`),E4,{refreshInterval:15e3});return{data:a,loading:!r&&!a,refetchChangeRequest:()=>o(),error:r}},E4=e=>fetch(e).then(J1("Request changes")).then(t=>t.json()),k4=h(j1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));h(T)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const D4=h(T)(({theme:e})=>({display:"flex",alignItems:"center"})),R4=h(Z)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),F4=h(B0)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),An=h(_t)(({theme:e})=>({height:"24px",width:"24px"})),P4=({changeRequest:e})=>{var r,o,i;const[t,a]=d.useState(e.title);return l(k4,{elevation:0,children:[n(V0,{environmentChangeRequest:e,title:t,setTitle:a,children:n(R4,{variant:"h1",sx:{mr:1.5},children:t})}),l(D4,{children:[n(rn,{state:e.state}),l(Z,{variant:"body2",sx:s=>({margin:s.spacing("auto",0,"auto",2)}),children:["Created"," ",n(u2,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),n(T,{sx:s=>({marginLeft:s.spacing(1)}),children:n(Y1,{title:(r=e==null?void 0:e.createdBy)==null?void 0:r.username,children:n(An,{src:(o=e==null?void 0:e.createdBy)==null?void 0:o.imageUrl})})}),n(Z,{variant:"body2",sx:s=>({marginLeft:s.spacing(.5)}),children:(i=e==null?void 0:e.createdBy)==null?void 0:i.username}),n(T,{sx:s=>({marginLeft:s.spacing(1.5)}),children:n(F4,{variant:"outlined",children:l(Z,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",n(Z,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",n(M0,{})," Updates:"," ",l(Z,{variant:"body2",display:"inline",fontWeight:"bold",component:"span",children:[e.features.length," ",e.features.length===1?"feature toggle":"feature toggles"]})]})})})]})]})};function r1(){return r1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},r1.apply(this,arguments)}function ve(e,t){if(e==null)return{};var a={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(a[o]=e[o]);return a}const Z4=d.createContext({}),tt=Z4;function I4(e){return pe("MuiTimeline",e)}Q1("MuiTimeline",["root","positionLeft","positionRight","positionAlternate"]);const j4=["position","className"],O4=e=>{const{position:t,classes:a}=e,r={root:["root",t&&`position${O1(t)}`]};return ge(r,I4,a)},$4=h("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,a.position&&t[`position${O1(a.position)}`]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),z4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimeline"}),{position:o="right",className:i}=r,s=ve(r,j4),c=r1({},r,{position:o}),u=O4(c),p=d.useMemo(()=>({position:o}),[o]);return n(tt.Provider,{value:p,children:n($4,r1({className:me(u.root,i),ownerState:c,ref:a},s))})}),En=z4;function B4(e){return pe("MuiTimelineContent",e)}const V4=Q1("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate"]),M4=["className"],L4=e=>{const{position:t,classes:a}=e,r={root:["root",`position${O1(t)}`]};return ge(r,B4,a)},H4=h(Z,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`position${O1(a.position)}`]]}})(({ownerState:e})=>r1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),W4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineContent"}),{className:o}=r,i=ve(r,M4),{position:s}=d.useContext(tt),c=r1({},r,{position:s||"right"}),u=L4(c);return n(H4,r1({component:"div",className:me(u.root,o),ownerState:c,ref:a},i))}),kn=W4,N4=Q1("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate"]),q4=N4;function U4(e){return pe("MuiTimelineItem",e)}const G4=Q1("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","missingOppositeContent"]),Dn=G4,K4=["position","className"],J4=e=>{const{position:t,classes:a,hasOppositeContent:r}=e,o={root:["root",`position${O1(t)}`,!r&&"missingOppositeContent"]};return ge(o,U4,a)},Y4=h("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`position${O1(a.position)}`]]}})(({ownerState:e})=>r1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},e.position==="alternate"&&{"&:nth-of-type(even)":{flexDirection:"row-reverse",[`& .${V4.root}`]:{textAlign:"right"},[`& .${q4.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&:before":{content:'""',flex:1,padding:"6px 16px"}})),Q4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineItem"}),{position:o,className:i}=r,s=ve(r,K4),{position:c}=d.useContext(tt);let u=!1;d.Children.forEach(r.children,y=>{L0(y,["TimelineOppositeContent"])&&(u=!0)});const p=r1({},r,{position:o||c||"right",hasOppositeContent:u}),m=J4(p),g=d.useMemo(()=>({position:p.position}),[p.position]);return n(tt.Provider,{value:g,children:n(Y4,r1({className:me(m.root,i),ownerState:p,ref:a},s))})}),Je=Q4;function X4(e){return pe("MuiTimelineSeparator",e)}Q1("MuiTimelineSeparator",["root"]);const ei=["className"],ti=e=>{const{classes:t}=e;return ge({root:["root"]},X4,t)},ni=h("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),ai=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineSeparator"}),{className:o}=r,i=ve(r,ei),s=r,c=ti(s);return n(ni,r1({className:me(c.root,o),ownerState:s,ref:a},i))}),Ye=ai;function ri(e){return pe("MuiTimelineDot",e)}Q1("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const oi=["className","color","variant"],ii=e=>{const{color:t,variant:a,classes:r}=e,o={root:["root",a,t!=="inherit"&&`${a}${O1(t)}`]};return ge(o,ri,r)},si=h("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.color!=="inherit"&&`${a.variant}${O1(a.color)}`],t[a.variant]]}})(({ownerState:e,theme:t})=>r1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(t.vars||t).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&r1({borderColor:"transparent"},e.color!=="inherit"&&r1({},e.color==="grey"?{color:(t.vars||t).palette.grey[50],backgroundColor:(t.vars||t).palette.grey[400]}:{color:(t.vars||t).palette[e.color].contrastText,backgroundColor:(t.vars||t).palette[e.color].main})),e.variant==="outlined"&&r1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&r1({},e.color==="grey"?{borderColor:(t.vars||t).palette.grey[400]}:{borderColor:(t.vars||t).palette[e.color].main})))),ci=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineDot"}),{className:o,color:i="grey",variant:s="filled"}=r,c=ve(r,oi),u=r1({},r,{color:i,variant:s}),p=ii(u);return n(si,r1({className:me(p.root,o),ownerState:u,ref:a},c))}),Rn=ci;function li(e){return pe("MuiTimelineConnector",e)}Q1("MuiTimelineConnector",["root"]);const di=["className"],ui=e=>{const{classes:t}=e;return ge({root:["root"]},li,t)},pi=h("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),hi=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineConnector"}),{className:o}=r,i=ve(r,di),s=r,c=ui(s);return n(pi,r1({className:me(c.root,o),ownerState:s,ref:a},i))}),w2=hi,mi=h(j1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),gi=h(T)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),fi=h(En)(()=>({[`& .${Dn.root}:before`]:{flex:0,padding:0}})),vi=({state:e})=>{const t=r=>["Draft","In review","Approved","Applied"].map(i=>({title:i,active:i===r}));return n(mi,{elevation:0,children:n(gi,{children:n(fi,{children:(()=>{const r=t(e),o=r.findIndex(s=>s.active),i=o!==-1?o:null;return e==="Cancelled"?bi(r):yi(r,i)})()})})})},yi=(e,t)=>e.map(({title:a},r)=>{const o=r<e.length-1,i=n(x,{condition:o,show:n(w2,{})});return t!==null&&t>=r?Qe("success",a,i):t!==null&&t+1===r?Qe("primary",a,i,{variant:"outlined"}):Qe("grey",a,i)}),bi=e=>e.map(({title:t},a)=>{const r=a<e.length-1;return Qe("grey",t,n(x,{condition:r,show:n(w2,{})}))}),Qe=(e,t,a,r={})=>l(Je,{children:[l(Ye,{children:[n(Rn,{color:e,...r}),a]}),n(kn,{children:t})]},t),Ci=h(T)(({theme:e})=>({marginBottom:e.spacing(2)})),_i=({actualApprovals:e,minApprovals:t})=>l(Y,{children:["Reviewers"," ",l(Z,{component:"span",color:"text.secondary",children:["(",e,"/",t," required)"]})]}),xi=({header:e,children:t})=>l(j1,{elevation:0,sx:a=>({marginTop:a.spacing(2),padding:a.spacing(4),borderRadius:r=>`${r.shape.borderRadiusLarge}px`}),children:[n(Ci,{children:e}),n(Z,{variant:"body1",color:"text.secondary",children:n(x,{condition:Te.Children.count(t)>0,show:"Approved by",elseShow:"No approvals yet"})}),t]}),S2=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",se=h(T)(({theme:e})=>({display:"flex",alignItems:"center"})),wi=h(on)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),r3=h(on)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xt=h(sn)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Si=h(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),Ti=h(T,{shouldForwardProp:S2()})(({theme:e,bgColor:t,svgColor:a})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:t,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:a}})),Fn=h(V3)(({theme:e})=>({margin:e.spacing(2.5,0)})),Ai=h(T,{shouldForwardProp:S2()})(({theme:e,border:t})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:t,padding:e.spacing(3),width:"100%"})),ce=h(Z,{shouldForwardProp:S2()})(({theme:e,color:t})=>({fontWeight:"bold",color:t})),Ei=(e,t)=>e==="Approved"?`2px solid ${t.palette.success.main}`:e==="Applied"?`2px solid ${t.palette.primary.main}`:`1px solid ${t.palette.divider}`,ki=(e,t)=>e==="Approved"?{bgColor:t.palette.success.main,svgColor:t.palette.background.paper}:e==="Applied"?{bgColor:t.palette.primary.main,svgColor:t.palette.background.paper}:{bgColor:t.palette.background.elevation2,svgColor:t.palette.neutral.main},Di=({changeRequest:e})=>{const t=p1();return l(Si,{children:[n(Ti,{...ki(e.state,t),children:n(H0,{style:{transform:"scale(1.5)"}})}),n(Ai,{sx:{backgroundColor:e.state==="In review"?t.palette.warning.light:"initial"},border:Ei(e.state,t),children:n(Ri,{changeRequest:e})})]})},Ri=({changeRequest:e})=>{const{state:t}=e;return t?t==="Approved"?n(Fi,{}):t==="Applied"?n(Zi,{}):t==="Cancelled"?n(Ii,{}):n(Pi,{minApprovals:e.minApprovals}):null},Fi=()=>{const e=p1();return l(Y,{children:[l(se,{children:[n(Xt,{}),l(T,{children:[n(ce,{color:e.palette.success.dark,children:"Changes approved"}),n(Z,{children:"One approving review from requested approvers"})]})]}),n(Fn,{}),l(se,{children:[n(Xt,{}),n(T,{children:n(ce,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},Pi=({minApprovals:e})=>{const t=p1();return l(Y,{children:[l(se,{children:[n(r3,{}),l(T,{children:[n(ce,{color:t.palette.warning.dark,children:"Review required"}),l(Z,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),n(Fn,{}),l(se,{children:[n(r3,{}),n(ce,{color:t.palette.warning.dark,children:"Apply changes is blocked"})]})]})},Zi=()=>{const e=p1();return n(Y,{children:l(se,{children:[n(Xt,{sx:{color:e.palette.primary.main}}),n(T,{children:n(ce,{color:e.palette.primary.main,children:"Changes applied"})})]})})},Ii=()=>{const e=p1();return n(Y,{children:l(se,{children:[n(wi,{}),n(T,{children:n(ce,{color:e.palette.error.main,children:"Changes cancelled"})})]})})};var T2={},ji=De;Object.defineProperty(T2,"__esModule",{value:!0});var Pn=T2.default=void 0,Oi=ji(ke()),$i=Re,zi=(0,Oi.default)((0,$i.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");Pn=T2.default=zi;const Bi=({disabled:e})=>{const{isAdmin:t}=d.useContext(X1),a=K("projectId"),r=K("id"),{user:o}=cn(),{refetchChangeRequest:i,data:s}=Tn(a,r),{refetch:c}=Ze(a),{setToastApiError:u,setToastData:p}=u1(),{changeState:m}=Fe(),[g,y]=Te.useState(!1),_=Te.useRef(null),C=async()=>{try{await m(a,Number(r),{state:"Approved"}),i(),c(),p({type:"success",title:"Success",text:"Changes approved"})}catch(f){u(m1(f))}},b=()=>{y(f=>!f)},R=f=>{_.current&&_.current.contains(f.target)||y(!1)};return l(Te.Fragment,{children:[n(p2,{variant:"contained",disabled:e||(s==null?void 0:s.createdBy.id)===(o==null?void 0:o.id)&&!t,"aria-controls":g?"review-options-menu":void 0,"aria-expanded":g?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:b,ref:_,endIcon:n(Pn,{}),permission:W0,projectId:a,environmentId:s==null?void 0:s.environment,children:"Review changes"}),n(Y3,{sx:{zIndex:1},open:g,anchorEl:_.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:f,placement:F})=>n(N0,{...f,style:{transformOrigin:F==="bottom"?"center top":"center bottom"},children:n(j1,{className:"dropdown-outline",children:n(Q3,{onClickAway:R,children:n(mt,{id:"review-options-menu",autoFocusItem:!0,children:n(N1,{onClick:C,children:"Approve changes"})})})})})})]})},Vi=h(T)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),Mi=h(sn)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),Li=({name:e,imageUrl:t})=>l(Vi,{children:[n(An,{src:t}),n(Z,{variant:"body1",color:"text.primary",sx:{maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:e}),n(Mi,{})]});var Zn={},A2={},E2={};Object.defineProperty(E2,"__esModule",{value:!0});var Hi=d,Wi=Ni(Hi);function Ni(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}E2.default=function(e,t,a){return Wi.createElement("a",{href:e,key:a},t)};var k2={};Object.defineProperty(k2,"__esModule",{value:!0});k2.default=function(e){return e};var D2={},$t,o3;function qi(){return o3||(o3=1,$t=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),$t}var zt,i3;function Ui(){return i3||(i3=1,zt=/[\0-\x1F\x7F-\x9F]/),zt}var Bt,s3;function Gi(){return s3||(s3=1,Bt=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),Bt}var Vt,c3;function Ki(){return c3||(c3=1,Vt=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),Vt}var Mt,l3;function Ji(){return l3||(l3=1,Mt=function(e){var t={};t.src_Any=qi().source,t.src_Cc=Ui().source,t.src_Z=Gi().source,t.src_P=Ki().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");var a="[><|]";return t.src_pseudo_letter="(?:(?!"+a+"|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+a+"|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+a+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+a+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}),Mt}function e2(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach(function(a){a&&Object.keys(a).forEach(function(r){e[r]=a[r]})}),e}function Tt(e){return Object.prototype.toString.call(e)}function Yi(e){return Tt(e)==="[object String]"}function Qi(e){return Tt(e)==="[object Object]"}function Xi(e){return Tt(e)==="[object RegExp]"}function d3(e){return Tt(e)==="[object Function]"}function es(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var In={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function ts(e){return Object.keys(e||{}).reduce(function(t,a){return t||In.hasOwnProperty(a)},!1)}var ns={"http:":{validate:function(e,t,a){var r=e.slice(t);return a.re.http||(a.re.http=new RegExp("^\\/\\/"+a.re.src_auth+a.re.src_host_port_strict+a.re.src_path,"i")),a.re.http.test(r)?r.match(a.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,a){var r=e.slice(t);return a.re.no_http||(a.re.no_http=new RegExp("^"+a.re.src_auth+"(?:localhost|(?:(?:"+a.re.src_domain+")\\.)+"+a.re.src_domain_root+")"+a.re.src_port+a.re.src_host_terminator+a.re.src_path,"i")),a.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(a.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,a){var r=e.slice(t);return a.re.mailto||(a.re.mailto=new RegExp("^"+a.re.src_email_name+"@"+a.re.src_host_strict,"i")),a.re.mailto.test(r)?r.match(a.re.mailto)[0].length:0}}},as="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",rs="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function os(e){e.__index__=-1,e.__text_cache__=""}function is(e){return function(t,a){var r=t.slice(a);return e.test(r)?r.match(e)[0].length:0}}function u3(){return function(e,t){t.normalize(e)}}function nt(e){var t=e.re=Ji()(e.__opts__),a=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||a.push(as),a.push(t.src_xn),t.src_tlds=a.join("|");function r(c){return c.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");var o=[];e.__compiled__={};function i(c,u){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+u)}Object.keys(e.__schemas__).forEach(function(c){var u=e.__schemas__[c];if(u!==null){var p={validate:null,link:null};if(e.__compiled__[c]=p,Qi(u)){Xi(u.validate)?p.validate=is(u.validate):d3(u.validate)?p.validate=u.validate:i(c,u),d3(u.normalize)?p.normalize=u.normalize:u.normalize?i(c,u):p.normalize=u3();return}if(Yi(u)){o.push(c);return}i(c,u)}}),o.forEach(function(c){e.__compiled__[e.__schemas__[c]]&&(e.__compiled__[c].validate=e.__compiled__[e.__schemas__[c]].validate,e.__compiled__[c].normalize=e.__compiled__[e.__schemas__[c]].normalize)}),e.__compiled__[""]={validate:null,normalize:u3()};var s=Object.keys(e.__compiled__).filter(function(c){return c.length>0&&e.__compiled__[c]}).map(es).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),os(e)}function ss(e,t){var a=e.__index__,r=e.__last_index__,o=e.__text_cache__.slice(a,r);this.schema=e.__schema__.toLowerCase(),this.index=a+t,this.lastIndex=r+t,this.raw=o,this.text=o,this.url=o}function p3(e,t){var a=new ss(e,t);return e.__compiled__[a.schema].normalize(a,e),a}function _1(e,t){if(!(this instanceof _1))return new _1(e,t);t||ts(e)&&(t=e,e={}),this.__opts__=e2({},In,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=e2({},ns,e),this.__compiled__={},this.__tlds__=rs,this.__tlds_replaced__=!1,this.re={},nt(this)}_1.prototype.add=function(t,a){return this.__schemas__[t]=a,nt(this),this};_1.prototype.set=function(t){return this.__opts__=e2(this.__opts__,t),this};_1.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;var a,r,o,i,s,c,u,p,m;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(a=u.exec(t))!==null;)if(i=this.testSchemaAt(t,a[2],u.lastIndex),i){this.__schema__=a[2],this.__index__=a.index+a[1].length,this.__last_index__=a.index+a[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(p=t.search(this.re.host_fuzzy_test),p>=0&&(this.__index__<0||p<this.__index__)&&(r=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(m=t.indexOf("@"),m>=0&&(o=t.match(this.re.email_fuzzy))!==null&&(s=o.index+o[1].length,c=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=c))),this.__index__>=0};_1.prototype.pretest=function(t){return this.re.pretest.test(t)};_1.prototype.testSchemaAt=function(t,a,r){return this.__compiled__[a.toLowerCase()]?this.__compiled__[a.toLowerCase()].validate(t,r,this):0};_1.prototype.match=function(t){var a=0,r=[];this.__index__>=0&&this.__text_cache__===t&&(r.push(p3(this,a)),a=this.__last_index__);for(var o=a?t.slice(a):t;this.test(o);)r.push(p3(this,a)),o=o.slice(this.__last_index__),a+=this.__last_index__;return r.length?r:null};_1.prototype.tlds=function(t,a){return t=Array.isArray(t)?t:[t],a?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,o,i){return r!==i[o-1]}).reverse(),nt(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,nt(this),this)};_1.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};_1.prototype.onCompile=function(){};var cs=_1;const ls=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","actor","ad","ads","adult","ae","aeg","aero","aetna","af","afl","africa","ag","agakhan","agency","ai","aig","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","amazon","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","casa","case","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","charity","chase","chat","cheap","chintai","christmas","chrome","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cpa","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dog","domains","dot","download","drive","dtv","dubai","dunlop","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epson","equipment","er","ericsson","erni","es","esq","estate","et","etisalat","eu","eurovision","eus","events","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gay","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","inc","industries","infiniti","info","ing","ink","institute","insurance","insure","int","international","intuit","investments","io","ipiranga","iq","ir","irish","is","ismaili","ist","istanbul","it","itau","itv","jaguar","java","jcb","je","jeep","jetzt","jewelry","jio","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kids","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","lamborghini","lamer","lancaster","lancia","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","link","lipsy","live","living","lk","llc","llp","loan","loans","locker","locus","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","luxe","luxury","lv","ly","ma","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","merckmsd","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","moda","moe","moi","mom","monash","money","monster","mormon","mortgage","moscow","moto","motorcycles","mov","movie","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","music","mutual","mv","mw","mx","my","mz","na","nab","nagoya","name","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","racing","radio","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","ril","rio","rip","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scot","sd","se","search","seat","secure","security","seek","select","sener","services","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","spa","space","sport","spot","sr","srl","ss","st","stada","staples","star","statebank","statefarm","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiss","sx","sy","sydney","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","vermögensberater","vermögensberatung","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zm","zone","zuerich","zw","ελ","ευ","бг","бел","дети","ею","католик","ком","мкд","мон","москва","онлайн","орг","рус","рф","сайт","срб","укр","қаз","հայ","ישראל","קום","ابوظبي","اتصالات","ارامكو","الاردن","البحرين","الجزائر","السعودية","العليان","المغرب","امارات","ایران","بارت","بازار","بيتك","بھارت","تونس","سودان","سورية","شبكة","عراق","عرب","عمان","فلسطين","قطر","كاثوليك","كوم","مصر","مليسيا","موريتانيا","موقع","همراه","پاکستان","ڀارت","कॉम","नेट","भारत","भारतम्","भारोत","संगठन","বাংলা","ভারত","ভাৰত","ਭਾਰਤ","ભારત","ଭାରତ","இந்தியா","இலங்கை","சிங்கப்பூர்","భారత్","ಭಾರತ","ഭാരതം","ලංකා","คอม","ไทย","ລາວ","გე","みんな","アマゾン","クラウド","グーグル","コム","ストア","セール","ファッション","ポイント","世界","中信","中国","中國","中文网","亚马逊","企业","佛山","信息","健康","八卦","公司","公益","台湾","台灣","商城","商店","商标","嘉里","嘉里大酒店","在线","大拿","天主教","娱乐","家電","广东","微博","慈善","我爱你","手机","招聘","政务","政府","新加坡","新闻","时尚","書籍","机构","淡马锡","游戏","澳門","点看","移动","组织机构","网址","网店","网站","网络","联通","谷歌","购物","通販","集团","電訊盈科","飞利浦","食品","餐厅","香格里拉","香港","닷넷","닷컴","삼성","한국"];Object.defineProperty(D2,"__esModule",{value:!0});var ds=cs,us=jn(ds),ps=ls,hs=jn(ps);function jn(e){return e&&e.__esModule?e:{default:e}}var On=new us.default;On.tlds(hs.default);D2.default=function(e){return On.match(e)};var R2={};Object.defineProperty(R2,"__esModule",{value:!0});R2.default=function(e){return e};Object.defineProperty(A2,"__esModule",{value:!0});var ms=function(){function e(t,a){for(var r=0;r<a.length;r++){var o=a[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),gs=d,we=Ss(gs),fs=E2,vs=At(fs),ys=k2,bs=At(ys),Cs=D2,_s=At(Cs),xs=R2,ws=At(xs);function At(e){return e&&e.__esModule?e:{default:e}}function Ss(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}function Ts(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function As(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Es(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var $n=function(e){Es(t,e);function t(){return Ts(this,t),As(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return ms(t,[{key:"parseString",value:function(r){var o=this;if(r==="")return r;var i=this.props.matchDecorator(r);if(!i)return r;var s=[],c=0;return i.forEach(function(u,p){u.index>c&&s.push(r.substring(c,u.index));var m=o.props.hrefDecorator(u.url),g=o.props.textDecorator(u.text),y=o.props.componentDecorator(m,g,p);s.push(y),c=u.lastIndex}),r.length>c&&s.push(r.substring(c)),s.length===1?s[0]:s}},{key:"parse",value:function(r){var o=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof r=="string"?this.parseString(r):we.isValidElement(r)&&r.type!=="a"&&r.type!=="button"?we.cloneElement(r,{key:i},this.parse(r.props.children)):Array.isArray(r)?r.map(function(s,c){return o.parse(s,c)}):r}},{key:"render",value:function(){return we.createElement(we.Fragment,null,this.parse(this.props.children))}}]),t}(we.Component);$n.defaultProps={componentDecorator:vs.default,hrefDecorator:bs.default,matchDecorator:_s.default,textDecorator:ws.default};A2.default=$n;Object.defineProperty(Zn,"__esModule",{value:!0});var ks=A2,Ds=Rs(ks);function Rs(e){return e&&e.__esModule?e:{default:e}}var Fs=Zn.default=Ds.default;const Ps=h(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),Zs=h(j1)(({theme:e})=>({width:"100%",padding:e.spacing(1.5,3,2.5,3),backgroundColor:e.palette.neutral.light,borderRadius:e.shape.borderRadiusLarge,borderColor:e.palette.divider})),Is=h(T)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),js=({comment:e})=>l(Ps,{children:[n(Y1,{title:e.createdBy.username,children:n(q0,{src:e.createdBy.imageUrl})}),l(Zs,{variant:"outlined",children:[n(Is,{children:l(T,{children:[n("strong",{children:e.createdBy.username})," ",l(Z,{color:"text.secondary",component:"span",children:["commented"," ",n(u2,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),n(T,{sx:{paddingTop:2.5},children:n(Fs,{children:e.text})})]})]}),Os=h(T)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),$s=h(j1)(({theme:e})=>({marginTop:e.spacing(2),marginLeft:e.spacing(2),width:"70%",padding:e.spacing(1,2),borderRadius:e.shape.borderRadiusLarge,[e.breakpoints.down("sm")]:{marginLeft:0,width:"100%"}})),zs=h(T)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),Bs=h(T)(({theme:e})=>({padding:e.spacing(2)})),Vs=h(T)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Ms=()=>{var V,H;const e=K("projectId"),[t,a]=d.useState(!1),{user:r}=cn(),{isAdmin:o}=d.useContext(X1),[i,s]=d.useState(""),c=K("id"),{data:u,refetchChangeRequest:p}=Tn(e,c),{changeState:m,addComment:g,loading:y}=Fe(),{refetch:_}=Ze(e),{setToastData:C,setToastApiError:b}=u1(),{isChangeRequestConfiguredForReview:R}=Pe(e);if(!u)return null;const f=R(u.environment),F=async()=>{try{await m(e,Number(c),{state:"Applied"}),p(),_(),C({type:"success",title:"Success",text:"Changes applied"})}catch(B){b(m1(B))}},E=async()=>{try{await g(e,c,i),s(""),p(),C({type:"success",title:"Success",text:"Comment added"})}catch(B){b(m1(B))}},O=async()=>{try{await m(e,Number(c),{state:"Cancelled"}),a(!1),p(),_(),C({type:"success",title:"Success",text:"Changes cancelled"})}catch(B){b(m1(B))}},M=()=>a(!0),S=()=>a(!1),I=(u==null?void 0:u.createdBy.id)===(r==null?void 0:r.id)&&u.state==="In review"&&!o,j=u.approvals.some(B=>B.createdBy.id===(r==null?void 0:r.id));return l(Y,{children:[n(P4,{changeRequest:u}),l(Vs,{children:[l(Os,{children:[n(vi,{state:u.state}),n(xi,{header:n(_i,{actualApprovals:u.approvals.length,minApprovals:u.minApprovals}),children:(V=u.approvals)==null?void 0:V.map(B=>n(Li,{name:B.createdBy.username||"Unknown user",imageUrl:B.createdBy.imageUrl},B.createdBy.username))})]}),n($s,{elevation:0,children:l(Bs,{children:["Requested Changes (",U0(u),")",n(G0,{changeRequest:u,onRefetch:p}),(H=u.comments)==null?void 0:H.map(B=>n(js,{comment:B},B.id)),n(K0,{user:r,commentText:i,onTypeComment:s,children:n(d1,{variant:"outlined",onClick:E,disabled:!f||i.trim().length===0||i.trim().length>1e3,children:"Comment"})}),n(x,{condition:I,show:n(w1,{sx:B=>({marginTop:B.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),n(Di,{changeRequest:u}),l(zs,{children:[n(x,{condition:u.state==="In review"&&!j,show:n(Bi,{disabled:!f})}),n(x,{condition:u.state==="Approved",show:n(p2,{variant:"contained",onClick:F,projectId:e,permission:J0,environmentId:u.environment,disabled:!f||y,children:"Apply changes"})}),n(x,{condition:u.state!=="Applied"&&u.state!=="Cancelled"&&(u.createdBy.id===(r==null?void 0:r.id)||o),show:n(d1,{sx:{marginLeft:B=>B.spacing(2)},variant:"outlined",onClick:M,children:"Cancel changes"})})]})]})}),l(G1,{open:t,onClick:O,onClose:S,title:"Cancel change request",children:[n(Z,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),n(Z,{variant:"body2",sx:B=>({color:B.palette.neutral.dark}),children:"The change request will be moved to closed, and it can't be applied anymore. Once cancelled, the change request can't be reopened."})]})]})]})},Ls=({value:e})=>{const t=()=>e?n(rn,{state:e}):null;return e?n(s1,{children:t()}):n(s1,{})},Hs=h("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Ws=({value:e})=>n(s1,{children:n(Hs,{children:l(Z,{component:"span",variant:"body2",children:[" ",e==null?void 0:e.username]})})}),Ns=h("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),qs=({value:e,row:{original:t}})=>{const a=K("projectId"),{id:r,title:o,features:i}=t,s=`/projects/${a}/change-requests/${r}`;return e?l(s1,{sx:{minWidth:"200px"},children:[n(Ns,{children:n(Z,{variant:"body2",children:n(l2,{component:D1,underline:"hover",to:s,sx:c=>({paddingTop:c.spacing(.2),marginRight:c.spacing(1),"&:hover":{textDecoration:"underline"}}),children:o})})}),l("span",{children:[`${i==null?void 0:i.length}`," ",i.length<=1?"update":"updates"]})]}):n(s1,{})},Us=M3()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(4),overflowX:"auto"}})),Gs=h(T)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Ks=h(D1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Js=h(D1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Ys=h(T)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),Qs=({value:e,project:t})=>{const a=e==null?void 0:e.map(r=>r.name);return n(Gs,{children:n(x,{condition:(a==null?void 0:a.length)<3,show:a==null?void 0:a.map(r=>n(Ks,{title:r,to:`/projects/${t}/features/${r}`,children:r})),elseShow:l(Y0,{tooltipProps:{maxWidth:"800px"},tooltip:n(Ys,{children:a==null?void 0:a.map(r=>n(Js,{title:r,to:`/projects/${t}/features/${r}`,children:r}))}),children:[a==null?void 0:a.length," toggles"]})})})},Xs={id:"createdAt"},e5=h("div")({paddingLeft:0,paddingBottom:0}),t5=h(Xe)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),n5=({changeRequests:e=[],loading:t,projectId:a})=>{var U,v;const{classes:r}=Us(),o=y1(Q0.breakpoints.down("md")),[i,s]=d2(),[c,u]=d.useState(i.get("search")||""),{value:p,setValue:m}=pt(`${a}:ProjectChangeRequest`,Xs),[g,y]=d.useMemo(()=>{const w=e.filter(P=>P.state!=="Cancelled"&&P.state!=="Applied"),$=e.filter(P=>P.state==="Cancelled"||P.state==="Applied");return[w,$]},[e]),_=[{title:"Change requests",data:g},{title:"Closed",data:y}],[C,b]=d.useState(0),R=d.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:qs},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",Cell:({value:w,row:{original:{title:$}}})=>n(Qs,{project:a,value:w},$)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:Ws,align:"left"},{Header:"Submitted",accessor:"createdAt",searchable:!0,maxWidth:100,Cell:et,sortType:"alphanumeric"},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:s1},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:Ls}],[a]),{data:f,getSearchText:F,getSearchContext:E}=yt(R,c,(U=_[C])==null?void 0:U.data),O=d.useMemo(()=>t?X0:f,[f,t]),[M]=d.useState(()=>({sortBy:[{id:i.get("sort")||p.id,desc:i.has("order")?i.get("order")==="desc":p.desc}],hiddenColumns:[]})),{headerGroups:S,rows:I,state:{sortBy:j},prepareRow:V,setHiddenColumns:H,getTableProps:B,getTableBodyProps:Q}=t1.useTable({columns:R,data:O,initialState:M,sortTypes:Ie,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:s1}},t1.useSortBy);return Ct([{condition:o,columns:["createdBy"]}],H,R),d.useEffect(()=>{if(t)return;const w={};w.sort=j[0].id,j[0].desc&&(w.order="desc"),c&&(w.search=c),s(w,{replace:!0}),m($=>({...$,id:j[0].id,desc:j[0].desc||!1}))},[t,j,c,s]),l(l1,{isLoading:t,bodyClass:r.bodyClass,headerClass:r.header,header:n(o1,{titleElement:n(e5,{children:n(h2,{value:(v=_[C])==null?void 0:v.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:_.map((w,$)=>n(t5,{label:`${w.title} (${w.data.length})`,value:w.title,onClick:()=>b($)},w.title))})}),actions:n(k1,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:E})}),children:[n(ue,{value:F(c),children:l(it,{...B(),children:[n(st,{headerGroups:S}),n(ct,{...Q(),children:I.map(w=>(V(w),n(lt,{hover:!0,...w.getRowProps(),children:w.cells.map($=>n(dt,{...$.getCellProps(),padding:"none",children:$.render("Cell")}))})))})]})}),n(x,{condition:I.length===0,show:()=>n(x,{condition:(c==null?void 0:c.length)>0,show:l(C1,{children:["No changes found matching “",c,"”"]}),elseShow:n(C1,{children:"None of the changes were submitted yet."})})})]})},a5=()=>{const e=K("projectId"),t=R1(e),{isOss:a,isPro:r}=b1();S1(`Change requests – ${t}`);const{changeRequests:o,loading:i}=_n(e);return a()||r()?n(l1,{sx:{justifyContent:"center"},children:n(xt,{feature:"change-requests"})}):n(n5,{changeRequests:o,projectId:e,loading:i})};var G=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(G||{});const $e=(e,t={})=>{const a=K1(`api/admin/projects/${e}/access`),r=()=>fetch(a,{method:"GET"}).then(J1("project access")).then(g=>g.json()),o=`api/admin/projects/${e}/users`,{data:i,error:s}=de(o,r,t),[c,u]=d.useState(!s&&!i),p=()=>{X3(o)};return d.useEffect(()=>{u(!s&&!i)},[i,s]),{access:d.useMemo(()=>{if(i)return r5({roles:i.roles,users:i.users.filter(({accountType:g})=>!g||g==="User"),serviceAccounts:i.users.filter(({accountType:g})=>g==="Service Account"),groups:(i==null?void 0:i.groups.map(g=>({...g,users:Ja(g.users??[])})))??[]})},[i]),error:s,loading:c,refetchProjectAccess:p}},r5=e=>{const t=e.users||[],a=e.serviceAccounts||[],r=e.groups||[];return{...e,rows:[...t.map(o=>({entity:o,type:"USERS"})),...a.map(o=>({entity:o,type:"SERVICE ACCOUNTS"})),...r.map(o=>({entity:o,type:"GROUPS"}))]}},o5=h(l1)(({theme:e})=>({height:"100vh",overflow:"auto",padding:e.spacing(7.5,6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),i5=h("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),h3={id:"joinedAt"},Lt=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>n(s1,{children:n(g2,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:Ae,minWidth:100,searchable:!0},{id:"username",Header:"Username",accessor:e=>e.username||e.email,Cell:Ae,minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:vt,sortType:"date",maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>n(et,{value:e.seenAt,emptyText:"Never",title:t=>`Last login: ${t}`}),sortType:"date",maxWidth:150}],s5=["imageUrl","name","joined","lastLogin"],c5=({open:e,setOpen:t,group:a,projectId:r,subtitle:o,onEdit:i,onRemove:s})=>{const c=p1(),u=y1(c.breakpoints.down("md")),[p]=d.useState(()=>({sortBy:[{id:h3.id,desc:h3.desc}]})),[m,g]=d.useState(""),{data:y,getSearchText:_,getSearchContext:C}=yt(Lt,m,(a==null?void 0:a.users)??[]),{headerGroups:b,rows:R,prepareRow:f,setHiddenColumns:F}=t1.useTable({columns:Lt,data:y,initialState:p,sortTypes:Ie,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},t1.useSortBy,t1.useFlexLayout);return Ct([{condition:u,columns:s5}],F,Lt),n(U1,{open:e,onClose:()=>{t(!1)},label:(a==null?void 0:a.name)||"Group",children:l(o5,{header:n(o1,{secondary:!0,titleElement:l(i5,{children:[a==null?void 0:a.name," (",R.length<y.length?`${R.length} of ${y.length}`:y.length,")",n("span",{children:o})]}),actions:l(Y,{children:[n(x,{condition:!u,show:l(Y,{children:[n(k1,{initialValue:m,onChange:g,hasFilters:!0,getSearchContext:C}),n(o1.Divider,{})]})}),n(V1,{permission:E1,projectId:r,tooltipProps:{title:"Edit group access"},onClick:i,children:n(wt,{})}),n(V1,{permission:E1,projectId:r,tooltipProps:{title:"Remove group access"},onClick:s,children:n(m2,{})})]}),children:n(x,{condition:u,show:n(k1,{initialValue:m,onChange:g,hasFilters:!0,getSearchContext:C})})}),children:[n(ue,{value:_(m),children:n(bt,{rows:R,headerGroups:b,prepareRow:f})}),n(x,{condition:R.length===0,show:n(x,{condition:(m==null?void 0:m.length)>0,show:l(C1,{children:["No users found matching “",m,"” in this group."]}),elseShow:n(C1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},l5=h("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),d5=({value:e,setValue:t,required:a,roles:r,...o})=>l(Y,{children:[n(ln,{openOnFocus:!0,size:"small",value:e,onChange:(s,c)=>t(c||null),options:r,renderOption:(s,c)=>n("li",{...s,children:l(l5,{children:[n("span",{children:c.name}),n("span",{children:c.description})]})}),getOptionLabel:s=>s.name,renderInput:s=>n(f2,{...s,label:"Role",required:a}),...o}),n(x,{condition:!!e,show:()=>n(ea,{sx:{marginTop:1},roleId:e.id})})]}),u5=h("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),m3=h("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),g3=h("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),p5=h("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),h5=h(d1)(({theme:e})=>({marginLeft:e.spacing(3)})),m5=h("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),g5=h("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),F2=({selected:e,accesses:t,users:a,serviceAccounts:r,groups:o,roles:i})=>{const{uiConfig:s}=b1(),{flags:c}=s,u=c.UG?"user / group":"user",p=K("projectId"),{refetchProjectAccess:m}=$e(p),{addAccessToProject:g,changeUserRole:y,changeGroupRole:_,loading:C}=ut(),b=!!e,{setToastData:R,setToastApiError:f}=u1(),F=I1(),E=[...o.filter(v=>b||!t.some(({entity:{id:w},type:$})=>v.id===w&&$===G.GROUP)).map(v=>({id:v.id,entity:v,type:G.GROUP})),...a.filter(v=>b||!t.some(({entity:{id:w},type:$})=>v.id===w&&$===G.USER)).sort((v,w)=>{const $=v.name||v.username||"",P=w.name||w.username||"";return $.localeCompare(P)}).map(v=>({id:v.id,entity:v,type:G.USER})),...r.filter(v=>b||!t.some(({entity:{id:w},type:$})=>v.id===w&&$===G.SERVICE_ACCOUNT)).sort((v,w)=>{const $=v.name||v.username||"",P=w.name||w.username||"";return $.localeCompare(P)}).map(v=>({id:v.id,entity:v,type:G.SERVICE_ACCOUNT}))],[O,M]=d.useState(()=>E.filter(({id:v,type:w})=>v===(e==null?void 0:e.entity.id)&&w===(e==null?void 0:e.type))),[S,I]=d.useState(i.find(({id:v})=>v===(e==null?void 0:e.entity.roleId))??null),j={users:O==null?void 0:O.filter(({type:v})=>v===G.USER||v===G.SERVICE_ACCOUNT).map(({id:v})=>({id:v})),groups:O==null?void 0:O.filter(({type:v})=>v===G.GROUP).map(({id:v})=>({id:v}))},V=async v=>{if(v.preventDefault(),!!U)try{b?(e==null?void 0:e.type)===G.USER||(e==null?void 0:e.type)===G.SERVICE_ACCOUNT?await y(p,S.id,e.entity.id):(e==null?void 0:e.type)===G.GROUP&&await _(p,S.id,e.entity.id):await g(p,S.id,j),m(),F(M1),R({title:`${O.length} ${O.length===1?"access":"accesses"} ${b?"edited":"assigned"} successfully`,type:"success"})}catch(w){f(m1(w))}},H=()=>b?`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${p}/${(e==null?void 0:e.type)===G.USER||(e==null?void 0:e.type)===G.SERVICE_ACCOUNT?"users":"groups"}/${e==null?void 0:e.entity.id}/roles/${S==null?void 0:S.id}' \\
|
|
3
3
|
--header 'Authorization: INSERT_API_KEY'`:`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${p}/role/${S==null?void 0:S.id}/access' \\
|
|
4
4
|
--header 'Authorization: INSERT_API_KEY' \\
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f$ as lc,g0 as cc,g1 as T4,g2 as E4,g3 as C4,t as m2,r as Wh,j as Po,bW as S4,g4 as A4,g5 as L4,C as B4,A as D4,g6 as I4,g7 as M4}from"./index-
|
|
1
|
+
import{f$ as lc,g0 as cc,g1 as T4,g2 as E4,g3 as C4,t as m2,r as Wh,j as Po,bW as S4,g4 as A4,g5 as L4,C as B4,A as D4,g6 as I4,g7 as M4}from"./index-6d9a536e.js";import{u as N4}from"./stringify-ec884b6d.js";import{u as R4,a as b2}from"./unknownify-e541f268.js";const O4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F4(t){return typeof t=="string"&&O4.test(t)}function P4(t){if(!F4(t))throw TypeError("Invalid UUID");let e;const r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function V4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const Y4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function U4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=V4(n)),typeof s=="string"&&(s=P4(s)),((l=s)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let h=new Uint8Array(16+n.length);if(h.set(s),h.set(n,s.length),h=r(h),h[6]=h[6]&15|e,h[8]=h[8]&63|128,a){o=o||0;for(let u=0;u<16;++u)a[o+u]=h[u];return a}return N4(h)}try{i.name=t}catch{}return i.DNS=Y4,i.URL=z4,i}function W4(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:return e^r^i;case 2:return e&r^e&i^r&i;case 3:return e^r^i}}function eh(t,e){return t<<e|t>>>32-e}function H4(t){const e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){const a=unescape(encodeURIComponent(t));t=[];for(let o=0;o<a.length;++o)t.push(a.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const i=t.length/4+2,n=Math.ceil(i/16),s=new Array(n);for(let a=0;a<n;++a){const o=new Uint32Array(16);for(let l=0;l<16;++l)o[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=o}s[n-1][14]=(t.length-1)*8/Math.pow(2,32),s[n-1][14]=Math.floor(s[n-1][14]),s[n-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<n;++a){const o=new Uint32Array(80);for(let p=0;p<16;++p)o[p]=s[a][p];for(let p=16;p<80;++p)o[p]=eh(o[p-3]^o[p-8]^o[p-14]^o[p-16],1);let l=r[0],h=r[1],u=r[2],f=r[3],d=r[4];for(let p=0;p<80;++p){const m=Math.floor(p/20),b=eh(l,5)+W4(m,h,u,f)+d+e[m]+o[p]>>>0;d=f,f=u,u=eh(h,30)>>>0,h=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+h>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+d>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}const q4=U4("v5",80,H4),G4=q4;function _2(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=Array.from(typeof t=="string"?[t]:t);i[i.length-1]=i[i.length-1].replace(/\r?\n([\t ]*)$/,"");var n=i.reduce(function(o,l){var h=l.match(/\n([\t ]+|(?!\s).)/g);return h?o.concat(h.map(function(u){var f,d;return(d=(f=u.match(/[\t ]/g))===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0})):o},[]);if(n.length){var s=new RegExp(`
|
|
2
2
|
[ ]{`+Math.min.apply(Math,n)+"}","g");i=i.map(function(o){return o.replace(s,`
|
|
3
3
|
`)})}i[0]=i[0].replace(/^\r?\n/,"");var a=i[0];return e.forEach(function(o,l){var h=a.match(/(?:^|\n)( *)$/),u=h?h[1]:"",f=o;typeof o=="string"&&o.includes(`
|
|
4
4
|
`)&&(f=String(o).split(`
|
|
@@ -1270,7 +1270,7 @@ Expecting `+Tt.join(", ")+", got '"+(this.terminals_[Y]||Y)+"'":$="Parse error o
|
|
|
1270
1270
|
`+k+"^"},test_match:function(x,k){var v,B,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),B=x[0].match(/(?:\r\n?|\n).*/g),B&&(this.yylineno+=B.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:B?B[B.length-1].length-B[B.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],v=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var P in R)this[P]=R[P];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,k,v,B;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),P=0;P<R.length;P++)if(v=this._input.match(this.rules[R[P]]),v&&(!k||v[0].length>k[0].length)){if(k=v,B=P,this.options.backtrack_lexer){if(x=this.test_match(v,R[P]),x!==!1)return x;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(x=this.test_match(k,R[B]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
1271
1271
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var k=this.next();return k||this.lex()},begin:function(k){this.conditionStack.push(k)},popState:function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},pushState:function(k){this.begin(k)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(k,v,B,R){switch(B){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:break;case 6:break;case 7:return 11;case 8:break;case 9:break;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};return b}();d.lexer=p;function m(){this.yy={}}return m.prototype=d,d.Parser=m,new m}();e1.parser=e1;const fY=e1,dY=t=>t.match(/^\s*journey/)!==null;let zs="";const T0=[],to=[],eo=[],pY=function(t,e,r){xe.parseDirective(this,t,e,r)},gY=function(){T0.length=0,to.length=0,zs="",eo.length=0,Lr()},yY=function(t){zs=t,T0.push(t)},mY=function(){return T0},bY=function(){let t=l2();const e=100;let r=0;for(;!t&&r<e;)t=l2(),r++;return to.push(...eo),to},_Y=function(){const t=[];return to.forEach(r=>{r.people&&t.push(...r.people)}),[...new Set(t)].sort()},xY=function(t,e){const r=e.substr(1).split(":");let i=0,n=[];r.length===1?(i=Number(r[0]),n=[]):(i=Number(r[0]),n=r[1].split(","));const s=n.map(o=>o.trim()),a={section:zs,type:zs,people:s,task:t,score:i};eo.push(a)},vY=function(t){const e={section:zs,type:zs,description:t,task:t,classes:[]};to.push(e)},l2=function(){const t=function(r){return eo[r].processed};let e=!0;for(const[r,i]of eo.entries())t(r),e=e&&i.processed;return e},kY=function(){return _Y()},c2={parseDirective:pY,getConfig:()=>G().journey,clear:gY,setDiagramTitle:si,getDiagramTitle:ai,setAccTitle:kr,getAccTitle:Br,setAccDescription:Dr,getAccDescription:Ir,addSection:yY,getSections:mY,getTasks:bY,addTask:xY,addTaskOrg:vY,getActors:kY},Xc=function(t,e){const r=t.append("rect");return r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),r.attr("rx",e.rx),r.attr("ry",e.ry),e.class!==void 0&&r.attr("class",e.class),r},wY=function(t,e){const i=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=t.append("g");n.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function s(l){const h=nu().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function a(l){const h=nu().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return e.score>3?s(n):e.score<3?a(n):o(n),i},Z3=function(t,e){const r=t.append("circle");return r.attr("cx",e.cx),r.attr("cy",e.cy),r.attr("class","actor-"+e.pos),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("r",e.r),r.class!==void 0&&r.attr("class",r.class),e.title!==void 0&&r.append("title").text(e.title),r},Q3=function(t,e){const r=e.text.replace(/<br\s*\/?>/gi," "),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.attr("class","legend"),i.style("text-anchor",e.anchor),e.class!==void 0&&i.attr("class",e.class);const n=i.append("tspan");return n.attr("x",e.x+e.textMargin*2),n.text(r),i},TY=function(t,e){function r(n,s,a,o,l){return n+","+s+" "+(n+a)+","+s+" "+(n+a)+","+(s+o-l)+" "+(n+a-l*1.2)+","+(s+o)+" "+n+","+(s+o)}const i=t.append("polygon");i.attr("points",r(e.x,e.y,50,20,7)),i.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,Q3(t,e)},EY=function(t,e,r){const i=t.append("g"),n=E0();n.x=e.x,n.y=e.y,n.fill=e.fill,n.width=r.width,n.height=r.height,n.class="journey-section section-type-"+e.num,n.rx=3,n.ry=3,Xc(i,n),J3(r)(e.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},r,e.colour)};let h2=-1;const CY=function(t,e,r){const i=e.x+r.width/2,n=t.append("g");h2++;const s=300+5*30;n.append("line").attr("id","task"+h2).attr("x1",i).attr("y1",e.y).attr("x2",i).attr("y2",s).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),wY(n,{cx:i,cy:300+(5-e.score)*30,score:e.score});const a=E0();a.x=e.x,a.y=e.y,a.fill=e.fill,a.width=r.width,a.height=r.height,a.class="task task-type-"+e.num,a.rx=3,a.ry=3,Xc(n,a);let o=e.x+14;e.people.forEach(l=>{const h=e.actors[l].color,u={cx:o,cy:e.y,r:7,fill:h,stroke:"#000",title:l,pos:e.actors[l].position};Z3(n,u),o+=10}),J3(r)(e.task,n,a.x,a.y,a.width,a.height,{class:"task"},r,e.colour)},SY=function(t,e){Xc(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},AY=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},E0=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},J3=function(){function t(n,s,a,o,l,h,u,f){const d=s.append("text").attr("x",a+l/2).attr("y",o+h/2+5).style("font-color",f).style("text-anchor","middle").text(n);i(d,u)}function e(n,s,a,o,l,h,u,f,d){const{taskFontSize:p,taskFontFamily:m}=f,b=n.split(/<br\s*\/?>/gi);for(let x=0;x<b.length;x++){const k=x*p-p*(b.length-1)/2,v=s.append("text").attr("x",a+l/2).attr("y",o).attr("fill",d).style("text-anchor","middle").style("font-size",p).style("font-family",m);v.append("tspan").attr("x",a+l/2).attr("dy",k).text(b[x]),v.attr("y",o+h/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(v,u)}}function r(n,s,a,o,l,h,u,f){const d=s.append("switch"),m=d.append("foreignObject").attr("x",a).attr("y",o).attr("width",l).attr("height",h).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");m.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(n),e(n,d,a,o,l,h,u,f),i(m,u)}function i(n,s){for(const a in s)a in s&&n.attr(a,s[a])}return function(n){return n.textPlacement==="fo"?r:n.textPlacement==="old"?t:e}}(),LY=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},ro={drawRect:Xc,drawCircle:Z3,drawSection:EY,drawText:Q3,drawLabel:TY,drawTask:CY,drawBackgroundRect:SY,getTextObj:AY,getNoteRect:E0,initGraphics:LY},BY=function(t){Object.keys(t).forEach(function(r){Kc[r]=t[r]})},Ui={};function DY(t){const e=G().journey;let r=60;Object.keys(Ui).forEach(i=>{const n=Ui[i].color,s={cx:20,cy:r,r:7,fill:n,stroke:"#000",pos:Ui[i].position};ro.drawCircle(t,s);const a={x:40,y:r+7,fill:"#666",text:i,textMargin:e.boxTextMargin|5};ro.drawText(t,a),r+=20})}const Kc=G().journey,Sn=Kc.leftMargin,IY=function(t,e,r,i){const n=G().journey;i.db.clear(),i.parser.parse(t+`
|
|
1272
1272
|
`);const s=G().securityLevel;let a;s==="sandbox"&&(a=_t("#i"+e));const o=_t(s==="sandbox"?a.nodes()[0].contentDocument.body:"body");Pr.init();const l=o.select("#"+e);ro.initGraphics(l);const h=i.db.getTasks(),u=i.db.getDiagramTitle(),f=i.db.getActors();for(const k in Ui)delete Ui[k];let d=0;f.forEach(k=>{Ui[k]={color:n.actorColours[d%n.actorColours.length],position:d},d++}),DY(l),Pr.insert(0,0,Sn,Object.keys(Ui).length*50),MY(l,h,0);const p=Pr.getBounds();u&&l.append("text").text(u).attr("x",Sn).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const m=p.stopy-p.starty+2*n.diagramMarginY,b=Sn+p.stopx+2*n.diagramMarginX;ni(l,m,b,n.useMaxWidth),l.append("line").attr("x1",Sn).attr("y1",n.height*4).attr("x2",b-Sn-4).attr("y2",n.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const x=u?70:0;l.attr("viewBox",`${p.startx} -25 ${b} ${m+x}`),l.attr("preserveAspectRatio","xMinYMin meet"),l.attr("height",m+x+25)},Pr={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,r,i){t[e]===void 0?t[e]=r:t[e]=i(r,t[e])},updateBounds:function(t,e,r,i){const n=G().journey,s=this;let a=0;function o(l){return function(u){a++;const f=s.sequenceItems.length-a+1;s.updateVal(u,"starty",e-f*n.boxMargin,Math.min),s.updateVal(u,"stopy",i+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"startx",t-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopx",r+f*n.boxMargin,Math.max),l!=="activation"&&(s.updateVal(u,"startx",t-f*n.boxMargin,Math.min),s.updateVal(u,"stopx",r+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"starty",e-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopy",i+f*n.boxMargin,Math.max))}}this.sequenceItems.forEach(o())},insert:function(t,e,r,i){const n=Math.min(t,r),s=Math.max(t,r),a=Math.min(e,i),o=Math.max(e,i);this.updateVal(Pr.data,"startx",n,Math.min),this.updateVal(Pr.data,"starty",a,Math.min),this.updateVal(Pr.data,"stopx",s,Math.max),this.updateVal(Pr.data,"stopy",o,Math.max),this.updateBounds(n,a,s,o)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},zh=Kc.sectionFills,u2=Kc.sectionColours,MY=function(t,e,r){const i=G().journey;let n="";const s=i.height*2+i.diagramMarginY,a=r+s;let o=0,l="#CCC",h="black",u=0;for(const[f,d]of e.entries()){if(n!==d.section){l=zh[o%zh.length],u=o%zh.length,h=u2[o%u2.length];const m={x:f*i.taskMargin+f*i.width+Sn,y:50,text:d.section,fill:l,num:u,colour:h};ro.drawSection(t,m,i),n=d.section,o++}const p=d.people.reduce((m,b)=>(Ui[b]&&(m[b]=Ui[b]),m),{});d.x=f*i.taskMargin+f*i.width+Sn,d.y=a,d.width=i.diagramMarginX,d.height=i.diagramMarginY,d.colour=h,d.fill=l,d.num=u,d.actors=p,ro.drawTask(t,d,i),Pr.insert(d.x,d.y,d.x+d.width+i.taskMargin,300+5*30)}},f2={setConf:BY,draw:IY};let d2={};const NY=function(t){d2={...d2,...t}},RY=(t,e,r)=>{try{I.debug(`Renering svg for syntax error
|
|
1273
|
-
`);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-
|
|
1273
|
+
`);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-3edd9f6d.js");return{id:t4,diagram:t}},PY={id:t4,detector:OY,loader:FY},VY=PY,e4="timeline",YY=t=>t.match(/^\s*timeline/)!==null,zY=async()=>{const{diagram:t}=await import("./timeline-definition-8e5a9bc6-d80977bf.js");return{id:e4,diagram:t}},UY={id:e4,detector:YY,loader:zY},WY=UY,r4="mindmap",HY=t=>t.match(/^\s*mindmap/)!==null,qY=async()=>{const{diagram:t}=await import("./mindmap-definition-44684416-d564c247.js");return{id:r4,diagram:t}},GY={id:r4,detector:HY,loader:qY},$Y=GY;let p2=!1;const _o=()=>{p2||(p2=!0,oy(VY,WY,$Y),Ye("error",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},t=>t.toLowerCase().trim()==="error"),Ye("---",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},t=>t.toLowerCase().trimStart().startsWith("---")),Ye("c4",{parser:GI,db:Fy,renderer:Nd,styles:Cy,init:t=>{Nd.setConf(t.c4)}},$I),Ye("class",{parser:Rd,db:fs,renderer:yN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},VM),Ye("classDiagram",{parser:Rd,db:fs,renderer:LR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("er",{parser:BR,db:YR,renderer:QR,styles:_y},DR),Ye("gantt",{parser:bO,db:g0,renderer:JO,styles:xy},_O),Ye("info",{parser:tF,db:sF,renderer:oF,styles:vy},lF),Ye("pie",{parser:cF,db:bF,renderer:xF,styles:ky},hF),Ye("requirement",{parser:vF,db:zF,renderer:KF,styles:wy},kF),Ye("sequence",{parser:ZF,db:Qd,renderer:t2,styles:Ty,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");Qd.setWrap(t.wrap),t2.setConf(t.sequence)}},QF),Ye("state",{parser:e2,db:Ri,renderer:zV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},QP),Ye("stateDiagram",{parser:e2,db:Ri,renderer:uY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("journey",{parser:fY,db:c2,renderer:f2,styles:Ey,init:t=>{f2.setConf(t.journey),c2.clear()}},dY),Ye("flowchart",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,pO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},JR),Ye("flowchart-v2",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},tO),Ye("gitGraph",{parser:gI,db:RI,renderer:WI,styles:qI},yI))};class r1{constructor(e,r){var i,n;this.txt=e,this.type="graph",this.detectTypeFailed=!1;const s=G();this.txt=e;try{this.type=W1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=Ly(this.type);I.debug("Type "+this.type),this.db=a.db,(n=(i=this.db).clear)==null||n.call(i),this.renderer=a.renderer,this.parser=a.parser;const o=this.parser.parse.bind(this.parser);this.parser.parse=l=>o(bD(l,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(s),I.info("Initialized diagram "+this.type,s)),this.txt+=`
|
|
1274
1274
|
`,this.parse(this.txt,r)}parse(e,r){var i,n;if(this.detectTypeFailed)return!1;try{return e=e+`
|
|
1275
1275
|
`,(n=(i=this.db).clear)==null||n.call(i),this.parser.parse(e),!0}catch(s){this.handleError(s,r)}return!1}handleError(e,r){if(r===void 0)throw e;if(q1(e)){r(e.str,e.hash);return}r(e)}getParser(){return this.parser}getType(){return this.type}}const C0=(t,e)=>{const r=W1(t,G());try{Ly(r)}catch{const n=vD(r);if(!n)throw new Error(`Diagram ${r} not found.`);return n().then(({diagram:s})=>(Ye(r,s,void 0),new r1(t,e)))}return new r1(t,e)},S0=r1,jY="graphics-document document";function XY(t,e){t.attr("role",jY),bs(e)||t.attr("aria-roledescription",e)}function KY(t,e,r,i){if(t.insert!==void 0)if(e||r){if(r){const n="chart-desc-"+i;t.attr("aria-describedby",n),t.insert("desc",":first-child").attr("id",n).text(r)}if(e){const n="chart-title-"+i;t.attr("aria-labelledby",n),t.insert("title",":first-child").attr("id",n).text(e)}}else return}const A0=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],i4="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",n4="sandbox",s4="loose",ZY="http://www.w3.org/2000/svg",a4="http://www.w3.org/1999/xlink",o4="http://www.w3.org/1999/xhtml",QY="100%",JY="100%",tz="border:0;margin:0;",ez="margin:0",rz="allow-top-navigation-by-user-activation allow-popups",iz='The "iframe" tag is not supported by your browser.',l4=["foreignobject"],c4=["dominant-baseline"];function nz(t,e){return _o(),new S0(t,e).parse(t,e)}async function sz(t,e){return _o(),(await C0(t,e)).parse(t,e)}const h4=function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"fl°°"+i+"¶ß":"fl°"+i+"¶ß"}),e},L0=function(t){let e=t;return e=e.replace(/fl°°/g,"&#"),e=e.replace(/fl°/g,"&"),e=e.replace(/¶ß/g,";"),e},g2=(t,e,r=[])=>`
|
|
1276
1276
|
.${t} ${e} { ${r.join(" !important; ")} !important; }`,az=(t,e,r={})=>{var i;let n="";if(t.themeCSS!==void 0&&(n+=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bK as k,b as v,r as d,bW as w,j as s,C as P,A as S,f_ as u}from"./index-
|
|
1
|
+
var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bK as k,b as v,r as d,bW as w,j as s,C as P,A as S,f_ as u}from"./index-6d9a536e.js";import{u as T,a as g}from"./unknownify-e541f268.js";import{L as A,C as I,a as M,b as L,P as N,c as R,T as _,p as q,e as D,f as E}from"./chartjs-adapter-date-fns.esm-d78073b7.js";import{B as W}from"./RoleCell-86b02c95.js";import"./index-1023a005.js";import"./index-4f1029d3.js";class j{constructor(e){o(this,"current",0);o(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],B=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),H=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:r=>u(1e3*r[0].parsed.x,e.locale)},itemSort:(r,i)=>i.parsed.y-r.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(r,i,a)=>u(a[i].value*1e3,e.locale)}}}});class ${constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new j(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const z=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new $([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((a,y)=>{var c,p;const n=g((c=a.metric)==null?void 0:c.endpoint),b=g((p=a.metric)==null?void 0:p.appName),l=i.pick(n),h=a.values||[];return{label:`${n}: ${b}`,borderColor:l.main,backgroundColor:l.main,data:B(h,x=>parseFloat(x)),elements:{point:{radius:4,pointStyle:m[y%m.length]},line:{borderDash:[8,4]}}}})}return[]},V=()=>{const{locationSettings:t}=k(),{metrics:e}=T(),r=v(),i=d.useMemo(()=>H(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:z(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s(W,{sx:{display:"grid",gap:4},children:s("div",{style:{height:400},children:s(A,{data:a,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};I.register(M,L,N,R,_,q,D,E);export{V as NetworkTraffic,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as D,u as V,a as M,r as d,b as $,d as I,j as t,L as U,e as A,f as w,s as G,H as O,g as q,h as P,F as J,B as C,T as z,S as Q,C as j,i as N,k as K,V as X,l as Y,m as Z,n as W,P as _,o as ee,p as te,q as ae}from"./index-
|
|
1
|
+
import{c as D,u as V,a as M,r as d,b as $,d as I,j as t,L as U,e as A,f as w,s as G,H as O,g as q,h as P,F as J,B as C,T as z,S as Q,C as j,i as N,k as K,V as X,l as Y,m as Z,n as W,P as _,o as ee,p as te,q as ae}from"./index-6d9a536e.js";import{V as se,F as re,a as oe,u as ne,r as le,b as ie,P as ce,c as de,d as ue,e as he}from"./PlaygroundGuidancePopper-de0c6f7c.js";import"./StrategyItemContainer-cada0ab5.js";import"./Error-cf795e47.js";const me={id:"name"},{value:B,setValue:pe}=D("PlaygroundResultsTable:v1",me),fe=({features:f,input:m,loading:o})=>{const[u,b]=V(),h=M(o),[s,S]=d.useState(u.get("search")||""),x=$(),i=I(x.breakpoints.down("sm")),E=I(x.breakpoints.down("md")),g=d.useMemo(()=>[{Header:"Name",accessor:"name",searchable:!0,minWidth:160,Cell:({value:e,row:{original:a}})=>t(U,{title:e,to:`/projects/${a==null?void 0:a.projectId}/features/${e}`})},{Header:"Project ID",accessor:"projectId",sortType:"alphanumeric",filterName:"projectId",searchable:!0,maxWidth:170,Cell:({value:e})=>t(U,{title:e,to:`/projects/${e}`})},{Header:"Variant",id:"variant",accessor:"variant.name",sortType:"alphanumeric",filterName:"variant",searchable:!0,maxWidth:200,Cell:({value:e,row:{original:{variant:a,feature:l,variants:y,isEnabled:L}}})=>t(se,{variant:a!=null&&a.enabled?e:"",variants:y,feature:l,isEnabled:L})},{id:"isEnabled",Header:"isEnabled",filterName:"isEnabled",accessor:e=>{var a;return e!=null&&e.isEnabled?"true":((a=e==null?void 0:e.strategies)==null?void 0:a.result)==="unknown"?"unknown":"false"},Cell:({row:e})=>t(re,{feature:e.original}),sortType:"playgroundResultState",maxWidth:120,sortInverted:!0},{Header:"",maxWidth:70,id:"info",Cell:({row:e})=>t(oe,{feature:e.original,input:m})}],[m]),{data:c,getSearchText:F,getSearchContext:T}=A(g,s,f||[]),n=d.useMemo(()=>o?Array(5).fill({name:"Feature name",projectId:"FeatureProject",variant:{name:"FeatureVariant",variants:[]},enabled:!0}):c,[c,o]),[R]=d.useState(()=>({sortBy:[{id:u.get("sort")||B.id,desc:u.has("order")?u.get("order")==="desc":B.desc}]})),{headerGroups:k,rows:v,state:{sortBy:p},prepareRow:H,setHiddenColumns:r}=w.useTable({initialState:R,columns:g,data:n,sortTypes:G,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:O}},w.useGlobalFilter,w.useFlexLayout,w.useSortBy);return q([{condition:i,columns:["variant"]},{condition:E,columns:["projectId"]}],r,g),d.useEffect(()=>{if(o)return;const e=Object.fromEntries(u);e.sort=p[0].id,p[0].desc?e.order="desc":e.order&&delete e.order,s?e.search=s:delete e.search,b(e,{replace:!0}),pe({id:p[0].id,desc:p[0].desc||!1})},[o,p,s]),P(J,{children:[P(C,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[t(z,{variant:"subtitle1",sx:{ml:1},children:f!==void 0&&!o?`Results (${v.length<n.length?`${v.length} of ${n.length}`:n.length})`:"Results"}),t(Q,{initialValue:s,onChange:S,hasFilters:!0,getSearchContext:T,disabled:o,containerStyles:{marginLeft:"1rem",maxWidth:"400px"}})]}),t(j,{condition:!o&&!n,show:()=>t(N,{children:n===void 0?"None of the feature toggles were evaluated yet.":"No results found."}),elseShow:()=>P(C,{ref:h,children:[t(K,{value:F(s),children:t(X,{rows:v,headerGroups:k,prepareRow:H})}),t(j,{condition:n.length===0&&(s==null?void 0:s.length)>0,show:P(N,{children:["No feature toggles found matching “",s,"”"]})}),t(j,{condition:n&&n.length===0&&!s,show:t(N,{children:"No features toggles to display"})})]})})]})},xe=()=>{const{environments:f}=Y(),m=$(),o=I(m.breakpoints.down("lg")),[u,b]=d.useState([]),[h,s]=d.useState([]),[S,x]=d.useState(),[i,E]=d.useState(),{setToastData:g}=Z(),[c,F]=V(),{evaluatePlayground:T,loading:n}=ne();d.useEffect(()=>{b([le(f)])},[JSON.stringify(f)]),d.useEffect(()=>{try{const r=c.get("environment");r&&b([r]);let e,a=c.get("projects");a&&(e=a.split(","),s(e));let l=c.get("context");l&&(l=decodeURI(l),x(l)),(async()=>{r&&l&&await R(r,e||"*",l)})()}catch(r){g({type:"error",title:`Failed to parse URL parameters: ${W(r)}`})}},[]);const R=async(r,e,a,l)=>{try{const y=JSON.parse(a||"{}"),L=await T({environment:r,projects:ie(e),context:{appName:"playground",...y}});l&&typeof l=="function"&&l(),E(L)}catch(y){g({type:"error",title:`Error parsing context: ${W(y)}`})}},k=async r=>{r.preventDefault(),await R(u[0],h,S,v)},v=()=>{c.set("context",encodeURI(S||"")),c.set("environment",u[0]),Array.isArray(h)&&h.length>0&&!(h.length===1&&h[0]==="*")?c.set("projects",h.join(",")):c.delete("projects"),F(c)},p=i&&!o?"35%":"auto",H=he(o,i);return t(_,{header:t(ee,{title:"Unleash playground",actions:t(ce,{})}),disableLoading:!0,bodyClass:"no-padding",children:P(C,{sx:{display:"flex",flexDirection:o?"column":"row"},children:[t(C,{sx:{background:m.palette.background.elevation2,borderBottomLeftRadius:m.shape.borderRadiusMedium},children:t(te,{elevation:0,sx:{px:4,py:3,mb:4,mt:2,background:m.palette.background.elevation2,transition:"width 0.4s ease",minWidth:o?"auto":"500px",width:p,position:"sticky",top:0},children:t(de,{onSubmit:k,context:S,setContext:x,availableEnvironments:f,projects:h,environments:u,setProjects:s,setEnvironments:b})})}),t(C,{sx:r=>({width:H,transition:"width 0.4s ease",padding:r.spacing(4,2)}),children:t(j,{condition:n,show:t(ae,{}),elseShow:t(j,{condition:!!i,show:t(fe,{loading:n,features:i==null?void 0:i.features,input:i==null?void 0:i.input}),elseShow:t(ue,{})})})})]})})};export{xe as Playground,xe as default};
|