unleash-server 5.6.0 → 5.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
  2. package/dist/lib/features/feature-toggle/feature-toggle-service.js +0 -12
  3. package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
  4. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.d.ts.map +1 -1
  5. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js +3 -1
  6. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js.map +1 -1
  7. package/dist/lib/features/feature-toggle/tests/feature-toggle-last-seen-at.e2e.test.js +29 -0
  8. package/dist/lib/features/feature-toggle/tests/feature-toggle-last-seen-at.e2e.test.js.map +1 -1
  9. package/dist/lib/features/private-project/privateProjectStore.js +2 -2
  10. package/dist/lib/features/private-project/privateProjectStore.js.map +1 -1
  11. package/dist/lib/features/segment/segment-controller.d.ts.map +1 -1
  12. package/dist/lib/features/segment/segment-controller.js +2 -3
  13. package/dist/lib/features/segment/segment-controller.js.map +1 -1
  14. package/dist/lib/segments/segment-service-interface.d.ts +7 -1
  15. package/dist/lib/segments/segment-service-interface.d.ts.map +1 -1
  16. package/dist/lib/services/segment-service.d.ts +2 -1
  17. package/dist/lib/services/segment-service.d.ts.map +1 -1
  18. package/dist/lib/services/segment-service.js +6 -4
  19. package/dist/lib/services/segment-service.js.map +1 -1
  20. package/dist/lib/types/experimental.d.ts +1 -1
  21. package/dist/lib/types/experimental.d.ts.map +1 -1
  22. package/dist/lib/types/experimental.js +0 -1
  23. package/dist/lib/types/experimental.js.map +1 -1
  24. package/dist/migrations/20231004120900-create-changes-stats-table-and-trigger.js +2 -2
  25. package/dist/server-dev.js +0 -1
  26. package/dist/server-dev.js.map +1 -1
  27. package/dist/test/e2e/helpers/test-helper.d.ts.map +1 -1
  28. package/dist/test/e2e/helpers/test-helper.js +8 -2
  29. package/dist/test/e2e/helpers/test-helper.js.map +1 -1
  30. package/frontend/build/index.html +1 -1
  31. package/frontend/build/static/{AdvancedPlayground-83369892.js → AdvancedPlayground-b7bccfbe.js} +1 -1
  32. package/frontend/build/static/{CreateProject-be345ba6.js → CreateProject-556f9c57.js} +1 -1
  33. package/frontend/build/static/{Error-4004f50f.js → Error-db0d1d33.js} +1 -1
  34. package/frontend/build/static/{FeatureArchiveDialog-0449c522.js → FeatureArchiveDialog-9165a49c.js} +1 -1
  35. package/frontend/build/static/{FeatureMetricsChart-24ad4d71.js → FeatureMetricsChart-c575d046.js} +1 -1
  36. package/frontend/build/static/{FeatureViewLazyExport-397aadc2.js → FeatureViewLazyExport-e2d57dd1.js} +2 -2
  37. package/frontend/build/static/{LazyAdminExport-4e6e4e1f.js → LazyAdminExport-d83c093e.js} +15 -15
  38. package/frontend/build/static/{LazyProjectExport-e3f9f7ab.js → LazyProjectExport-9d441d13.js} +1 -1
  39. package/frontend/build/static/{NetworkOverview-7fb4bd20.js → NetworkOverview-0d48bf0d.js} +2 -2
  40. package/frontend/build/static/{NetworkTraffic-aa2ac309.js → NetworkTraffic-0aa8a7ac.js} +1 -1
  41. package/frontend/build/static/{ReactJSONEditor-deab371a.js → ReactJSONEditor-693b261e.js} +1 -1
  42. package/frontend/build/static/{RoleCell-fdb157bb.js → RoleCell-900af983.js} +1 -1
  43. package/frontend/build/static/{StrategyItemContainer-f7d370e4.js → StrategyItemContainer-ec516690.js} +1 -1
  44. package/frontend/build/static/{chartjs-adapter-date-fns.esm-60e47456.js → chartjs-adapter-date-fns.esm-9887b8bf.js} +1 -1
  45. package/frontend/build/static/{flowchart-elk-definition-170a3958-3ee04194.js → flowchart-elk-definition-170a3958-44f11932.js} +1 -1
  46. package/frontend/build/static/{index-749ce17d.js → index-97019f83.js} +3 -3
  47. package/frontend/build/static/{is_dark-d5faa57f.js → is_dark-bae6928c.js} +1 -1
  48. package/frontend/build/static/{mindmap-definition-44684416-79315733.js → mindmap-definition-44684416-9154286a.js} +1 -1
  49. package/frontend/build/static/{timeline-definition-8e5a9bc6-0b2af611.js → timeline-definition-8e5a9bc6-6cd8c6b1.js} +1 -1
  50. package/frontend/build/static/{unknownify-efd92e6b.js → unknownify-470ee1ff.js} +1 -1
  51. package/frontend/build/static/{useApiTokens-96bce8a7.js → useApiTokens-9215ec27.js} +1 -1
  52. package/frontend/build/static/{useProjectForm-2e1738ba.js → useProjectForm-5dd2ec50.js} +1 -1
  53. package/package.json +1 -2
  54. package/dist/lib/features/feature-toggle/deep-diff.d.ts +0 -9
  55. package/dist/lib/features/feature-toggle/deep-diff.d.ts.map +0 -1
  56. package/dist/lib/features/feature-toggle/deep-diff.js +0 -62
  57. package/dist/lib/features/feature-toggle/deep-diff.js.map +0 -1
  58. package/dist/lib/features/feature-toggle/tests/deep-diff.test.d.ts +0 -2
  59. package/dist/lib/features/feature-toggle/tests/deep-diff.test.d.ts.map +0 -1
  60. package/dist/lib/features/feature-toggle/tests/deep-diff.test.js +0 -74
  61. package/dist/lib/features/feature-toggle/tests/deep-diff.test.js.map +0 -1
@@ -312,7 +312,7 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
312
312
  --header 'Authorization: INSERT_API_KEY' \\
313
313
  --header 'Content-Type: application/json' \\
314
314
  --data-raw '${JSON.stringify(m(),void 0,2)}'`,children:s(JM,{handleSubmit:async w=>{w.preventDefault();try{await i(r,m()),f(),a("/environments"),t({type:"success",title:"Successfully updated environment."})}catch(C){n(vt(C))}},handleCancel:()=>{a(Oo)},name:l,type:c,setName:u,setType:d,mode:"Edit",errors:p,clearErrors:h,children:s(Vd,{permission:mi})})})},Q1=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0}),o="api/admin/context";return{createContext:async u=>{const p=t(o,{method:"POST",body:JSON.stringify(u)});return e(p.caller,p.id)},validateContextName:async u=>{const d=`${o}/validate`,p=t(d,{method:"POST",body:JSON.stringify({name:u})});return e(p.caller,p.id)},updateContext:async u=>{const d=`${o}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});return e(p.caller,p.id)},removeContext:async u=>{const d=`${o}/${u}`,p=t(d,{method:"DELETE"});return e(p.caller,p.id)},errors:n,loading:r}},rCe=(e,t={})=>{const n=async()=>{const u=wt(`api/admin/context/${e}`);return fetch(u,{method:"GET"}).then(fn("Context data")).then(d=>d.json())},r=`api/admin/context/${e}`,{data:o,error:i}=An(r,n,{...t}),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{context:o||{name:"",description:"",legalValues:[],stickiness:!1},error:i,loading:a,refetch:c,FEATURE_CACHE_KEY:r}},oCe=S("li")(({theme:e})=>({display:"grid",lineHeight:1.25,gridTemplateColumns:"1fr auto",alignSelf:"start",alignItems:"start",gap:e.spacing(1),padding:e.spacing(1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,wordBreak:"break-word"})),iCe=S("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),aCe=S("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),sCe=S("button")(({theme:e})=>({all:"unset",lineHeight:.1,paddingTop:"1px",display:"block",cursor:"pointer","& svg":{fontSize:e.fontSizes.bodySize,opacity:.5},"&:hover svg, &:focus-visible svg":{opacity:.75}})),lCe=({label:e,description:t,onRemove:n})=>x(oCe,{children:[x("div",{children:[s(iCe,{children:e}),s(V,{condition:!!t,show:()=>s(aCe,{children:t})})]}),s(sCe,{onClick:n,children:s(wce,{titleAccess:"Remove"})})]}),cCe=S("ul")(({theme:e})=>({listStyleType:"none",display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:0,margin:0,marginBottom:"1rem !important"})),uCe=cCe,dCe=({strategyDefinition:e})=>s("p",{children:e==null?void 0:e.description}),pCe=zae(_oe,e=>({root:{height:8},thumb:{height:24,width:24,backgroundColor:e.palette.background.paper,border:"2px solid currentColor"},active:{},valueLabel:{},track:{height:8,borderRadius:e.shape.borderRadius},rail:{height:8,borderRadius:e.shape.borderRadius}})),fCe=Ns()(e=>({slider:{width:"100%",maxWidth:"100%"},margin:{height:e.spacing(3)}})),hCe=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}],QM=({name:e,value:t,onChange:n,disabled:r=!1})=>{const{classes:o}=fCe(),i=a=>`${a}%`;return x("div",{className:o.slider,children:[s(re,{id:"discrete-slider-always",variant:"h3",gutterBottom:!0,component:"h3",children:e}),s(pCe,{min:0,max:100,value:t,getAriaValueText:i,"aria-labelledby":"discrete-slider-always",step:1,"data-testid":gse,marks:hCe,onChange:n,valueLabelDisplay:"on",disabled:r})]})},Nf=e=>{const t=Number(pl(e));return Number.isFinite(t)?t:0},pl=e=>String(e??"").trim(),Zs=e=>pl(e).split(",").map(t=>t.trim()).filter(Boolean),Z1=({name:e,value:t="",label:n="",options:r,onChange:o,id:i,disabled:a=!1,className:l,classes:c,...u})=>x($s,{variant:"outlined",size:"small",classes:c,children:[s(Qh,{htmlFor:i,children:n}),s(Zh,{name:e,disabled:a,onChange:o,className:l,label:n,id:i,value:t,...u,children:(()=>r.map(p=>s(sa,{value:p.key,title:p.title||"","data-testid":`${WL}-${p.label}`,children:p.label},p.key)))()})]}),ma=(e={revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0})=>{const t=()=>{const l=wt("api/admin/context");return fetch(l,{method:"GET"}).then(fn("Context variables")).then(c=>c.json())},n="api/admin/context",{data:r,mutate:o,error:i,isValidating:a}=An(n,t,e);return{context:r||[],error:i,loading:a&&!i&&!r,refetchUnleashContext:o}},gCe="random",mCe="default",yCe=({label:e,editable:t,value:n,onChange:r,dataTestId:o})=>{const{context:i}=ma(),a=on(),c=(()=>{const u=i.filter(d=>d.stickiness).map(d=>({key:d.name,label:d.name}));return!u.find(d=>d.key==="default")&&!i.find(d=>d.name===mCe)&&u.push({key:"default",label:"default"}),!u.find(d=>d.key==="random")&&!i.find(d=>d.name===gCe)&&u.push({key:"random",label:"random"}),n&&!u.find(d=>d.key===n)&&u.push({key:n,label:n}),u})();return s(Z1,{id:"stickiness-select",name:"stickiness",label:e,options:c,value:n,disabled:!t,"data-testid":o,onChange:r,style:{width:"inherit",minWidth:"100%",marginBottom:a.spacing(2)}})},vCe="default",bCe=e=>{const{project:t,loading:n,error:r}=ig(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:vCe,mode:t.mode,loading:n,error:r}},SCe=({updateParameter:e,parameters:t,editable:n=!0})=>{const r=br("projectId"),{defaultStickiness:o,loading:i}=bCe(r),{pathname:a}=bo(),l=a.includes("default-strategy"),c=h=>f=>{e(h,f)},u=(h,f)=>{e("rollout",f.toString())},d=t.rollout!==void 0?Nf(t.rollout):100,p=g.useMemo(()=>t.stickiness===""&&!i?o:pl(t.stickiness),[i,t.stickiness]);return t.stickiness===""&&c("stickiness")(p),g.useEffect(()=>{l&&!t.groupId&&c("groupId")("")},[l]),i?s(xh,{}):x("div",{children:[s(QM,{name:"Rollout",value:d,disabled:!n,onChange:u}),s("br",{}),x("div",{children:[x(re,{variant:"subtitle2",style:{marginBottom:"1rem",display:"flex",gap:"1ch"},component:"h2",children:["Stickiness",s(Rs,{tooltip:"Stickiness defines what parameter should be used to ensure that your users get consistency in features. By default unleash will use the first value present in the context in the order of userId, sessionId and random."})]}),s(yCe,{label:"Stickiness",value:p,editable:n,dataTestId:yse,onChange:h=>c("stickiness")(h.target.value)})," ",s("br",{}),s("br",{}),x(re,{variant:"subtitle2",style:{marginBottom:"1rem",display:"flex",gap:"1ch"},component:"h2",children:["GroupId",s(Rs,{tooltip:"GroupId is used to ensure that different toggles will hash differently for the same user. The groupId defaults to feature toggle name, but you can override it to correlate rollout of multiple feature toggles."})]}),s(cr,{label:"groupId",id:"groupId-input",value:pl(t.groupId),disabled:!n,onChange:h=>c("groupId")(h.target.value),"data-testid":vse})]})]})},Pa=({text:e,maxWidth:t,maxLength:n,className:r,...o})=>s(V,{condition:((e==null?void 0:e.length)??0)>n,show:s(yt,{title:e,arrow:!0,children:s("span",{"data-loading":!0,className:r,style:{maxWidth:`${t}px`,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},...o,children:e})}),elseShow:s("span",{className:r,children:e})}),wCe=S("div")(({theme:e})=>({display:"grid",gap:e.spacing(1)})),xCe=S("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),CCe=S("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start"})),ZM=({name:e,list:t,setConfig:n,disabled:r,errors:o})=>{const[i,a]=g.useState(""),l="Enter",c=f=>{d(f)},u=f=>{(f==null?void 0:f.key)===l&&(d(f),f.preventDefault(),f.stopPropagation())},d=f=>{f.preventDefault();const m=f.target.value;if(m){const y=m.split(/,\s*/).filter(b=>!t.includes(b));if(y.length>0){const b=t.concat(y).filter(v=>v);n(e,b.join(","))}a("")}},p=f=>{t[f]=null,n(e,t.length===1?"":t.filter(Boolean).join(","))},h=f=>{a(f.currentTarget.value)};return x(wCe,{children:[x(re,{variant:"subtitle2",component:"h2",children:["List of ",e]}),s(V,{condition:t.length>0,show:s(xCe,{children:t.map((f,m)=>s(Os,{label:s(Pa,{maxWidth:"300",text:f,maxLength:50}),onDelete:r?void 0:()=>p(m),title:"Remove value"},m+f))})}),s(V,{condition:!r,show:x(CCe,{children:[s(vn,{error:!!o.getFormError(e),helperText:o.getFormError(e),name:"input_field",variant:"outlined",label:"Add items",id:"input-add-items",value:i,size:"small",placeholder:"",onBlur:c,onChange:h,onKeyDown:u,"data-testid":bse}),s(Ve,{onClick:d,"data-testid":Sse,variant:"outlined",color:"secondary",startIcon:s(fa,{}),children:"Add"})]})})]})},ECe=({editable:e,parameters:t,updateParameter:n,errors:r})=>s("div",{children:s(ZM,{name:"userIds",list:Zs(t.userIds),disabled:!e,setConfig:n,errors:r})}),Fp=({text:e})=>e?s(ye,{sx:t=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1)}),children:e}):null,TCe=({definition:e,parameters:t,updateParameter:n,editable:r,errors:o})=>{const{type:i,name:a,description:l,required:c}=e,u=t[a],d=o.getFormError(a),p=c?`${a} * `:a,h=v=>{n(a,v.target.value)},f=v=>{n(a,pl(v.target.value))},m=(v,w)=>{n(a,w.toString())},y=(v,w)=>{n(a,String(w))},b=(v,w)=>{n(v,Zs(w).join(","))};if(i==="percentage")return x("div",{children:[s(QM,{name:a,onChange:m,disabled:!r,value:Nf(t[a]),minLabel:"off",maxLabel:"on"}),s(Fp,{text:l})]});if(i==="list")return x("div",{children:[s(ZM,{name:a,list:Zs(t[a]),disabled:!r,setConfig:b,errors:o}),s(Fp,{text:l})]});if(i==="number")return x("div",{children:[s(vn,{error:!!d,helperText:d,variant:"outlined",size:"small","aria-required":c,style:{width:"100%"},disabled:!r,label:p,onChange:h,value:u}),s(Fp,{text:l})]});if(i==="boolean"){const w=pl(t[a])==="true";return x("div",{children:[s(Gr,{label:a,control:s(pa,{name:a,onChange:y,checked:w})}),s(Fp,{text:l})]})}return x("div",{children:[s(vn,{rows:1,placeholder:"",variant:"outlined",size:"small",style:{width:"100%"},"aria-required":c,disabled:!r,error:!!d,helperText:d,name:a,label:p,onChange:f,value:pl(t[a])}),s(Fp,{text:l})]})},kCe=Bc("div")(({theme:e})=>({display:"grid",gap:e.spacing(4)})),ACe=({parameters:e,strategyDefinition:t,updateParameter:n,editable:r,errors:o})=>!t||t.parameters.length===0?null:s(kCe,{children:t.parameters.map((i,a)=>s("div",{children:s(TCe,{definition:i,parameters:e,updateParameter:n,editable:r,errors:o})},a))});function na(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(o){return"'"+o+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function ud(e){return!!e&&!!e[di]}function Rc(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var o=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return o===Object||typeof o=="function"&&Function.toString.call(o)===LCe}(e)||Array.isArray(e)||!!e[Z3]||!!(!((t=e.constructor)===null||t===void 0)&&t[Z3])||qT(e)||KT(e))}function Ch(e,t,n){n===void 0&&(n=!1),Gd(e)===0?(n?Object.keys:ZT)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,o){return t(o,r,e)})}function Gd(e){var t=e[di];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:qT(e)?2:KT(e)?3:0}function Qx(e,t){return Gd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function RCe(e,t){return Gd(e)===2?e.get(t):e[t]}function e8(e,t,n){var r=Gd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function _Ce(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function qT(e){return $Ce&&e instanceof Map}function KT(e){return NCe&&e instanceof Set}function Ql(e){return e.o||e.t}function YT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=DCe(e);delete t[di];for(var n=ZT(t),r=0;r<n.length;r++){var o=n[r],i=t[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function XT(e,t){return t===void 0&&(t=!1),JT(e)||ud(e)||!Rc(e)||(Gd(e)>1&&(e.set=e.add=e.clear=e.delete=PCe),Object.freeze(e),t&&Ch(e,function(n,r){return XT(r,!0)},!0)),e}function PCe(){na(2)}function JT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Va(e){var t=MCe[e];return t||na(18,e),t}function G3(){return Eh}function kS(e,t){t&&(Va("Patches"),e.u=[],e.s=[],e.v=t)}function Zy(e){Zx(e),e.p.forEach(ICe),e.p=null}function Zx(e){e===Eh&&(Eh=e.l)}function q3(e){return Eh={p:[],l:Eh,h:e,m:!0,_:0}}function ICe(e){var t=e[di];t.i===0||t.i===1?t.j():t.g=!0}function AS(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Va("ES5").S(t,e,r),r?(n[di].P&&(Zy(t),na(4)),Rc(e)&&(e=ev(t,e),t.l||tv(t,e)),t.u&&Va("Patches").M(n[di].t,e,t.u,t.s)):e=ev(t,n,[]),Zy(t),t.u&&t.v(t.u,t.s),e!==t8?e:void 0}function ev(e,t,n){if(JT(t))return t;var r=t[di];if(!r)return Ch(t,function(l,c){return K3(e,r,t,l,c,n)},!0),t;if(r.A!==e)return t;if(!r.P)return tv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=r.i===4||r.i===5?r.o=YT(r.k):r.o,i=o,a=!1;r.i===3&&(i=new Set(o),o.clear(),a=!0),Ch(i,function(l,c){return K3(e,r,o,l,c,n,a)}),tv(e,o,!1),n&&e.u&&Va("Patches").N(r,n,e.u,e.s)}return r.o}function K3(e,t,n,r,o,i,a){if(ud(o)){var l=ev(e,o,i&&t&&t.i!==3&&!Qx(t.R,r)?i.concat(r):void 0);if(e8(n,r,l),!ud(l))return;e.m=!1}else a&&n.add(o);if(Rc(o)&&!JT(o)){if(!e.h.D&&e._<1)return;ev(e,o),t&&t.A.l||tv(e,o)}}function tv(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&XT(t,n)}function RS(e,t){var n=e[di];return(n?Ql(n):e)[t]}function Y3(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function eC(e){e.P||(e.P=!0,e.l&&eC(e.l))}function _S(e){e.o||(e.o=YT(e.t))}function tC(e,t,n){var r=qT(t)?Va("MapSet").F(t,n):KT(t)?Va("MapSet").T(t,n):e.O?function(o,i){var a=Array.isArray(o),l={i:a?1:0,A:i?i.A:G3(),P:!1,I:!1,R:{},l:i,t:o,k:null,o:null,j:null,C:!1},c=l,u=nC;a&&(c=[l],u=lf);var d=Proxy.revocable(c,u),p=d.revoke,h=d.proxy;return l.k=h,l.j=p,h}(t,n):Va("ES5").J(t,n);return(n?n.A:G3()).p.push(r),r}function OCe(e){return ud(e)||na(22,e),function t(n){if(!Rc(n))return n;var r,o=n[di],i=Gd(n);if(o){if(!o.P&&(o.i<4||!Va("ES5").K(o)))return o.t;o.I=!0,r=X3(n,i),o.I=!1}else r=X3(n,i);return Ch(r,function(a,l){o&&RCe(o.t,a)===l||e8(r,a,t(l))}),i===3?new Set(r):r}(e)}function X3(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return YT(e)}var J3,Eh,QT=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",$Ce=typeof Map<"u",NCe=typeof Set<"u",Q3=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",t8=QT?Symbol.for("immer-nothing"):((J3={})["immer-nothing"]=!0,J3),Z3=QT?Symbol.for("immer-draftable"):"__$immer_draftable",di=QT?Symbol.for("immer-state"):"__$immer_state",LCe=""+Object.prototype.constructor,ZT=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,DCe=Object.getOwnPropertyDescriptors||function(e){var t={};return ZT(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},MCe={},nC={get:function(e,t){if(t===di)return e;var n=Ql(e);if(!Qx(n,t))return function(o,i,a){var l,c=Y3(i,a);return c?"value"in c?c.value:(l=c.get)===null||l===void 0?void 0:l.call(o.k):void 0}(e,n,t);var r=n[t];return e.I||!Rc(r)?r:r===RS(e.t,t)?(_S(e),e.o[t]=tC(e.A.h,r,e)):r},has:function(e,t){return t in Ql(e)},ownKeys:function(e){return Reflect.ownKeys(Ql(e))},set:function(e,t,n){var r=Y3(Ql(e),t);if(r!=null&&r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=RS(Ql(e),t),i=o==null?void 0:o[di];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(_Ce(n,o)&&(n!==void 0||Qx(e.t,t)))return!0;_S(e),eC(e)}return e.o[t]===n&&(n!==void 0||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return RS(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,_S(e),eC(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Ql(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){na(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){na(12)}},lf={};Ch(nC,function(e,t){lf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),lf.deleteProperty=function(e,t){return lf.set.call(this,e,t,void 0)},lf.set=function(e,t,n){return nC.set.call(this,e[0],t,n,e[0])};var BCe=function(){function e(n){var r=this;this.O=Q3,this.D=!0,this.produce=function(o,i,a){if(typeof o=="function"&&typeof i!="function"){var l=i;i=o;var c=r;return function(y){var b=this;y===void 0&&(y=l);for(var v=arguments.length,w=Array(v>1?v-1:0),C=1;C<v;C++)w[C-1]=arguments[C];return c.produce(y,function(T){var A;return(A=i).call.apply(A,[b,T].concat(w))})}}var u;if(typeof i!="function"&&na(6),a!==void 0&&typeof a!="function"&&na(7),Rc(o)){var d=q3(r),p=tC(r,o,void 0),h=!0;try{u=i(p),h=!1}finally{h?Zy(d):Zx(d)}return typeof Promise<"u"&&u instanceof Promise?u.then(function(y){return kS(d,a),AS(y,d)},function(y){throw Zy(d),y}):(kS(d,a),AS(u,d))}if(!o||typeof o!="object"){if((u=i(o))===void 0&&(u=o),u===t8&&(u=void 0),r.D&&XT(u,!0),a){var f=[],m=[];Va("Patches").M(o,u,f,m),a(f,m)}return u}na(21,o)},this.produceWithPatches=function(o,i){if(typeof o=="function")return function(u){for(var d=arguments.length,p=Array(d>1?d-1:0),h=1;h<d;h++)p[h-1]=arguments[h];return r.produceWithPatches(u,function(f){return o.apply(void 0,[f].concat(p))})};var a,l,c=r.produce(o,i,function(u,d){a=u,l=d});return typeof Promise<"u"&&c instanceof Promise?c.then(function(u){return[u,a,l]}):[c,a,l]},typeof(n==null?void 0:n.useProxies)=="boolean"&&this.setUseProxies(n.useProxies),typeof(n==null?void 0:n.autoFreeze)=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){Rc(n)||na(8),ud(n)&&(n=OCe(n));var r=q3(this),o=tC(this,n,void 0);return o[di].C=!0,Zx(r),o},t.finishDraft=function(n,r){var o=n&&n[di],i=o.A;return kS(i,r),AS(void 0,i)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!Q3&&na(20),this.O=n},t.applyPatches=function(n,r){var o;for(o=r.length-1;o>=0;o--){var i=r[o];if(i.path.length===0&&i.op==="replace"){n=i.value;break}}o>-1&&(r=r.slice(o+1));var a=Va("Patches").$;return ud(n)?a(n,r):this.produce(n,function(l){return a(l,r)})},e}(),pi=new BCe,FCe=pi.produce;pi.produceWithPatches.bind(pi);pi.setAutoFreeze.bind(pi);pi.setUseProxies.bind(pi);pi.applyPatches.bind(pi);pi.createDraft.bind(pi);pi.finishDraft.bind(pi);const ki=FCe,zCe=({hasAccess:e,strategy:t,strategyDefinition:n,setStrategy:r,validateParameter:o,errors:i})=>{const{context:a}=ma(),l=(c,u)=>{r(ki(d=>{d.parameters=d.parameters??{},d.parameters[c]=u})),o(c,u)};switch(t.name){case"default":return s(dCe,{strategyDefinition:n});case"flexibleRollout":return s(SCe,{context:a,parameters:t.parameters??{},updateParameter:l,editable:e});case"userWithId":return s(ECe,{parameters:t.parameters??{},updateParameter:l,editable:e,errors:i});default:return s(ACe,{strategyDefinition:n,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i})}},jCe={environments:[],name:"",type:"",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},Qa=(e,t,n)=>{const r=WCe(e,t),{data:o,error:i,mutate:a}=An(["useFeature",r],()=>UCe(r),n),l=g.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||jCe,refetchFeature:l,loading:!i&&!o,status:o==null?void 0:o.status,error:i}},UCe=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await fn("Feature toggle data")(t),{status:t.status,body:await t.json()})},WCe=(e,t)=>wt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),HCe=({projectId:e,featureId:t,environmentId:n,children:r})=>{const o=kk(e,t),{feature:i}=Qa(e,t),a=s(qt,{to:o,children:"feature toggle page"});return s(V,{condition:VCe(i,n),show:r,elseShow:x(Lt,{severity:"warning",children:["This feature toggle is currently disabled in the"," ",s("strong",{children:n})," environment. Any changes made here will not take effect until the toggle has been enabled on the ",a,"."]})})},VCe=(e,t)=>{const n=e.environments.find(r=>r.name===t);return n?n.enabled:!1},ek="NOT_IN",e0="IN",tk="STR_ENDS_WITH",nk="STR_STARTS_WITH",rk="STR_CONTAINS",ok="NUM_EQ",ik="NUM_GT",ak="NUM_GTE",sk="NUM_LT",lk="NUM_LTE",t0="DATE_AFTER",ck="DATE_BEFORE",uk="SEMVER_EQ",dk="SEMVER_GT",pk="SEMVER_LT",GCe=[e0,ek,rk,nk,tk,ok,ik,ak,sk,lk,ck,t0,uk,dk,pk],ws=[rk,nk,tk],mc=[e0,ek],Hu=[ok,ik,ak,sk,lk],$i=[ck,t0],Vu=[uk,dk,pk],n8=[...Vu,...$i,...Hu];[...ws,...mc];const qCe=[...ws,...$i,...n8],Mn=(e,t)=>e.some(n=>n===t),r8=()=>x(Lt,{severity:"warning",children:["Remember to update your Unleash client! New operators require new SDK versions. ",s(KCe,{}),"."]}),KCe=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators",target:"_blank",rel:"noreferrer",children:"Read more"}),YCe=S("div")(({theme:e})=>({padding:e.spacing(2)})),XCe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),borderTop:`1px solid ${e.palette.divider}`,width:"100%",padding:e.spacing(2)})),JCe=S("div")({marginLeft:"auto"}),QCe=S(Ve)(({theme:e})=>({marginRight:e.spacing(1),minWidth:"125px"})),ZCe=S(Ve)(({theme:e})=>({marginLeft:e.spacing(1),minWidth:"125px"})),e2e=({localConstraint:e,children:t,triggerTransition:n,setAction:r,onSubmit:o})=>x(le,{children:[x(YCe,{children:[s(V,{condition:Mn(qCe,e.operator),show:s(r8,{})}),t]}),s(XCe,{children:x(JCe,{children:[s(QCe,{type:"button",onClick:o,variant:"contained",color:"primary","data-testid":"CONSTRAINT_SAVE_BUTTON",children:"Save"}),s(ZCe,{onClick:()=>{r(N8),n()},children:"Cancel"})]})})]}),o8=({compact:e,disabled:t})=>s(ye,{sx:n=>({backgroundColor:t?n.palette.neutral.border:"primary.light",p:e?"1px":"2px",borderRadius:"50%",width:e?"18px":"24px",height:e?"18px":"24px",marginRight:"13px"}),children:s(Kce,{sx:n=>({fill:n.palette.common.white,display:"block",width:e?n.spacing(2):n.spacing(2.5),height:e?n.spacing(2):n.spacing(2.5)})})}),t2e=(e,t)=>{const n=`To satisfy this constraint, values passed into the SDK as ${t} must`;if(e===e0)return`${n} include:`;if(e===ek)return`${n} not include:`;if(e===tk)return`${n} end with:`;if(e===nk)return`${n} start with:`;if(e===rk)return`${n} contain:`;if(e===ok)return`${n} match:`;if(e===ik)return`${n} be greater than:`;if(e===ak)return`${n} be greater than or equal to:`;if(e===sk)return`${n} be less than:`;if(e===lk)return`${n} be less than or equal to:`;if(e===t0)return`${n} be after the following date`;if(e===ck)return`${n} be before the following date:`;if(e===uk)return`${n} match the following version:`;if(e===dk)return`${n} be greater than the following version:`;if(e===pk)return`${n} be less than the following version:`},rC=e=>n2e[e],n2e={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},r2e=S("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),eI=S("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),tI=S("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),o2e=S($s)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),i2e=S(sa,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),a2e=S("div")(({theme:e})=>({lineHeight:1.2})),s2e=({options:e,value:t,onChange:n})=>{const[r,o]=g.useState(!1);return x(o2e,{variant:"outlined",size:"small",fullWidth:!0,children:[s(Qh,{htmlFor:"operator-select",children:"Operator"}),s(Zh,{id:"operator-select",name:"operator",label:"Operator",value:t,open:r,onOpen:()=>o(!0),onClose:()=>o(!1),onChange:l=>{n(l.target.value)},renderValue:()=>x(r2e,{children:[s(eI,{children:t}),s(tI,{children:rC(t)})]}),children:e.map(l=>s(i2e,{value:l,separator:l2e(e,l),children:x(a2e,{children:[s(eI,{children:l}),s(tI,{children:rC(l)})]})},l))})]})},l2e=(e,t)=>t===e[0]?!1:c2e.some(n=>n[0]===t),c2e=[mc,ws,Hu,$i,Vu],Th="currentTime",i8=e=>GCe.filter(t=>!(Mn($i,t)&&e!==Th||!Mn($i,t)&&e===Th)),a8=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0033 3C10.6666 3 9.62387 4.15704 9.76236 5.48654L10.6238 13.7567C10.6974 14.4633 11.293 15 12.0033 15C12.7137 15 13.3093 14.4633 13.3829 13.7567L14.2443 5.48655C14.3828 4.15704 13.34 3 12.0033 3ZM12.0033 17C11.0368 17 10.2533 17.7835 10.2533 18.75C10.2533 19.7165 11.0368 20.5 12.0033 20.5C12.9698 20.5 13.7533 19.7165 13.7533 18.75C13.7533 17.7835 12.9698 17 12.0033 17Z"})),u2e=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L10.414 11.7423L10.6238 13.7566C10.6974 14.4631 11.293 14.9998 12.0033 14.9998C12.4551 14.9998 12.8605 14.7827 13.1147 14.4429L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM13.8264 9.4983L14.2443 5.4864C14.3828 4.15689 13.34 2.99985 12.0033 2.99985C10.6859 2.99985 9.65401 4.12375 9.7571 5.42898L13.8264 9.4983ZM12.0033 16.9998C11.0368 16.9998 10.2533 17.7834 10.2533 18.7498C10.2533 19.7163 11.0368 20.4998 12.0033 20.4998C12.9698 20.4998 13.7533 19.7163 13.7533 18.7498C13.7533 17.7834 12.9698 16.9998 12.0033 16.9998Z"})),s8=Bc(Ft)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",height:"auto",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:"0 1px 0",marginRight:"1rem","&:hover":{background:e.palette.background.application},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),l8=Bc(Ft)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main,borderRadius:e.shape.borderRadius,marginRight:"1rem",padding:"0 1px 0","&:hover":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),d2e=({localConstraint:e,setInvertedOperator:t})=>s(yt,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:s(ye,{sx:{display:"flex",alignItems:"stretch"},children:s(V,{condition:!!e.inverted,show:s(l8,{className:"operator-is-active",onClick:t,disableRipple:!0,children:s(a8,{})}),elseShow:s(s8,{onClick:t,disableRipple:!0,children:s(u2e,{})})})})}),c8=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M5 18C5 18.55 5.45 19 6 19H18C18.55 19 19 18.55 19 18C19 17.45 18.55 17 18 17H6C5.45 17 5 17.45 5 18ZM9.5 12.8H14.5L15.16 14.4C15.31 14.76 15.66 15 16.05 15C16.74 15 17.2 14.29 16.93 13.66L13.05 4.69C12.87 4.27 12.46 4 12 4C11.54 4 11.13 4.27 10.95 4.69L7.07 13.66C6.8 14.29 7.27 15 7.96 15C8.35 15 8.7 14.76 8.85 14.4L9.5 12.8ZM12 5.98L13.87 11H10.13L12 5.98Z"})),p2e=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L8.65871 9.98698L7.07 13.6598C6.8 14.2898 7.27 14.9998 7.96 14.9998C8.35 14.9998 8.7 14.7598 8.85 14.3998L9.5 12.7998H11.4716L15.6716 16.9998H6C5.45 16.9998 5 17.4498 5 17.9998C5 18.5498 5.45 18.9998 6 18.9998H17.6716L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM16.1235 11.7954L13.05 4.68985C12.87 4.26985 12.46 3.99985 12 3.99985C11.54 3.99985 11.13 4.26985 10.95 4.68985L10.3666 6.03851L11.5408 7.21265L12 5.97985L13.0045 8.67635L16.1235 11.7954Z"})),f2e=({localConstraint:e,setCaseInsensitive:t})=>s(yt,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:s(ye,{sx:{display:"flex",alignItems:"stretch"},children:s(V,{condition:!!e.caseInsensitive,show:s(s8,{onClick:t,disableRipple:!0,children:s(p2e,{})}),elseShow:s(l8,{className:"operator-is-active",onClick:t,disableRipple:!0,children:s(c8,{})})})})}),h2e=S("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),u8=({onEdit:e,onDelete:t,disableDelete:n=!1,disableEdit:r=!1})=>{const o=e&&(a=>{a.stopPropagation(),e()}),i=t&&(a=>{a.stopPropagation(),t()});return x(h2e,{children:[s(V,{condition:!!o&&!r,show:s(yt,{title:"Edit constraint",arrow:!0,children:s(Ft,{type:"button",onClick:o,disabled:r,children:s(Ui,{})})})}),s(V,{condition:!!i&&!n,show:s(yt,{title:"Delete constraint",arrow:!0,children:s(Ft,{type:"button",onClick:i,disabled:n,children:s(vo,{})})})})]})},g2e=S("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),m2e=S("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(770)]:{flexDirection:"column"}})),y2e=S("div")(({theme:e})=>({[e.breakpoints.down(770)]:{marginTop:e.spacing(2)},display:"inline-flex"})),v2e=S("div")(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),b2e=S(Bd)(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),S2e=S("p")(({theme:e})=>({maxWidth:"400px",fontSize:e.fontSizes.smallBody,[e.breakpoints.down("xl")]:{display:"none"}})),w2e=({compact:e,localConstraint:t,setLocalConstraint:n,setContextName:r,setOperator:o,onDelete:i,setInvertedOperator:a,setCaseInsensitive:l})=>{const{context:c}=ma(),{contextName:u,operator:d}=t,[p,h]=g.useState(!1),{uiConfig:f}=xt(),m=!!f.flags.caseInsensitiveInOperators;if(g.useEffect(()=>{u===Th&&!Mn($i,d)?n(v=>({...v,operator:t0,value:new Date().toISOString()})):u!==Th&&Mn($i,d)&&o(e0),Mn(ws,d)||Mn(mc,d)&&m?h(!0):h(!1)},[u,o,d,n,m]),!c)return null;const y=c.map(v=>({key:v.name,label:v.name})),b=v=>{Mn(ws,v)||Mn(mc,v)&&m?h(!0):h(!1),Mn($i,v)?n(w=>({...w,operator:v,value:new Date().toISOString()})):o(v)};return x(g2e,{children:[s(o8,{}),x(m2e,{children:[s("div",{children:s(b2e,{id:"context-field-select",name:"contextName",label:"Context Field",autoFocus:!0,options:y,value:u||"",onChange:r})}),x(y2e,{children:[s(d2e,{localConstraint:t,setInvertedOperator:a}),s(v2e,{children:s(s2e,{options:i8(u),value:d,onChange:b})}),s(V,{condition:p,show:s(f2e,{localConstraint:t,setCaseInsensitive:l})})]})]}),s(V,{condition:!e,show:s(S2e,{children:t2e(d,u)})}),s(u8,{onDelete:i,disableEdit:!0})]})},nI=e=>ki(e,t=>{Mn(n8,e.operator)?delete t.values:delete t.value}),qd=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0}),o=async(A,k)=>{const P=t("api/admin/features/validate",{method:"POST",body:JSON.stringify({name:A,projectId:k})});return e(P.caller,P.id)},i=async A=>{const _=t("api/admin/constraints/validate",{method:"POST",body:JSON.stringify(A)});await e(_.caller,_.id)},a=async(A,k)=>{const _=`/api/admin/projects/${A}/features`,P=t(_,{method:"POST",body:JSON.stringify(k)});await e(P.caller,P.id)},l=g.useCallback(async(A,k,_,P=!1)=>{const I=`api/admin/projects/${A}/features/${k}/environments/${_}/on?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST"},"toggleFeatureEnvironmentOn");return e(O.caller,O.id)},[t,e]),c=g.useCallback(async(A,k,_,P=!1)=>{const I=`api/admin/projects/${A}/bulk_features/environments/${_}/on?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST",body:JSON.stringify({features:k})},"bulkToggleFeaturesEnvironmentOn");return e(O.caller,O.id)},[t,e]),u=g.useCallback(async(A,k,_,P=!1)=>{const I=`api/admin/projects/${A}/bulk_features/environments/${_}/off?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST",body:JSON.stringify({features:k})},"bulkToggleFeaturesEnvironmentOff");return e(O.caller,O.id)},[t,e]),d=g.useCallback(async(A,k,_)=>{const P=`api/admin/projects/${A}/features/${k}/environments/${_}/off`,I=t(P,{method:"POST"},"toggleFeatureEnvironmentOff");return e(I.caller,I.id)},[t,e]);return{validateFeatureToggleName:o,validateConstraint:i,createFeatureToggle:a,changeFeatureProject:async(A,k,_)=>{const P=`api/admin/projects/${A}/features/${k}/changeProject`,I=t(P,{method:"POST",body:JSON.stringify({newProjectId:_})});return e(I.caller,I.id)},errors:n,toggleFeatureEnvironmentOn:l,toggleFeatureEnvironmentOff:d,addTagToFeature:async(A,k)=>{const _=`api/admin/features/${A}/tags`,P=t(_,{method:"POST",body:JSON.stringify({...k})});return e(P.caller,P.id)},deleteTagFromFeature:async(A,k,_)=>{const P=`${encodeURIComponent(k)}/${encodeURIComponent(_)}`,I=`api/admin/features/${A}/tags/${P}`,O=t(I,{method:"DELETE"});return e(O.caller,O.id)},updateFeatureTags:async(A,k)=>{const _=`api/admin/features/${A}/tags`,P=t(_,{method:"PUT",body:JSON.stringify({...k})});return e(P.caller,P.id)},archiveFeatureToggle:async(A,k)=>{const _=`api/admin/projects/${A}/features/${k}`,P=t(_,{method:"DELETE"});return e(P.caller,P.id)},patchFeatureToggle:async(A,k,_)=>{const P=`api/admin/projects/${A}/features/${k}`,I=t(P,{method:"PATCH",body:JSON.stringify(_)});return e(I.caller,I.id)},patchFeatureVariants:async(A,k,_)=>{const P=`api/admin/projects/${A}/features/${k}/variants`,I=t(P,{method:"PATCH",body:JSON.stringify(_)});return e(I.caller,I.id)},patchFeatureEnvironmentVariants:async(A,k,_,P)=>{const I=`api/admin/projects/${A}/features/${k}/environments/${_}/variants`,O=t(I,{method:"PATCH",body:JSON.stringify(P)});return e(O.caller,O.id)},overrideVariantsInEnvironments:async(A,k,_,P)=>{const I=`api/admin/projects/${A}/features/${k}/variants-batch`,O=t(I,{method:"PUT",body:JSON.stringify({variants:_,environments:P})});return e(O.caller,O.id)},cloneFeatureToggle:async(A,k,_)=>{const P=`api/admin/projects/${A}/features/${k}/clone`,I=t(P,{method:"POST",body:JSON.stringify(_)});return e(I.caller,I.id)},loading:r,bulkToggleFeaturesEnvironmentOn:c,bulkToggleFeaturesEnvironmentOff:u}};var oC={exports:{}};const x2e="2.0.0",d8=256,C2e=Number.MAX_SAFE_INTEGER||9007199254740991,E2e=16,T2e=d8-6,k2e=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var n0={MAX_LENGTH:d8,MAX_SAFE_COMPONENT_LENGTH:E2e,MAX_SAFE_BUILD_LENGTH:T2e,MAX_SAFE_INTEGER:C2e,RELEASE_TYPES:k2e,SEMVER_SPEC_VERSION:x2e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const A2e=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var r0=A2e;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=n0,i=r0;t=e.exports={};const a=t.re=[],l=t.safeRe=[],c=t.src=[],u=t.t={};let d=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[p,r]],f=y=>{for(const[b,v]of h)y=y.split(`${b}*`).join(`${b}{0,${v}}`).split(`${b}+`).join(`${b}{1,${v}}`);return y},m=(y,b,v)=>{const w=f(b),C=d++;i(y,C,b),u[y]=C,c[C]=b,a[C]=new RegExp(b,v?"g":void 0),l[C]=new RegExp(w,v?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),m("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${p}+`),m("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),m("FULL",`^${c[u.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),m("LOOSE",`^${c[u.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),m("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),m("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),m("COERCERTL",c[u.COERCE],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(oC,oC.exports);var ug=oC.exports;const R2e=Object.freeze({loose:!0}),_2e=Object.freeze({}),P2e=e=>e?typeof e!="object"?R2e:e:_2e;var fk=P2e;const rI=/^[0-9]+$/,p8=(e,t)=>{const n=rI.test(e),r=rI.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},I2e=(e,t)=>p8(t,e);var f8={compareIdentifiers:p8,rcompareIdentifiers:I2e};const wm=r0,{MAX_LENGTH:oI,MAX_SAFE_INTEGER:xm}=n0,{safeRe:iI,t:aI}=ug,O2e=fk,{compareIdentifiers:lu}=f8;let $2e=class wa{constructor(t,n){if(n=O2e(n),t instanceof wa){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>oI)throw new TypeError(`version is longer than ${oI} characters`);wm("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?iI[aI.LOOSE]:iI[aI.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>xm||this.major<0)throw new TypeError("Invalid major version");if(this.minor>xm||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>xm||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const i=+o;if(i>=0&&i<xm)return i}return o}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(wm("SemVer.compare",this.version,this.options,t),!(t instanceof wa)){if(typeof t=="string"&&t===this.version)return 0;t=new wa(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof wa||(t=new wa(t,this.options)),lu(this.major,t.major)||lu(this.minor,t.minor)||lu(this.patch,t.patch)}comparePre(t){if(t instanceof wa||(t=new wa(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],o=t.prerelease[n];if(wm("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return lu(r,o)}while(++n)}compareBuild(t){t instanceof wa||(t=new wa(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(wm("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return lu(r,o)}while(++n)}inc(t,n,r){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const o=Number(r)?1:0;if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let i=[n,o];r===!1&&(i=[n]),lu(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var $o=$2e;const sI=$o,N2e=(e,t,n=!1)=>{if(e instanceof sI)return e;try{return new sI(e,t)}catch(r){if(!n)return null;throw r}};var Kd=N2e;const L2e=Kd,D2e=(e,t)=>{const n=L2e(e,t);return n?n.version:null};var M2e=D2e;const B2e=Kd,F2e=(e,t)=>{const n=B2e(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var z2e=F2e;const lI=$o,j2e=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new lI(e instanceof lI?e.version:e,n).inc(t,r,o).version}catch{return null}};var U2e=j2e;const cI=Kd,W2e=(e,t)=>{const n=cI(e,null,!0),r=cI(t,null,!0),o=n.compare(r);if(o===0)return null;const i=o>0,a=i?n:r,l=i?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const d=c?"pre":"";return n.major!==r.major?d+"major":n.minor!==r.minor?d+"minor":n.patch!==r.patch?d+"patch":"prerelease"};var H2e=W2e;const V2e=$o,G2e=(e,t)=>new V2e(e,t).major;var q2e=G2e;const K2e=$o,Y2e=(e,t)=>new K2e(e,t).minor;var X2e=Y2e;const J2e=$o,Q2e=(e,t)=>new J2e(e,t).patch;var Z2e=Q2e;const eEe=Kd,tEe=(e,t)=>{const n=eEe(e,t);return n&&n.prerelease.length?n.prerelease:null};var nEe=tEe;const uI=$o,rEe=(e,t,n)=>new uI(e,n).compare(new uI(t,n));var ya=rEe;const oEe=ya,iEe=(e,t,n)=>oEe(t,e,n);var aEe=iEe;const sEe=ya,lEe=(e,t)=>sEe(e,t,!0);var cEe=lEe;const dI=$o,uEe=(e,t,n)=>{const r=new dI(e,n),o=new dI(t,n);return r.compare(o)||r.compareBuild(o)};var hk=uEe;const dEe=hk,pEe=(e,t)=>e.sort((n,r)=>dEe(n,r,t));var fEe=pEe;const hEe=hk,gEe=(e,t)=>e.sort((n,r)=>hEe(r,n,t));var mEe=gEe;const yEe=ya,vEe=(e,t,n)=>yEe(e,t,n)>0;var o0=vEe;const bEe=ya,SEe=(e,t,n)=>bEe(e,t,n)<0;var gk=SEe;const wEe=ya,xEe=(e,t,n)=>wEe(e,t,n)===0;var h8=xEe;const CEe=ya,EEe=(e,t,n)=>CEe(e,t,n)!==0;var g8=EEe;const TEe=ya,kEe=(e,t,n)=>TEe(e,t,n)>=0;var mk=kEe;const AEe=ya,REe=(e,t,n)=>AEe(e,t,n)<=0;var yk=REe;const _Ee=h8,PEe=g8,IEe=o0,OEe=mk,$Ee=gk,NEe=yk,LEe=(e,t,n,r)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return _Ee(e,n,r);case"!=":return PEe(e,n,r);case">":return IEe(e,n,r);case">=":return OEe(e,n,r);case"<":return $Ee(e,n,r);case"<=":return NEe(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var m8=LEe;const DEe=$o,MEe=Kd,{safeRe:Cm,t:Em}=ug,BEe=(e,t)=>{if(e instanceof DEe)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let n=null;if(!t.rtl)n=e.match(Cm[Em.COERCE]);else{let r;for(;(r=Cm[Em.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),Cm[Em.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;Cm[Em.COERCERTL].lastIndex=-1}return n===null?null:MEe(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};var FEe=BEe,PS,pI;function zEe(){return pI||(pI=1,PS=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),PS}var jEe=bn;bn.Node=_c;bn.create=bn;function bn(e){var t=this;if(t instanceof bn||(t=new bn),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)t.push(arguments[n]);return t}bn.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t};bn.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}};bn.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}};bn.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)WEe(this,arguments[e]);return this.length};bn.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)HEe(this,arguments[e]);return this.length};bn.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}};bn.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}};bn.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next};bn.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev};bn.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value};bn.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value};bn.prototype.map=function(e,t){t=t||this;for(var n=new bn,r=this.head;r!==null;)n.push(e.call(t,r.value,this)),r=r.next;return n};bn.prototype.mapReverse=function(e,t){t=t||this;for(var n=new bn,r=this.tail;r!==null;)n.push(e.call(t,r.value,this)),r=r.prev;return n};bn.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r!==null;o++)n=e(n,r.value,o),r=r.next;return n};bn.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;r!==null;o--)n=e(n,r.value,o),r=r.prev;return n};bn.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e};bn.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e};bn.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var n=new bn;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=0,o=this.head;o!==null&&r<e;r++)o=o.next;for(;o!==null&&r<t;r++,o=o.next)n.push(o.value);return n};bn.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var n=new bn;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=this.length,o=this.tail;o!==null&&r>t;r--)o=o.prev;for(;o!==null&&r>e;r--,o=o.prev)n.push(o.value);return n};bn.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,o=this.head;o!==null&&r<e;r++)o=o.next;for(var i=[],r=0;o&&r<t;r++)i.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var r=0;r<n.length;r++)o=UEe(this,o,n[r]);return i};bn.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function UEe(e,t,n){var r=t===e.head?new _c(n,null,t,e):new _c(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function WEe(e,t){e.tail=new _c(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function HEe(e,t){e.head=new _c(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function _c(e,t,n,r){if(!(this instanceof _c))return new _c(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{zEe()(bn)}catch{}const VEe=jEe,oc=Symbol("max"),fs=Symbol("length"),cu=Symbol("lengthCalculator"),Lf=Symbol("allowStale"),pc=Symbol("maxAge"),us=Symbol("dispose"),fI=Symbol("noDisposeOnSet"),Vr=Symbol("lruList"),Zi=Symbol("cache"),y8=Symbol("updateAgeOnGet"),IS=()=>1;class GEe{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");this[oc]=t.max||1/0;const n=t.length||IS;if(this[cu]=typeof n!="function"?IS:n,this[Lf]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[pc]=t.maxAge||0,this[us]=t.dispose,this[fI]=t.noDisposeOnSet||!1,this[y8]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[oc]=t||1/0,zp(this)}get max(){return this[oc]}set allowStale(t){this[Lf]=!!t}get allowStale(){return this[Lf]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[pc]=t,zp(this)}get maxAge(){return this[pc]}set lengthCalculator(t){typeof t!="function"&&(t=IS),t!==this[cu]&&(this[cu]=t,this[fs]=0,this[Vr].forEach(n=>{n.length=this[cu](n.value,n.key),this[fs]+=n.length})),zp(this)}get lengthCalculator(){return this[cu]}get length(){return this[fs]}get itemCount(){return this[Vr].length}rforEach(t,n){n=n||this;for(let r=this[Vr].tail;r!==null;){const o=r.prev;hI(this,t,r,n),r=o}}forEach(t,n){n=n||this;for(let r=this[Vr].head;r!==null;){const o=r.next;hI(this,t,r,n),r=o}}keys(){return this[Vr].toArray().map(t=>t.key)}values(){return this[Vr].toArray().map(t=>t.value)}reset(){this[us]&&this[Vr]&&this[Vr].length&&this[Vr].forEach(t=>this[us](t.key,t.value)),this[Zi]=new Map,this[Vr]=new VEe,this[fs]=0}dump(){return this[Vr].map(t=>nv(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[Vr]}set(t,n,r){if(r=r||this[pc],r&&typeof r!="number")throw new TypeError("maxAge must be a number");const o=r?Date.now():0,i=this[cu](n,t);if(this[Zi].has(t)){if(i>this[oc])return Gu(this,this[Zi].get(t)),!1;const c=this[Zi].get(t).value;return this[us]&&(this[fI]||this[us](t,c.value)),c.now=o,c.maxAge=r,c.value=n,this[fs]+=i-c.length,c.length=i,this.get(t),zp(this),!0}const a=new qEe(t,n,i,o,r);return a.length>this[oc]?(this[us]&&this[us](t,n),!1):(this[fs]+=a.length,this[Vr].unshift(a),this[Zi].set(t,this[Vr].head),zp(this),!0)}has(t){if(!this[Zi].has(t))return!1;const n=this[Zi].get(t).value;return!nv(this,n)}get(t){return OS(this,t,!0)}peek(t){return OS(this,t,!1)}pop(){const t=this[Vr].tail;return t?(Gu(this,t),t.value):null}del(t){Gu(this,this[Zi].get(t))}load(t){this.reset();const n=Date.now();for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.e||0;if(i===0)this.set(o.k,o.v);else{const a=i-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[Zi].forEach((t,n)=>OS(this,n,!1))}}const OS=(e,t,n)=>{const r=e[Zi].get(t);if(r){const o=r.value;if(nv(e,o)){if(Gu(e,r),!e[Lf])return}else n&&(e[y8]&&(r.value.now=Date.now()),e[Vr].unshiftNode(r));return o.value}},nv=(e,t)=>{if(!t||!t.maxAge&&!e[pc])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[pc]&&n>e[pc]},zp=e=>{if(e[fs]>e[oc])for(let t=e[Vr].tail;e[fs]>e[oc]&&t!==null;){const n=t.prev;Gu(e,t),t=n}},Gu=(e,t)=>{if(t){const n=t.value;e[us]&&e[us](n.key,n.value),e[fs]-=n.length,e[Zi].delete(n.key),e[Vr].removeNode(t)}};class qEe{constructor(t,n,r,o,i){this.key=t,this.value=n,this.length=r,this.now=o,this.maxAge=i||0}}const hI=(e,t,n,r)=>{let o=n.value;nv(e,o)&&(Gu(e,n),e[Lf]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};var KEe=GEe,$S,gI;function va(){if(gI)return $S;gI=1;class e{constructor(B,q){if(q=r(q),B instanceof e)return B.loose===!!q.loose&&B.includePrerelease===!!q.includePrerelease?B:new e(B.raw,q);if(B instanceof o)return this.raw=B.value,this.set=[[B]],this.format(),this;if(this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.includePrerelease,this.raw=B.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(Y=>this.parseRange(Y.trim())).filter(Y=>Y.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const Y=this.set[0];if(this.set=this.set.filter(ne=>!m(ne[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const ne of this.set)if(ne.length===1&&y(ne[0])){this.set=[ne];break}}}this.format()}format(){return this.range=this.set.map(B=>B.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(B){const Y=((this.options.includePrerelease&&h)|(this.options.loose&&f))+":"+B,ne=n.get(Y);if(ne)return ne;const H=this.options.loose,j=H?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];B=B.replace(j,$(this.options.includePrerelease)),i("hyphen replace",B),B=B.replace(l[c.COMPARATORTRIM],u),i("comparator trim",B),B=B.replace(l[c.TILDETRIM],d),i("tilde trim",B),B=B.replace(l[c.CARETTRIM],p),i("caret trim",B);let W=B.split(" ").map(se=>v(se,this.options)).join(" ").split(/\s+/).map(se=>O(se,this.options));H&&(W=W.filter(se=>(i("loose invalid filter",se,this.options),!!se.match(l[c.COMPARATORLOOSE])))),i("range list",W);const R=new Map,N=W.map(se=>new o(se,this.options));for(const se of N){if(m(se))return[se];R.set(se.value,se)}R.size>1&&R.has("")&&R.delete("");const J=[...R.values()];return n.set(Y,J),J}intersects(B,q){if(!(B instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>b(Y,q)&&B.set.some(ne=>b(ne,q)&&Y.every(H=>ne.every(j=>H.intersects(j,q)))))}test(B){if(!B)return!1;if(typeof B=="string")try{B=new a(B,this.options)}catch{return!1}for(let q=0;q<this.set.length;q++)if(F(this.set[q],B,this.options))return!0;return!1}}$S=e;const t=KEe,n=new t({max:1e3}),r=fk,o=i0(),i=r0,a=$o,{safeRe:l,t:c,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:p}=ug,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:f}=n0,m=M=>M.value==="<0.0.0-0",y=M=>M.value==="",b=(M,B)=>{let q=!0;const Y=M.slice();let ne=Y.pop();for(;q&&Y.length;)q=Y.every(H=>ne.intersects(H,B)),ne=Y.pop();return q},v=(M,B)=>(i("comp",M,B),M=A(M,B),i("caret",M),M=C(M,B),i("tildes",M),M=_(M,B),i("xrange",M),M=I(M,B),i("stars",M),M),w=M=>!M||M.toLowerCase()==="x"||M==="*",C=(M,B)=>M.trim().split(/\s+/).map(q=>T(q,B)).join(" "),T=(M,B)=>{const q=B.loose?l[c.TILDELOOSE]:l[c.TILDE];return M.replace(q,(Y,ne,H,j,W)=>{i("tilde",M,Y,ne,H,j,W);let R;return w(ne)?R="":w(H)?R=`>=${ne}.0.0 <${+ne+1}.0.0-0`:w(j)?R=`>=${ne}.${H}.0 <${ne}.${+H+1}.0-0`:W?(i("replaceTilde pr",W),R=`>=${ne}.${H}.${j}-${W} <${ne}.${+H+1}.0-0`):R=`>=${ne}.${H}.${j} <${ne}.${+H+1}.0-0`,i("tilde return",R),R})},A=(M,B)=>M.trim().split(/\s+/).map(q=>k(q,B)).join(" "),k=(M,B)=>{i("caret",M,B);const q=B.loose?l[c.CARETLOOSE]:l[c.CARET],Y=B.includePrerelease?"-0":"";return M.replace(q,(ne,H,j,W,R)=>{i("caret",M,ne,H,j,W,R);let N;return w(H)?N="":w(j)?N=`>=${H}.0.0${Y} <${+H+1}.0.0-0`:w(W)?H==="0"?N=`>=${H}.${j}.0${Y} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.0${Y} <${+H+1}.0.0-0`:R?(i("replaceCaret pr",R),H==="0"?j==="0"?N=`>=${H}.${j}.${W}-${R} <${H}.${j}.${+W+1}-0`:N=`>=${H}.${j}.${W}-${R} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.${W}-${R} <${+H+1}.0.0-0`):(i("no pr"),H==="0"?j==="0"?N=`>=${H}.${j}.${W}${Y} <${H}.${j}.${+W+1}-0`:N=`>=${H}.${j}.${W}${Y} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.${W} <${+H+1}.0.0-0`),i("caret return",N),N})},_=(M,B)=>(i("replaceXRanges",M,B),M.split(/\s+/).map(q=>P(q,B)).join(" ")),P=(M,B)=>{M=M.trim();const q=B.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return M.replace(q,(Y,ne,H,j,W,R)=>{i("xRange",M,Y,ne,H,j,W,R);const N=w(H),J=N||w(j),se=J||w(W),xe=se;return ne==="="&&xe&&(ne=""),R=B.includePrerelease?"-0":"",N?ne===">"||ne==="<"?Y="<0.0.0-0":Y="*":ne&&xe?(J&&(j=0),W=0,ne===">"?(ne=">=",J?(H=+H+1,j=0,W=0):(j=+j+1,W=0)):ne==="<="&&(ne="<",J?H=+H+1:j=+j+1),ne==="<"&&(R="-0"),Y=`${ne+H}.${j}.${W}${R}`):J?Y=`>=${H}.0.0${R} <${+H+1}.0.0-0`:se&&(Y=`>=${H}.${j}.0${R} <${H}.${+j+1}.0-0`),i("xRange return",Y),Y})},I=(M,B)=>(i("replaceStars",M,B),M.trim().replace(l[c.STAR],"")),O=(M,B)=>(i("replaceGTE0",M,B),M.trim().replace(l[B.includePrerelease?c.GTE0PRE:c.GTE0],"")),$=M=>(B,q,Y,ne,H,j,W,R,N,J,se,xe,ge)=>(w(Y)?q="":w(ne)?q=`>=${Y}.0.0${M?"-0":""}`:w(H)?q=`>=${Y}.${ne}.0${M?"-0":""}`:j?q=`>=${q}`:q=`>=${q}${M?"-0":""}`,w(N)?R="":w(J)?R=`<${+N+1}.0.0-0`:w(se)?R=`<${N}.${+J+1}.0-0`:xe?R=`<=${N}.${J}.${se}-${xe}`:M?R=`<${N}.${J}.${+se+1}-0`:R=`<=${R}`,`${q} ${R}`.trim()),F=(M,B,q)=>{for(let Y=0;Y<M.length;Y++)if(!M[Y].test(B))return!1;if(B.prerelease.length&&!q.includePrerelease){for(let Y=0;Y<M.length;Y++)if(i(M[Y].semver),M[Y].semver!==o.ANY&&M[Y].semver.prerelease.length>0){const ne=M[Y].semver;if(ne.major===B.major&&ne.minor===B.minor&&ne.patch===B.patch)return!0}return!1}return!0};return $S}var NS,mI;function i0(){if(mI)return NS;mI=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,p){if(p=n(p),d instanceof t){if(d.loose===!!p.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),a("comparator",d,p),this.options=p,this.loose=!!p.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(d){const p=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],h=d.match(p);if(!h)throw new TypeError(`Invalid comparator: ${d}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new l(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(a("Comparator.test",d,this.options.loose),this.semver===e||d===e)return!0;if(typeof d=="string")try{d=new l(d,this.options)}catch{return!1}return i(d,this.operator,this.semver,this.options)}intersects(d,p){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,p).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,p).test(d.semver):(p=n(p),p.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!p.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||i(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||i(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}NS=t;const n=fk,{safeRe:r,t:o}=ug,i=m8,a=r0,l=$o,c=va();return NS}const YEe=va(),XEe=(e,t,n)=>{try{t=new YEe(t,n)}catch{return!1}return t.test(e)};var a0=XEe;const JEe=va(),QEe=(e,t)=>new JEe(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var ZEe=QEe;const eTe=$o,tTe=va(),nTe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new tTe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new eTe(r,n))}),r};var rTe=nTe;const oTe=$o,iTe=va(),aTe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new iTe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new oTe(r,n))}),r};var sTe=aTe;const LS=$o,lTe=va(),yI=o0,cTe=(e,t)=>{e=new lTe(e,t);let n=new LS("0.0.0");if(e.test(n)||(n=new LS("0.0.0-0"),e.test(n)))return n;n=null;for(let r=0;r<e.set.length;++r){const o=e.set[r];let i=null;o.forEach(a=>{const l=new LS(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||yI(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!n||yI(n,i))&&(n=i)}return n&&e.test(n)?n:null};var uTe=cTe;const dTe=va(),pTe=(e,t)=>{try{return new dTe(e,t).range||"*"}catch{return null}};var fTe=pTe;const hTe=$o,v8=i0(),{ANY:gTe}=v8,mTe=va(),yTe=a0,vI=o0,bI=gk,vTe=yk,bTe=mk,STe=(e,t,n,r)=>{e=new hTe(e,r),t=new mTe(t,r);let o,i,a,l,c;switch(n){case">":o=vI,i=vTe,a=bI,l=">",c=">=";break;case"<":o=bI,i=bTe,a=vI,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(yTe(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const d=t.set[u];let p=null,h=null;if(d.forEach(f=>{f.semver===gTe&&(f=new v8(">=0.0.0")),p=p||f,h=h||f,o(f.semver,p.semver,r)?p=f:a(f.semver,h.semver,r)&&(h=f)}),p.operator===l||p.operator===c||(!h.operator||h.operator===l)&&i(e,h.semver))return!1;if(h.operator===c&&a(e,h.semver))return!1}return!0};var vk=STe;const wTe=vk,xTe=(e,t,n)=>wTe(e,t,">",n);var CTe=xTe;const ETe=vk,TTe=(e,t,n)=>ETe(e,t,"<",n);var kTe=TTe;const SI=va(),ATe=(e,t,n)=>(e=new SI(e,n),t=new SI(t,n),e.intersects(t,n));var RTe=ATe;const _Te=a0,PTe=ya;var ITe=(e,t,n)=>{const r=[];let o=null,i=null;const a=e.sort((d,p)=>PTe(d,p,n));for(const d of a)_Te(d,t,n)?(i=d,o||(o=d)):(i&&r.push([o,i]),i=null,o=null);o&&r.push([o,null]);const l=[];for(const[d,p]of r)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);const c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t};const wI=va(),bk=i0(),{ANY:DS}=bk,jp=a0,Sk=ya,OTe=(e,t,n={})=>{if(e===t)return!0;e=new wI(e,n),t=new wI(t,n);let r=!1;e:for(const o of e.set){for(const i of t.set){const a=NTe(o,i,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},$Te=[new bk(">=0.0.0-0")],xI=[new bk(">=0.0.0")],NTe=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===DS){if(t.length===1&&t[0].semver===DS)return!0;n.includePrerelease?e=$Te:e=xI}if(t.length===1&&t[0].semver===DS){if(n.includePrerelease)return!0;t=xI}const r=new Set;let o,i;for(const f of e)f.operator===">"||f.operator===">="?o=CI(o,f,n):f.operator==="<"||f.operator==="<="?i=EI(i,f,n):r.add(f.semver);if(r.size>1)return null;let a;if(o&&i){if(a=Sk(o.semver,i.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(const f of r){if(o&&!jp(f,String(o),n)||i&&!jp(f,String(i),n))return null;for(const m of t)if(!jp(f,String(m),n))return!1;return!0}let l,c,u,d,p=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const f of t){if(d=d||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",o){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator===">"||f.operator===">="){if(l=CI(o,f,n),l===f&&l!==o)return!1}else if(o.operator===">="&&!jp(o.semver,String(f),n))return!1}if(i){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(c=EI(i,f,n),c===f&&c!==i)return!1}else if(i.operator==="<="&&!jp(i.semver,String(f),n))return!1}if(!f.operator&&(i||o)&&a!==0)return!1}return!(o&&u&&!i&&a!==0||i&&d&&!o&&a!==0||h||p)},CI=(e,t,n)=>{if(!e)return t;const r=Sk(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},EI=(e,t,n)=>{if(!e)return t;const r=Sk(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var LTe=OTe;const MS=ug,TI=n0,DTe=$o,kI=f8,MTe=Kd,BTe=M2e,FTe=z2e,zTe=U2e,jTe=H2e,UTe=q2e,WTe=X2e,HTe=Z2e,VTe=nEe,GTe=ya,qTe=aEe,KTe=cEe,YTe=hk,XTe=fEe,JTe=mEe,QTe=o0,ZTe=gk,eke=h8,tke=g8,nke=mk,rke=yk,oke=m8,ike=FEe,ake=i0(),ske=va(),lke=a0,cke=ZEe,uke=rTe,dke=sTe,pke=uTe,fke=fTe,hke=vk,gke=CTe,mke=kTe,yke=RTe,vke=ITe,bke=LTe;var Ske={parse:MTe,valid:BTe,clean:FTe,inc:zTe,diff:jTe,major:UTe,minor:WTe,patch:HTe,prerelease:VTe,compare:GTe,rcompare:qTe,compareLoose:KTe,compareBuild:YTe,sort:XTe,rsort:JTe,gt:QTe,lt:ZTe,eq:eke,neq:tke,gte:nke,lte:rke,cmp:oke,coerce:ike,Comparator:ake,Range:ske,satisfies:lke,toComparators:cke,maxSatisfying:uke,minSatisfying:dke,minVersion:pke,validRange:fke,outside:hke,gtr:gke,ltr:mke,intersects:yke,simplifyRange:vke,subset:bke,SemVer:DTe,re:MS.re,src:MS.src,tokens:MS.t,SEMVER_SPEC_VERSION:TI.SEMVER_SPEC_VERSION,RELEASE_TYPES:TI.RELEASE_TYPES,compareIdentifiers:kI.compareIdentifiers,rcompareIdentifiers:kI.rcompareIdentifiers};const AI=Yr(Ske),wke=e=>()=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?[!1,"Value must be a number"]:[!0,""]},xke=e=>()=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},Cke=e=>()=>{const t=AI.clean(e)===e;return!AI.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},Eke=e=>()=>lT(dl(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],Tm=e=>!!e&&Array.isArray(e)&&e.length>0,iC="IN_OPERATORS_LEGAL_VALUES",b8="STRING_OPERATORS_LEGAL_VALUES",S8="NUM_OPERATORS_LEGAL_VALUES",w8="SEMVER_OPERATORS_LEGAL_VALUES",x8="DATE_OPERATORS_SINGLE_VALUE",C8="IN_OPERATORS_FREETEXT",E8="STRING_OPERATORS_FREETEXT",T8="NUM_OPERATORS_SINGLE_VALUE",k8="SEMVER_OPERATORS_SINGLE_VALUE",RI="NUMBER_VALIDATOR",_I="SEMVER_VALIDATOR",BS="STRING_ARRAY_VALIDATOR",PI="DATE_VALIDATOR",Tke=({contextDefinition:e,localConstraint:t})=>{const[n,r]=g.useState(iC),[o,i]=g.useState(BS),[a,l]=g.useState(""),c=g.useCallback(()=>{Tm(e.legalValues)&&Mn(mc,t.operator)?r(iC):Tm(e.legalValues)&&Mn(ws,t.operator)?r(b8):Tm(e.legalValues)&&Mn(Hu,t.operator)?r(S8):Tm(e.legalValues)&&Mn(Vu,t.operator)?r(w8):Mn($i,t.operator)?r(x8):Mn(mc,t.operator)?r(C8):Mn(ws,t.operator)?r(E8):Mn(Hu,t.operator)?r(T8):Mn(Vu,t.operator)&&r(k8)},[t,e]),u=()=>{switch(o){case RI:return wke(t.value);case BS:return xke(t.values||[]);case _I:return Cke(t.value||"");case PI:return Eke(t.value||"")}},d=g.useCallback(p=>{Mn(Hu,p)&&i(RI),Mn([...ws,...mc],p)&&i(BS),Mn(Vu,p)&&i(_I),Mn($i,p)&&i(PI)},[i]);return g.useEffect(()=>{d(t.operator)},[t.operator,t.value,t.values,d]),g.useEffect(()=>{c()},[e,t,c]),{input:n,error:a,validator:u(),setError:l}},kke=S("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),dg=({children:e,...t})=>s(kke,{...t,children:e});function II(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function kh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?II(Object(n),!0).forEach(function(r){s0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):II(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function s0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ake(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Rke(e,t){if(e==null)return{};var n=Ake(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _ke(e,t){return Pke(e)||Ike(e,t)||Oke(e,t)||$ke()}function Pke(e){if(Array.isArray(e))return e}function Ike(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,l;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,l=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw l}}return r}}function Oke(e,t){if(e){if(typeof e=="string")return OI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OI(e,t)}}function OI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $ke(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
315
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Nke={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},Lke={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-60,d:0,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:660,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{a:"Asia/Urumqi",c:["AQ"],r:1},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:360,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{u:480,c:["MN"]},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",c:["CN"],r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:360,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN","AQ"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{u:60,d:120},CST6CDT:{u:-360,d:-300},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{u:120,d:180},EST:{u:-300},EST5EDT:{u:-300,d:-240},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:60,d:0,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{u:-600},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{u:60,d:120},MST:{u:-420},MST7MDT:{u:-420,d:-360},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{u:-480,d:-420},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{u:0,d:60},Zulu:{a:"Etc/UTC",r:1}},pg={countries:Nke,timezones:Lke},FS;function Dke(e,t){var n=e.countries[t];if(!n)return null;var r=Mke(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function Mke(e){return FS||(FS=Bke(e)),FS}function Bke(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,a=e.timezones[i]||{},l=o||a.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,s0({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function Fke(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=kh(kh({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:$I(c),dstOffset:u,dstOffsetStr:$I(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function $I(e){var t=Math.floor(e/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(NI(t),":").concat(NI(n))}function NI(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var zke=["allTimezones"],jke=Object.keys(pg.timezones).length,aC={},Df={},A8=0;function Uke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(pg.countries).reduce(function(t,n){return Object.assign(t,s0({},n,l0(n,e)))},{})}function Wke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return jke!==A8&&Object.keys(pg.timezones).forEach(c0),Kke(Df,e)}function l0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return aC[e]||Hke(Dke(pg,e)),Yke(aC[e],t)}function Hke(e){e&&(aC[e.id]=e)}function c0(e){return Df[e]||Vke(Fke(pg,e)),Df[e]?kh({},Df[e]):null}function Vke(e){e&&(Df[e.name]=e,A8=Object.keys(e).length)}function R8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=c0(e)||{},r=n.countries||[];return r.map(function(o){return l0(o,t)})}function Gke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=R8(e,t),r=_ke(n,1),o=r[0];return o||null}function qke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=l0(e,t);if(!n)return null;var r=n.timezones||[];return r.map(c0)}function Kke(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,s0({},i,e[i])),o},{})}function Yke(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=Rke(e,zke),i=r?e.allTimezones:e.timezones;return kh(kh({},o),{},{timezones:i})}var Xke={getCountry:l0,getTimezone:c0,getAllCountries:Uke,getAllTimezones:Wke,getTimezonesForCountry:qke,getCountriesForTimezone:R8,getCountryForTimezone:Gke};const Jke=S("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Qke=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(Xke.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[a,l]=g.useState(t||""),c=g.useMemo(()=>{const u=o.find(d=>d.key===i);return u!=null?`${u.key} (UTC ${u.utcOffset})`:"The time shown is in your local time zone according to your browser."},[o,i]);return t?x(le,{children:[s(dg,{children:"Select a date"}),x(Jke,{children:[s(cr,{id:"date",label:"Date",type:"datetime-local",value:Vxe(a),onChange:u=>{r("");const d=XM(u.target.value),p=d==null?void 0:d.toISOString();p&&l(p),p&&e(p)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),s("p",{children:c})]})]}):null},_8=Ns()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),Zke="Enter",LI=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,a]=g.useState(""),{classes:l}=_8(),c=d=>{d.key===Zke&&(d.preventDefault(),u())},u=()=>{const d=tAe([...e,...Zs(i)]);d.length===0?o("values cannot be empty"):d.some(p=>p.length>100)?o("values cannot be longer than 100 characters"):(o(""),a(""),n(d))};return x("div",{children:[s(dg,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),x("div",{className:l.inputContainer,children:[s("div",{className:l.inputInnerContainer,children:s(cr,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>a(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),s(Ve,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),s("div",{className:l.valuesContainer,children:s(eAe,{values:e,removeValue:t})})]})},eAe=({values:e,removeValue:t})=>{const{classes:n}=_8();return s(le,{children:e.map((r,o)=>s(Os,{label:s(Pa,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},tAe=e=>Array.from(new Set(e)),wk=({filter:e,setFilter:t})=>x("div",{style:{display:"flex",alignItems:"center"},children:[s("div",{style:{width:"300px"},children:s(vn,{label:"Search",name:"search",value:e,onChange:n=>t(n.target.value),placeholder:"Filter values",style:{width:"100%",margin:"1rem 0"},variant:"outlined",size:"small",InputProps:{startAdornment:s(bE,{position:"start",children:s(QE,{})})}})}),s(V,{condition:!!e,show:s(Os,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),nAe=Ns()(e=>({container:{display:"inline-block",wordBreak:"break-word"},value:{lineHeight:1.33,fontSize:e.fontSizes.smallBody},description:{lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active}})),P8=({legal:e,control:t})=>{const{classes:n}=nAe();return s("div",{className:n.container,children:s(Gr,{value:e.value,control:t,label:x(le,{children:[s("div",{className:n.value,children:e.value}),s("div",{className:n.description,children:e.description})]})})})},I8=(e,t)=>e.filter(n=>n.value.includes(t)),zS=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),O8=e=>new Set(e.map(({value:t})=>t)),$8=(e,t)=>{const n=O8(t);return e.filter(r=>n.has(r))},rAe=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[a,l]=g.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=I8(c,a),[p,h]=g.useState(()=>zS(t)),{classes:f}=eg(),m=v=>{const w=O8(u);return(v==null?void 0:v.filter(C=>!w.has(C)))||[]},y=$8(i,u);g.useEffect(()=>{h(zS(t))},[t,h,zS]),g.useEffect(()=>{y.length>0&&n(m(t))},[]);const b=v=>{if(o(""),p[v]){const w=t.findIndex(T=>T===v),C=[...t];C.splice(w,1),n(C);return}n([...m(t),v])};return x(le,{children:[s(V,{condition:!!(y&&y.length>0),show:x(Lt,{severity:"warning",children:["This constraint is using legal values that have been deleted as valid options. If you save changes on this constraint and then save the strategy the following values will be removed:",s("ul",{children:y==null?void 0:y.map(v=>s("li",{children:v},v))})]})}),s(dg,{children:"Select values from a predefined set"}),s(V,{condition:c.length>100,show:s(wk,{filter:a,setFilter:l})}),d.map(v=>s(P8,{legal:v,control:s(ts,{checked:!!p[v.value],onChange:()=>b(v.value),name:v.value,color:"primary",disabled:u.map(({value:w})=>w).includes(v.value)})},v.value)),s(V,{condition:!!r,show:s("p",{className:f.error,children:r})})]})},DI=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:a,constraintValue:l})=>{const[c,u]=g.useState(""),{classes:d}=eg(),p=I8(r,c),{deletedLegalValues:h}=a,f=$8([l],h);return x(le,{children:[s(V,{condition:!!(f&&f.length>0),show:x(Lt,{severity:"warning",sx:m=>({marginTop:m.spacing(1)}),children:[" ","This constraint is using legal values that have been deleted as a valid option. Please select a new value from the remaining predefined legal values. The constraint will be updated with the new value when you save the strategy."]})}),x(dg,{children:["Add a single ",n.toLowerCase()," value"]}),s(V,{condition:r.length>100,show:s(wk,{filter:c,setFilter:u})}),s(V,{condition:!!r.length,show:s($s,{component:"fieldset",children:s(EE,{"aria-label":"selected-value",name:"selected",value:t,onChange:m=>{i(""),e(m.target.value)},children:p.map(m=>s(P8,{legal:m,control:s(dc,{})},m.value))})}),elseShow:s("p",{children:"No valid legal values available for this operator."})}),s(V,{condition:!!o,show:s("p",{className:d.error,children:o})})]})},oAe=Ns()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),MI=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=oAe();return x(le,{children:[x(dg,{children:["Add a single ",n.toLowerCase()," value"]}),s("div",{className:i.singleValueContainer,children:s(cr,{label:n,name:"value",value:t||"",onChange:a=>{o(""),e(a.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},jS=(e,t)=>{if((t==null?void 0:t.length)===0)return{legalValues:[],deletedLegalValues:[]};const n=(e||[]).filter(r=>!(t||[]).some(({value:o})=>o===r)).map(r=>({value:r,description:""}));return{legalValues:t||[],deletedLegalValues:n}},iAe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:a,setError:l,removeValue:c,error:u})=>s(le,{children:(()=>{var p;switch(e){case iC:case b8:return s(le,{children:s(rAe,{data:jS(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:a,error:u,setError:l})});case S8:return s(le,{children:s(DI,{data:jS([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(h=>Number(h.value)))||[],error:u,setError:l})});case w8:return s(le,{children:s(DI,{data:jS([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case x8:return s(Qke,{value:o.value,setValue:i,error:u,setError:l});case C8:return s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l});case E8:return s(le,{children:s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l})});case T8:return s(MI,{setValue:i,value:o.value,type:"number",error:u,setError:l});case k8:return s(MI,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}})()}),N8="cancel",BI="save",FI=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},aAe=S("div")({padding:0,margin:0,width:"100%"}),sAe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.elevation1,boxShadow:"none",margin:0,"& .expanded":{"&:before":{opacity:"0 !important"}}})),lAe=S(v1)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),cAe=S(m1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),uAe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,a]=g.useState(nI(e)),{context:l}=ma(),[c,u]=g.useState(FI(l,i.contextName)),{validateConstraint:d}=qd(),[p,h]=g.useState(!1),[f,m]=g.useState("");g.useEffect(()=>{h(!0)},[]),g.useEffect(()=>{u(FI(l,i.contextName))},[i.contextName,l]);const y=g.useCallback(M=>{a(B=>({...B,contextName:M,values:[],value:""}))},[]),b=g.useCallback(M=>{a(B=>({...B,operator:M,values:[],value:""}))},[]),v=g.useCallback(M=>{a(B=>({...B,values:M}))},[]),w=g.useCallback(M=>{a(B=>({...B,value:M}))},[]),C=()=>{a(M=>({...M,inverted:!M.inverted}))},T=g.useCallback(()=>{a(M=>({...M,caseInsensitive:!M.caseInsensitive}))},[]),A=g.useCallback(M=>{const B=[...i.values];B.splice(M,1),v(B)},[i,v]),k=()=>{h(!1)},_=()=>{const M=Array.isArray(i.values)&&i.values.length>0,B=!!i.value;return M||B?($(""),!0):($("You must provide a value for the constraint"),!1)},P=async()=>{if(!_())return;const[B,q]=O();if(B||$(q),B)try{await d(i),$(""),m(BI),k();return}catch(Y){$(vt(Y))}},{input:I,validator:O,setError:$,error:F}=Tke({contextDefinition:c,localConstraint:i});return g.useEffect(()=>{$(""),a(M=>nI(M))},[i.operator,i.contextName,$]),s(aAe,{children:x(sAe,{expanded:p,TransitionProps:{onExited:()=>{f===N8?(m(""),n()):f===BI&&(m(""),r(i))}},children:[s(lAe,{children:s(w2e,{localConstraint:i,setLocalConstraint:a,setContextName:y,setOperator:b,action:f,compact:t,setInvertedOperator:C,setCaseInsensitive:T,onDelete:o})}),s(cAe,{children:s(e2e,{localConstraint:i,setValues:v,setValue:w,triggerTransition:k,setAction:m,onSubmit:P,children:s(iAe,{setValues:v,setValue:w,setError:$,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:I,error:F,contextDefinition:c,removeValue:A})})})]})})},L8=(e,t)=>e.value&&e.contextName===Th?B1(e.value,t.locale):e.value,dAe=S(Pa)({whiteSpace:"pre"}),pAe=S(Os)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),fAe=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:x(le,{children:[s(V,{condition:e.length>20,show:s(wk,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>s(pAe,{label:s(dAe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},hAe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),gAe=S("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),mAe=S(Os)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),yAe=({value:e,operator:t})=>e?x(hAe,{children:[x(gAe,{children:["Value must be ",t]})," ",s(mAe,{label:s(Pa,{maxWidth:"400",text:e,maxLength:50})})]}):null,vAe=S("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),bAe=({constraint:e})=>{const{locationSettings:t}=ha();return s("div",{children:x(vAe,{children:[s(fAe,{values:e.values}),s(yAe,{value:L8(e,t),operator:e.operator})]})})},SAe=S("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),wAe=S("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),xAe=S("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),CAe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=rC(e.operator);return x(SAe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[s(wAe,{disabled:n,children:r}),s(xAe,{disabled:n,children:o})]})},D8=S("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation2,width:24,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"stretch",color:e.palette.primary.main,marginLeft:e.spacing(1),borderRadius:e.shape.borderRadius})),EAe=S(D8)(()=>({marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),zI=g.forwardRef(({isPrefix:e,...t},n)=>s(V,{condition:!!e,show:()=>s(EAe,{ref:n,...t}),elseShow:()=>s(D8,{ref:n,...t})})),TAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),kAe=S("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),AAe=({constraint:e,disabled:t=!1})=>x(TAe,{children:[s(V,{condition:!!e.inverted,show:s(yt,{title:"Operator is negated",arrow:!0,children:s(ye,{sx:{display:"flex"},children:s(zI,{isPrefix:!0,children:s(a8,{})})})})}),s(kAe,{children:s(CAe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),s(V,{condition:!e.caseInsensitive&&Mn(ws,e.operator),show:s(yt,{title:"Case sensitive is active",arrow:!0,children:s(zI,{children:s(c8,{})})})})]}),RAe=S(Os)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),_Ae=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),PAe=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=ha();return g.useEffect(()=>{t(!1)},[t]),s(_Ae,{children:s(RAe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:L8(e,r)})})},IAe=S("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,margin:"auto 0",[e.breakpoints.down("sm")]:{margin:e.spacing(1,0),textAlign:"center"}})),OAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),$Ae=S("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),NAe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),LAe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,a]=g.useState(!1),l=g.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return g.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),a(((l==null?void 0:l.length)??0)>r))},[l,r,n,a]),s(OAe,{children:x($Ae,{children:[s(IAe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),s(V,{condition:i,show:s(NAe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},DAe=S("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",maxWidth:"100px",minWidth:"100px",marginRight:"10px",marginTop:"auto",marginBottom:"auto",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,[e.breakpoints.down(710)]:{textAlign:"center",padding:e.spacing(1,0),marginRight:"inherit",maxWidth:"inherit"}})),MAe=S("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),BAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),FAe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>s(MAe,{children:x(BAe,{children:[s(yt,{title:e.contextName,arrow:!0,children:s(DAe,{sx:a=>({color:o?a.palette.text.secondary:"inherit"}),children:e.contextName})}),s(AAe,{constraint:e,disabled:o}),s(V,{condition:t,show:s(PAe,{constraint:e,allowExpand:n,disabled:o}),elseShow:s(LAe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),zAe=Bc("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),jAe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:a,disabled:l})=>{const{context:c}=ma(),{contextName:u}=e,d=!c.map(p=>p.name).includes(u);return x(zAe,{children:[s(o8,{compact:a,disabled:l}),s(FAe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),s(u8,{onEdit:t,onDelete:n,disableEdit:d})]})},UAe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),WAe=S(v1)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto","-webkit-user-select":"auto","-moz-user-select":"auto","-ms-user-select":"auto"})),HAe=S(m1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),VAe=S("div")({display:"flex",flexDirection:"column",width:"100%"}),GAe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:a})=>{const[l,c]=g.useState(!0),[u,d]=g.useState(!1),p=Mn([...Vu,...Hu,...$i],e.operator);return x(UAe,{expanded:u,sx:r,children:[s(WAe,{expandIcon:null,onClick:()=>{l&&d(!u)},sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:x(VAe,{children:[s(jAe,{constraint:e,onEdit:t,onDelete:n,singleValue:p,allowExpand:c,disabled:i,expanded:u,compact:o}),a]})}),s(HAe,{children:s(bAe,{constraint:e})})]})},qAe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:a})=>e?s(V,{condition:!!(n&&a),show:s(uAe,{constraint:e,onCancel:o,onSave:a,onDelete:i,compact:t}),elseShow:s(GAe,{constraint:e,onEdit:r,onDelete:i})}):null,KAe=e=>{const t=g.useRef(e??new WeakMap),[,n]=g.useState(0),r=g.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=g.useCallback(i=>t.current.get(i),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},M8=e=>(US.has(e)||(jI++,US.set(e,jI)),US.get(e)),US=new WeakMap;let jI=0;const YAe=e=>{const t=i8(e)[0],n=Mn($i,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1}},B8=S("div")(({theme:e})=>({padding:e.spacing(.75,1),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:"50%",left:e.spacing(2),transform:"translateY(-50%)",lineHeight:1})),XAe=S(B8)(({theme:e})=>({top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.75,1.5)})),xk=({text:e})=>{const t=on();return s(ye,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:s(V,{condition:e==="AND",show:()=>s(B8,{children:e}),elseShow:()=>s(XAe,{children:e})})})},F8="constraintAccordionListId",JAe=S("div")({width:"100%",display:"flex",flexDirection:"column"}),QAe=S(yt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),ZAe=S(jy)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),eRe=S("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),tRe=S("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),fg=g.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const i=KAe(),{context:a}=ma(),l=t&&(f=>{const m=YAe(f);i.set(m,{editing:!0,new:!0}),t(y=>[...y,m])});g.useImperativeHandle(o,()=>({addConstraint:l}));const c=l&&(()=>{l(a[0].name)}),u=t&&(f=>{i.set(f,{editing:!0})}),d=t&&(f=>{const m=e[f];i.set(m,{}),t(ki(y=>{y.splice(f,1)}))}),p=t&&((f,m)=>{i.set(m,{}),t(ki(y=>{y[f]=m}))}),h=f=>{var y;const m=e[f];(y=i.get(m))!=null&&y.new&&(d==null||d(f)),i.set(m,{})};return a.length===0?null:x(JAe,{id:F8,children:[s(V,{condition:e&&e.length>0&&r,show:s(eRe,{children:"Constraints"})}),e.map((f,m)=>{var y;return x(g.Fragment,{children:[s(V,{condition:m>0,show:s(xk,{text:"AND"})}),s(qAe,{constraint:f,onEdit:u==null?void 0:u.bind(null,f),onCancel:h.bind(null,m),onDelete:d==null?void 0:d.bind(null,m),onSave:p==null?void 0:p.bind(null,m),editing:!!((y=i.get(f))!=null&&y.editing),compact:!0})]},M8(f))}),s(V,{condition:!!(n&&c),show:x("div",{children:[x(tRe,{children:[s("p",{children:"Add any number of constraints"}),s(QAe,{title:"View constraints documentation",arrow:!0,children:s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:s(ZAe,{})})})]}),s(Ve,{type:"button",onClick:c,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),nRe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{const o=g.useMemo(()=>n.constraints??[],[n]),i=c=>{r(u=>({...u,constraints:c instanceof Function?c(o):c}))},a=ld(m9,e,t),l=ld(z1,e,t);return s(fg,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},UI=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},Ck=e=>{const t=!!(e&&e.length===0),[n,r]=g.useState(t),{validateConstraint:o}=qd();return g.useEffect(()=>{if(!e)return;if(e.find(l=>!UI(l))){r(!1);return}const a=e.filter(UI).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Ml=e=>{xt();const t=wt(e?`api/admin/segments/strategies/${e}`:"api/admin/segments"),{data:n,error:r,mutate:o}=An(t,()=>rRe(t),{refreshInterval:15*1e3}),i=g.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:i,loading:!r&&!n,error:r}},rRe=async e=>fetch(e).then(fn("Segments")).then(t=>t.json()).then(t=>t.segments),oRe=Ns()(e=>({inputRoot:{height:48,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTopRightRadius:50,borderBottomRightRadius:50,"& fieldset":{borderColor:e.palette.divider,borderLeftColor:"transparent"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:1}}})),iRe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),aRe=S("div",{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({background:t?e.palette.primary.light:e.palette.primary.main,height:"48px",width:"48px",display:"flex",alignItems:"center",justifyContent:"center",paddingLeft:6,borderTopLeftRadius:"40px",borderBottomLeftRadius:"40px",color:e.palette.primary.contrastText})),sRe=S(Od)({flex:1}),z8=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const{classes:i}=oRe(),a=l=>s(vn,{...l,variant:"outlined",label:e});return x(iRe,{children:[s(aRe,{$disabled:!!o,"aria-hidden":!0,children:s(QE,{})}),s(sRe,{classes:{inputRoot:i.inputRoot},options:t,value:n,popupIcon:s(Sce,{titleAccess:"Toggle"}),onChange:(l,c)=>r(c||[]),renderInput:a,getOptionLabel:l=>l.label,disabled:o,size:"small",multiple:!0})]})},lRe=S("span")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),paddingInlineStart:e.spacing(2),paddingInlineEnd:e.spacing(1),paddingBlockStart:e.spacing(.5),paddingBlockEnd:e.spacing(.5),borderRadius:"100rem",background:e.palette.primary.main,color:e.palette.primary.contrastText})),WI=S("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),cRe=S(qt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),WS=e=>({fontSize:e.fontSizes.bodySize}),uRe=({segment:e,setSegments:t,preview:n,setPreview:r})=>{const o=()=>{t(c=>c.filter(u=>u.id!==e.id)),r(c=>c===e?void 0:c)},i=()=>{r(c=>c===e?void 0:e)},a=s(V,{condition:e===n,show:s($D,{titleAccess:"Hide",sx:WS}),elseShow:s(OD,{titleAccess:"Show",sx:WS})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return x(lRe,{children:[s(cRe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s(yt,{title:l,arrow:!0,children:s(WI,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":F8,children:a})}),s(yt,{title:"Remove segment",arrow:!0,children:s(WI,{type:"button",onClick:o,children:s(xce,{titleAccess:"Remove",sx:WS})})})]})},dRe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light}})),pRe=S(v1)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),fRe=S(qt)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),hRe=S("span",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({color:t?e.palette.text.secondary:"inherit"})),j8=({segment:e,isExpanded:t,headerContent:n,constraintList:r,disabled:o=!1})=>{var l;const[i,a]=g.useState(t||!1);return x(dRe,{expanded:i,children:[x(pRe,{id:`segment-accordion-${e.id}`,children:[s(TD,{sx:c=>({mr:1,color:o?c.palette.neutral.border:c.palette.secondary.main})}),s(hRe,{disabled:o,children:"Segment:"}),s(fRe,{to:`/segments/edit/${e.id}`,children:e.name}),s(V,{condition:!!n,show:n}),s(V,{condition:!t,show:s(Ve,{size:"small",variant:"outlined",onClick:()=>a(c=>!c),sx:{my:0,ml:"auto",fontSize:c=>c.typography.body2.fontSize},children:i?"Close preview":"Preview"})})]}),s(m1,{sx:{pt:0},children:s(V,{condition:!!r,show:r,elseShow:s(V,{condition:(((l=e==null?void 0:e.constraints)==null?void 0:l.length)||0)>0,show:s(fg,{constraints:e.constraints,showLabel:!1}),elseShow:s(re,{children:"This segment has no constraints."})})})})]})},gRe=S("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),mRe=S("p")(({theme:e})=>({color:e.palette.text.secondary})),yRe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,padding:e.spacing(.75,1),display:"block",marginTop:"auto",marginBottom:"auto",alignItems:"center",borderRadius:e.shape.borderRadius,lineHeight:1,color:e.palette.text.primary,backgroundColor:e.palette.background.elevation2})),vRe=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1;return e.length===0?null:x(le,{children:[s(V,{condition:e&&e.length>0,show:s(mRe,{children:"Selected Segments"})}),s(gRe,{children:e.map((i,a)=>x(g.Fragment,{children:[s(uRe,{segment:i,setSegments:t,preview:n,setPreview:r}),s(V,{condition:a<o,show:s(yRe,{children:"AND"})})]},i.id))}),s(V,{condition:!!n,show:()=>s(j8,{segment:n,isExpanded:!0})})]})},qc=()=>{const{uiConfig:e}=xt();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},bRe=()=>{const{segmentValuesLimit:e}=qc();return typeof e>"u"?null:x(Lt,{severity:"info",children:["A segment can have"," ",x("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",s(U8,{})]})},SRe=e=>{const{segmentValuesLimit:t}=qc();return typeof t>"u"?null:x(Lt,{severity:"error",children:["A segment can have"," ",x("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},wRe=()=>{const{strategySegmentsLimit:e}=qc();return typeof e>"u"?null:x(Lt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s(U8,{})]})},U8=()=>x(le,{children:[s("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),W8="https://docs.getunleash.io/reference/segments",xRe=S(Er)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),CRe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Ml(),{strategySegmentsLimit:o}=qc(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name}));return x(le,{children:[s(re,{component:"h3",sx:{m:0},variant:"h3",children:"Segmentation"}),i&&s(wRe,{}),s("p",{children:"Add a predefined segment to constrain this feature toggle:"}),s(z8,{label:"Select segments",options:c,onChange:([d])=>{const p=r.find(h=>String(h.id)===d.value);p&&t(h=>[...h,p])},disabled:i}),s(vRe,{segments:e,setSegments:t}),s(xRe,{})]})},ERe=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!TRe(t))return"Not a valid number."}},TRe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),Ek=e=>{const{data:t,error:n,mutate:r}=An(e?wt(`api/admin/strategies/${e}`):null,kRe),o=g.useCallback(()=>{r().catch(console.warn)},[r]);return{strategyDefinition:t,refetchStrategy:o,loading:!n&&!t,error:n}},kRe=e=>fetch(e).then(fn("Strategy")).then(t=>t.json()),ARe=({environment:e})=>x(Lt,{severity:"info",children:[s("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),sC="production",RRe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:a}=Tk(),[l,c]=g.useState(i.hide);return x(Zn,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s(Lt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s(Gr,{label:"Don't show again",control:s(ts,{checked:l,onChange:()=>{a(d=>({hide:!d.hide})),c(d=>!d)}})})]})},_Re=(e,t)=>{var r;const{value:n}=Tk();return n.hide?!1:typeof e=="string"?e===sC:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===sC)},PRe="useFeatureStrategyProdGuardSettings:v2",Tk=()=>rs(PRe,{hide:!1}),pje=e=>{const{value:t}=Tk();return e===sC&&!t.hide},IRe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Mn(["In review","Approved"],r.state)):!1,alert:s(Lt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),H8=(e,t,n,r={})=>{const{isEnterprise:o}=xt();return Uc(o(),e,t,n,r)},ORe=e=>fetch(e).then(fn("ChangeRequest")).then(t=>t.json()),u0=e=>{const{data:t,error:n,mutate:r}=H8([],wt(`api/admin/projects/${e}/change-requests/pending`),ORe);return{data:t,loading:!n&&!t,refetch:r,error:n}},$Re=({title:e,setTitle:t})=>x(ye,{sx:{paddingBottom:n=>n.spacing(2)},children:[s(re,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s(cr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),NRe=({enabled:e,onToggleEnabled:t})=>s(Gr,{control:s(pa,{name:"enabled",onChange:t,checked:e}),label:"Enabled – This strategy will be used when evaluating feature toggles."}),LRe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),DRe=function(e){return"/"+e},HI={},Yd=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=DRe(i),i in HI)return;HI[i]=!0;const a=i.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let d=o.length-1;d>=0;d--){const p=o[d];if(p.href===i&&(!a||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":LRe,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})},MRe=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s(vn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},BRe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%",alignItems:"flex-start"}}})),FRe=S(Z1)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),zRe=S("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),jRe=S(MRe)(()=>({width:"100%"})),URe=S(vn)(()=>({width:"100%"})),WRe=({overrides:e,overridesDispatch:t})=>{const{context:n}=ma(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s(le,{children:e.map((a,l)=>{var p;const c=n.find(({name:h})=>h===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:h})=>h))||[],d=a.values.filter(h=>u.includes(h));return x(BRe,{children:[s(FRe,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:h=>t({type:"UPDATE_TYPE_AT",payload:[l,h.target.value]})}),x(zRe,{children:[s(V,{condition:!!(u&&u.length>0),show:s(Od,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(h,f)=>h===f,options:u,onChange:i(l),getOptionLabel:h=>h,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:h=>s(URe,{...h,variant:"outlined",label:"Legal values"})}),elseShow:s(jRe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s(yt,{title:"Remove",arrow:!0,children:s(Ft,{onClick:h=>{h.preventDefault(),t({type:"REMOVE",payload:l})},children:s(vo,{})})})]})]},`override=${l}`)})})},HRe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},VRe=(e=[])=>g.useReducer(HRe,e);var ds=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ds||{});const hg=e=>{var n;const{uiConfig:t}=xt();return((n=t==null?void 0:t.flags)==null?void 0:n[e])||!1},GRe=Te.lazy(()=>Yd(()=>import("./ReactJSONEditor-deab371a.js"),[])),qRe=S("div")(({theme:e})=>({position:"relative",backgroundColor:e.palette.neutral.light,display:"flex",flexDirection:"column",padding:e.spacing(3),marginBottom:e.spacing(3),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden"})),KRe=S("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),YRe=S(yt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),V8=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),VI=S(V8)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),XRe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),JRe=S(Gr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),QRe=S("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),GI=S(cr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),ZRe=S("div")(({theme:e})=>({marginLeft:e.spacing(3)})),e_e=S(cr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),t_e=S("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),G8=S("div")(({theme:e})=>({display:"flex",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%"}}})),n_e=S(G8)({alignItems:"end",justifyContent:"space-between"}),r_e=S(Z1)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),o_e=S(Ve)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),HS=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"}],i_e={type:"string",value:""},a_e=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a})=>{const[l,c]=g.useState(e.name),[u,d]=g.useState(e.weightType===ds.FIX),[p,h]=g.useState(String(e.weight/10)),[f,m]=g.useState(e.payload||i_e),[y,b]=VRe("overrides"in e?e.overrides||[]:[]),{context:v}=ma(),[w,C]=g.useState({}),T=hg("variantTypeNumber");g.useEffect(()=>{T&&!HS.some(H=>H.key==="number")&&HS.push({key:"number",label:"number"})},[T]);const A=H=>{C(j=>({...j,[H]:void 0}))},k=(H,j)=>{C(W=>({...W,[H]:j}))};g.useEffect(()=>{A("percentage"),o!=null&&o.includes("%")&&k("percentage","Total weight must equal 100%")},[o]);const _=!e.new,P=t.filter(({id:H,weightType:j})=>H!==e.id&&j===ds.VARIABLE).length>0,I=H=>{const j=H.weightType===ds.VARIABLE,W=t.some(N=>N.weightType===ds.FIX),R=t.filter(N=>N.weightType===ds.VARIABLE).length===1;return W&&R&&j},O=H=>{A("name"),q(H,e.id)||k("name","A variant with that name already exists for this environment."),c(H.trim())},$=H=>{(H===""||Y(H))&&h(H)},F=H=>{ne(H)||k("payload",H.type==="json"?"Invalid json":"Invalid number")},M=()=>{v.length>0&&b({type:"ADD",payload:{contextName:v[0].name,values:[]}})},B=H=>!!H.length,q=(H,j)=>_||!t.some(W=>W.name===H&&W.id!==j),Y=H=>{if(!u)return!0;if(H===""||H.match(/\.[0-9]{2,}$/))return!1;const j=Number(H);return j>=0&&j<=100},ne=H=>{try{return H.type==="json"&&JSON.parse(H.value),T&&H.type==="number"?!Number.isNaN(Number(H.value)):!0}catch{return!1}};return g.useEffect(()=>{const H={...e,name:l,weight:Number(u?p:100)*10,weightType:u?ds.FIX:ds.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:f.value?f:void 0,isValid:B(l)&&q(l,e.id)&&Y(p)&&ne(f)&&!o};i||(H.overrides=y.map(j=>({contextName:j.contextName,values:j.values})).filter(j=>j.values&&j.values.length>0)),n(H)},[l,u,p,f,y]),g.useEffect(()=>{u||h(String(e.weight/10))},[e.weight]),x(qRe,{"data-testid":"VARIANT",children:[s(KRe,{color:a}),s(YRe,{arrow:!0,title:I(e)?"You need to have at least one variable variant":"Delete variant",children:s("div",{children:s(Ft,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:I(e),children:s(vo,{})})})}),x(n_e,{children:[x(t_e,{children:[s(V8,{children:"Variant name"}),s(XRe,{children:"This will be used to identify the variant in your code"}),s(GI,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:H=>O(H.target.value),disabled:_,required:!0})]}),s(V,{condition:P,show:x(ZRe,{children:[s(JRe,{label:"Custom percentage",control:s(pa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:H=>d(H.target.checked)})}),s(e_e,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:p,onChange:H=>$(H.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s(bE,{position:"end",children:"%"})}})]})})]}),x(VI,{children:["Payload",s(Rs,{tooltip:"Passed along with the the variant object."})]}),x(G8,{children:[s(r_e,{id:"variant-payload-type",name:"type",label:"Type",value:f.type,options:HS,onChange:H=>{A("payload"),m(j=>({...j,type:H.target.value}))}}),s(QRe,{children:s(V,{condition:f.type==="json",show:s(g.Suspense,{fallback:null,children:s(GRe,{content:{text:f.value},onChange:H=>m(j=>{var W;return{...j,value:"json"in H?((W=H.json)==null?void 0:W.toString())||"":H.text}})})}),elseShow:s(GI,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:f.type!=="string",rows:f.type==="string"||f.type==="number"?1:4,value:f.value,onChange:H=>{A("payload"),m(j=>({...j,value:H.target.value}))},placeholder:"",onBlur:()=>F(f),error:!!w.payload,errorText:w.payload})})})]}),i?null:x(le,{children:[x(VI,{children:["Overrides",s(Rs,{tooltip:"Here you can specify which users should get this variant."})]}),s(WRe,{overrides:y,overridesDispatch:b}),s("div",{children:s(o_e,{onClick:M,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})};let km;const s_e=new Uint8Array(16);function l_e(){if(!km&&(km=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!km))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return km(s_e)}const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function c_e(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}const u_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qI={randomUUID:u_e};function KI(e,t,n){if(qI.randomUUID&&!t&&!e)return qI.randomUUID();e=e||{};const r=e.random||(e.rng||l_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return c_e(r)}const d_e=S(ye)(()=>({display:"flex",width:"100%",position:"relative"})),p_e=S(ye)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),f_e=S(ye)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),h_e=S(ye,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({height:e.spacing(1.8),width:"100%",position:"relative",background:e.palette.variants[t%e.palette.variants.length]})),g_e=S(ye)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),YI=S(re)(({theme:e})=>({marginY:e.spacing(1)})),m_e=S(ye)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),q8=S(ye,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",marginRight:e.spacing(2),"& div":{width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",marginRight:e.spacing(1),background:e.palette.variants[t%e.palette.variants.length]}})),y_e=S(re)(({theme:e})=>({marginTop:e.spacing(1)})),v_e=({variants:e})=>e.length<1?null:x(ye,{sx:t=>({marginTop:t.spacing(2)}),children:[s(b_e,{variants:e}),x(d_e,{children:[s(p_e,{}),e.map((t,n)=>{const r=t.weight/10;return s(Ll,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:s(E_e,{variant:t,index:n}),children:x(ye,{style:{width:`${r}%`},children:[" ",x(f_e,{children:[s(h_e,{index:n}),x(y_e,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),b_e=({variants:e})=>x(g_e,{children:[x(YI,{variant:"body2",children:["Feature variants (",e.length,")"]}),s(m_e,{children:e.map((t,n)=>x(q8,{index:n,children:[s(ye,{}),s(YI,{variant:"body2",children:t.name})]},n))})]}),S_e=S(ye)(()=>({display:"flex",flexDirection:"column"})),w_e=S(ye)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),x_e=S(ye)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),C_e=S(re)(({theme:e})=>({marginBottom:e.spacing(1)})),E_e=({variant:e,index:t})=>x(S_e,{children:[x(w_e,{children:[s(q8,{index:t,children:s(ye,{})}),x(re,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?x(x_e,{children:[s(C_e,{variant:"body2",children:"Payload"}),s(V,{condition:e.payload.type==="json",show:s("code",{children:e.payload.value}),elseShow:s(re,{variant:"body2",children:e.payload.value})})]}):null]}),T_e=()=>x(Lt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s(k_e,{}),"."]}),fje=()=>x(Lt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s("b",{children:"variants inside strategies"}),". ",s(A_e,{})]}),k_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),A_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),R_e=S("div")({display:"flex",flexDirection:"column"}),__e=({strategy:e,setStrategy:t,projectId:n,environment:r})=>{const{trackEvent:o}=Bn(),[i,a]=g.useState([]),l=on(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{a((e.variants||[]).map(p=>({...p,new:!1,isValid:!0,id:KI(),overrides:[]})))},[]),g.useEffect(()=>{t(p=>({...p,variants:i.map(h=>({stickiness:c,name:h.name,weight:h.weight,payload:h.payload,weightType:h.weightType}))}))},[c,JSON.stringify(i)]);const u=(p,h)=>{a(f=>H3(f.map(m=>m.id===h?p:m),1e3))},d=()=>{const p=KI();a(h=>[...h,{name:"",weightType:ds.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:p}]),o("strategy-variants",{props:{eventType:"variant added"}})};return x(le,{children:[x(re,{component:"h3",sx:{m:0,display:"flex",gap:"1ch"},variant:"h3",children:["Variants",s(Rs,{htmlTooltip:!0,tooltip:x(le,{children:[s("span",{children:"Variants allow to attach one or more values to this strategy. Variants at the strategy level override variants at the feature level."}),s($r,{target:"_blank",href:"https://docs.getunleash.io/reference/strategy-variants",children:"Learn more"})]})})]}),x(R_e,{children:[s(T_e,{}),i.map((p,h)=>s(a_e,{disableOverrides:!0,variant:p,variants:i,updateVariant:f=>u(f,p.id),removeVariant:()=>a(f=>H3(f.filter(m=>m.id!==p.id),1e3)),decorationColor:l.palette.variants[h%l.palette.variants.length]},p.id))]}),s(Io,{onClick:d,variant:"outlined",permission:y9,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",children:"Add variant"}),s(v_e,{variants:i})]})},P_e=S("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),Up=S("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),I_e=S("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),K8=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:h})=>{const{trackEvent:f}=Bn(),[m,y]=g.useState(!1),b=Ck(l.constraints),v=_Re(t,n),w=ld(r,e,n),{strategyDefinition:C}=Ek(l==null?void 0:l.name),{data:T}=u0(t.project),{changeRequestInReviewOrApproved:A,alert:k}=IRe(T),_=A(n||""),P=_?"Add to existing change request":"Add change to draft",I=pt(),{uiConfig:O,error:$,loading:F}=xt();if($)throw $;if(F||!C)return null;const M=H=>C.parameters.find(j=>j.name===H),B=(H,j)=>{const W=ERe(M(H),j);return W?(p.setFormError(H,W),!1):(p.removeFormError(H),!0)},q=()=>C.parameters.map(H=>H.name).map(H=>{var j;return B(H,(j=l.parameters)==null?void 0:j[H])}).every(Boolean),Y=()=>{I(kk(t.project,t.name))};return x(P_e,{onSubmit:async H=>{var j;Array.isArray(l.variants)&&((j=l.variants)==null?void 0:j.length)>0&&f("strategy-variants",{props:{eventType:"submitted"}}),H.preventDefault(),q()&&(v&&!h?y(!0):o())},children:[s(V,{condition:_,show:k,elseShow:s(V,{condition:!!h,show:s(ARe,{environment:n})})}),s(HCe,{projectId:t.project,featureId:t.name,environmentId:n,children:s(V,{condition:!!h,show:x(Lt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:x(Lt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",s("strong",{children:"save"}),"."]})})}),s(Up,{}),s($Re,{title:l.title||"",setTitle:H=>{c(j=>({...j,title:H}))}}),s(CRe,{segments:u,setSegments:d,projectId:e}),s(nRe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c}),s(Up,{}),s(zCe,{strategy:l,strategyDefinition:C,setStrategy:c,validateParameter:B,errors:p,hasAccess:w}),s(Up,{}),s(V,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:s(__e,{strategy:l,setStrategy:c,environment:n,projectId:e})}),s(Up,{}),s(NRe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(H=>({...H,disabled:!H.disabled}))}),s(Up,{}),x(I_e,{children:[s(Io,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:a||!b||p.hasFormErrors(),"data-testid":wse,children:h?P:"Save strategy"}),s(Ve,{type:"button",color:"primary",onClick:i||Y,disabled:a,children:"Cancel"}),s(RRe,{open:m,onClose:()=>y(!1),onClick:o,loading:a,label:"Save strategy"})]})]})},XI=e=>{const t=new URLSearchParams(window.location.search).get(e);if(!t)throw new Error(`Missing required query param: ${e}`);return t},O_e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{addStrategyToFeature:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies`,m=t(f,{method:"POST",body:JSON.stringify(h)},"addStrategyToFeature");return(await e(m.caller,m.id)).json()},updateStrategyOnFeature:async(u,d,p,h,f)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,y=t(m,{method:"PUT",body:JSON.stringify(f)},"updateStrategyOnFeature");await e(y.caller,y.id)},deleteStrategyFromFeature:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,m=t(f,{method:"DELETE"},"deleteStrategyFromFeature");await e(m.caller,m.id)},setStrategiesSortOrder:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/set-sort-order`,m=t(f,{method:"POST",body:JSON.stringify(h)},"setStrategiesSortOrderOnFeature");await e(m.caller,m.id)},setStrategyDisabledState:async(u,d,p,h,f)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,y=t(m,{method:"PATCH",body:JSON.stringify([{path:"/disabled",value:f,op:"replace"}])},"setStrategyDisabledState");await e(y.caller,y.id)},loading:r,errors:n}},Y8=()=>{const[e,t]=g.useState({}),n=g.useCallback(a=>e[a],[e]),r=g.useCallback((a,l)=>{t(ki(c=>{c[a]=l}))},[t]),o=g.useCallback(a=>{t(ki(l=>{delete l[a]}))},[t]),i=g.useCallback(()=>Object.values(e).some(Boolean),[e]);return{getFormError:n,setFormError:r,removeFormError:o,hasFormErrors:i}},$_e=(e,t)=>{const n=t.parameters.map(r=>r.name);return Object.fromEntries(Object.entries(e).sort((r,o)=>n.indexOf(r[0])-n.indexOf(o[0])))};var JI=Object.prototype.hasOwnProperty;function QI(e,t,n){for(n of e.keys())if(Mf(n,t))return n}function Mf(e,t){var n,r,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Mf(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(o=r,o&&typeof o=="object"&&(o=QI(t,o),!o)||!t.has(o))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(o=r[0],o&&typeof o=="object"&&(o=QI(t,o),!o)||!Mf(r[1],t.get(o)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(JI.call(e,n)&&++r&&!JI.call(t,n)||!(n in t)||!Mf(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var X8={exports:{}};(function(e,t){(function(n,r){var o=r(n);e.exports=o})(Ei,function(n){var r=["N","E","A","D"];function o(P,I){P.super_=I,P.prototype=Object.create(I.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}})}function i(P,I){Object.defineProperty(this,"kind",{value:P,enumerable:!0}),I&&I.length&&Object.defineProperty(this,"path",{value:I,enumerable:!0})}function a(P,I,O){a.super_.call(this,"E",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0}),Object.defineProperty(this,"rhs",{value:O,enumerable:!0})}o(a,i);function l(P,I){l.super_.call(this,"N",P),Object.defineProperty(this,"rhs",{value:I,enumerable:!0})}o(l,i);function c(P,I){c.super_.call(this,"D",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0})}o(c,i);function u(P,I,O){u.super_.call(this,"A",P),Object.defineProperty(this,"index",{value:I,enumerable:!0}),Object.defineProperty(this,"item",{value:O,enumerable:!0})}o(u,i);function d(P,I,O){var $=P.slice((O||I)+1||P.length);return P.length=I<0?P.length+I:I,P.push.apply(P,$),P}function p(P){var I=typeof P;return I!=="object"?I:P===Math?"math":P===null?"null":Array.isArray(P)?"array":Object.prototype.toString.call(P)==="[object Date]"?"date":typeof P.toString=="function"&&/^\/.*\//.test(P.toString())?"regexp":"object"}function h(P){var I=0;if(P.length===0)return I;for(var O=0;O<P.length;O++){var $=P.charCodeAt(O);I=(I<<5)-I+$,I=I&I}return I}function f(P){var I=0,O=p(P);if(O==="array"){P.forEach(function(q){I+=f(q)});var $="[type: array, hash: "+I+"]";return I+h($)}if(O==="object"){for(var F in P)if(P.hasOwnProperty(F)){var M="[ type: object, key: "+F+", value hash: "+f(P[F])+"]";I+=h(M)}return I}var B="[ type: "+O+" ; value: "+P+"]";return I+h(B)}function m(P,I,O,$,F,M,B,q){O=O||[],F=F||[],B=B||[];var Y=F.slice(0);if(typeof M<"u"&&M!==null){if($){if(typeof $=="function"&&$(Y,M))return;if(typeof $=="object"){if($.prefilter&&$.prefilter(Y,M))return;if($.normalize){var ne=$.normalize(Y,M,P,I);ne&&(P=ne[0],I=ne[1])}}}Y.push(M)}p(P)==="regexp"&&p(I)==="regexp"&&(P=P.toString(),I=I.toString());var H=typeof P,j=typeof I,W,R,N,J,se=H!=="undefined"||B&&B.length>0&&B[B.length-1].lhs&&Object.getOwnPropertyDescriptor(B[B.length-1].lhs,M),xe=j!=="undefined"||B&&B.length>0&&B[B.length-1].rhs&&Object.getOwnPropertyDescriptor(B[B.length-1].rhs,M);if(!se&&xe)O.push(new l(Y,I));else if(!xe&&se)O.push(new c(Y,P));else if(p(P)!==p(I))O.push(new a(Y,P,I));else if(p(P)==="date"&&P-I!==0)O.push(new a(Y,P,I));else if(H==="object"&&P!==null&&I!==null){for(W=B.length-1;W>-1;--W)if(B[W].lhs===P){J=!0;break}if(J)P!==I&&O.push(new a(Y,P,I));else{if(B.push({lhs:P,rhs:I}),Array.isArray(P)){for(q&&(P.sort(function(ee,ae){return f(ee)-f(ae)}),I.sort(function(ee,ae){return f(ee)-f(ae)})),W=I.length-1,R=P.length-1;W>R;)O.push(new u(Y,W,new l(void 0,I[W--])));for(;R>W;)O.push(new u(Y,R,new c(void 0,P[R--])));for(;W>=0;--W)m(P[W],I[W],O,$,Y,W,B,q)}else{var ge=Object.keys(P),Oe=Object.keys(I);for(W=0;W<ge.length;++W)N=ge[W],J=Oe.indexOf(N),J>=0?(m(P[N],I[N],O,$,Y,N,B,q),Oe[J]=null):m(P[N],void 0,O,$,Y,N,B,q);for(W=0;W<Oe.length;++W)N=Oe[W],N&&m(void 0,I[N],O,$,Y,N,B,q)}B.length=B.length-1}}else P!==I&&(H==="number"&&isNaN(P)&&isNaN(I)||O.push(new a(Y,P,I)))}function y(P,I,O,$,F){var M=[];if(m(P,I,M,$,null,null,null,F),O)for(var B=0;B<M.length;++B)O(M[B]);return M}function b(P,I,O,$,F,M,B){return m(P,I,O,$,F,M,B,!0)}function v(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,M=y(P,I,F,O);return $||(M.length?M:void 0)}function w(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,M=y(P,I,F,O,!0);return $||(M.length?M:void 0)}function C(P,I,O){if(O.path&&O.path.length){var $=P[I],F,M=O.path.length-1;for(F=0;F<M;F++)$=$[O.path[F]];switch(O.kind){case"A":C($[O.path[F]],O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}else switch(O.kind){case"A":C(P[I],O.index,O.item);break;case"D":P=d(P,I);break;case"E":case"N":P[I]=O.rhs;break}return P}function T(P,I,O){if(typeof O>"u"&&I&&~r.indexOf(I.kind)&&(O=I),P&&O&&O.kind){for(var $=P,F=-1,M=O.path?O.path.length-1:0;++F<M;)typeof $[O.path[F]]>"u"&&($[O.path[F]]=typeof O.path[F+1]<"u"&&typeof O.path[F+1]=="number"?[]:{}),$=$[O.path[F]];switch(O.kind){case"A":O.path&&typeof $[O.path[F]]>"u"&&($[O.path[F]]=[]),C(O.path?$[O.path[F]]:$,O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}}function A(P,I,O){if(O.path&&O.path.length){var $=P[I],F,M=O.path.length-1;for(F=0;F<M;F++)$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}else switch(O.kind){case"A":A(P[I],O.index,O.item);break;case"D":P[I]=O.lhs;break;case"E":P[I]=O.lhs;break;case"N":P=d(P,I);break}return P}function k(P,I,O){if(P&&I&&O&&O.kind){var $=P,F,M;for(M=O.path.length-1,F=0;F<M;F++)typeof $[O.path[F]]>"u"&&($[O.path[F]]={}),$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}}function _(P,I,O){if(P&&I){var $=function(F){(!O||O(P,I,F))&&T(P,I,F)};y(P,I,$)}}return Object.defineProperties(v,{diff:{value:v,enumerable:!0},orderIndependentDiff:{value:w,enumerable:!0},observableDiff:{value:y,enumerable:!0},orderIndependentObservableDiff:{value:b,enumerable:!0},orderIndepHash:{value:f,enumerable:!0},applyDiff:{value:_,enumerable:!0},applyChange:{value:T,enumerable:!0},revertChange:{value:k,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),v.DeepDiff=v,n&&(n.DeepDiff=v),v})})(X8);var N_e=X8.exports;const L_e={A:" ",E:" ",D:"-",N:"+"},Xd=({entry:e,sort:t=(n,r)=>n.key.localeCompare(r.key)})=>{const n=qh(),r={A:{color:n.palette.eventLog.edited},E:{color:n.palette.eventLog.edited},D:{color:n.palette.eventLog.diffSub},N:{color:n.palette.eventLog.diffAdd}},o=e.data&&e.preData?N_e.diff(e.preData,e.data):void 0,i=(c,u)=>{let d;return c.lhs!==void 0?d=x("div",{style:r.D,children:["- ",u,": ",JSON.stringify(c.lhs)]}):c.rhs!==void 0&&(d=x("div",{style:r.N,children:["+ ",u,": ",JSON.stringify(c.rhs)]})),d},a=(c,u)=>{var h;let d;const p=((h=c.path)==null?void 0:h.join("."))??c.index;if(c.item)d=i(c.item,p);else if(c.lhs!==void 0&&c.rhs!==void 0)d=x("div",{children:[x("div",{style:r.D,children:["- ",p,": ",JSON.stringify(c.lhs)]}),x("div",{style:r.N,children:["+ ",p,": ",JSON.stringify(c.rhs)]})]});else{const f=JSON.stringify(c.rhs||c.item);d=x("div",{style:r[c.kind],children:[L_e[c.kind]," ",p,f?`: ${f}`:c.kind==="D"?" (deleted)":""]})}return{key:p.toString(),value:s("div",{children:d},u),index:u}};let l=[];if(o)l=o.map(a).sort(t).map(({value:c})=>c);else if(e.data==null||e.preData==null){const c=e.data||e.preData;l=[s("div",{style:e.data?r.N:r.D,children:JSON.stringify(c,null,2)},0)]}return s("pre",{style:{overflowX:"auto",overflowY:"hidden"},tabIndex:0,children:s("code",{children:l.length===0?"(no changes)":l})})},D_e=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=on(),a=ar(i.breakpoints.down("sm")),l=g.useMemo(()=>{const c={...FL,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return x(OE,{mounted:t,start:l,enter:zL,children:[s(re,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s(re,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s(Xd,{entry:{preData:o,data:r}}),s(Ve,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},M_e=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},J8=(e,t,n,r)=>{const{data:o,refetch:i}=M_e(e),[a,l]=g.useState(t||null),[c,u]=g.useState(!1),d=h=>{u(!1),l(h)},p=h=>h&&(r&&typeof r=="function"?r(h):h);return g.useEffect(()=>{a===null&&l(t)},[t]),g.useEffect(()=>{if(!a||!o)return;Mf(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s(D_e,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function lC(e,t){if(Array.isArray(e))return e.map(n=>lC(n,t));if(typeof e=="object"&&e!==null){const n={};for(const[r,o]of Object.entries(e))r!==t&&(n[r]=lC(o,t));return n}return e}const Q8=e=>{const t={...e};return lC(t,"lastSeenAt")},Jd=()=>{const{trackEvent:e}=Bn(),{makeRequest:t,createRequest:n,errors:r,loading:o}=qn({propagateErrors:!0});return{addChange:async(f,m,y)=>{e("change_request",{props:{eventType:"change added"}});const b=`api/admin/projects/${f}/environments/${m}/change-requests`,v=n(b,{method:"POST",body:JSON.stringify(y)});return(await t(v.caller,v.id)).json()},editChange:async(f,m,y,b)=>{const v=`api/admin/projects/${f}/change-requests/${m}/changes/${y}`,w=n(v,{method:"PUT",body:JSON.stringify(b)});return t(w.caller,w.id)},changeState:async(f,m,y)=>{e("change_request",{props:{eventType:y.state}});const b=`api/admin/projects/${f}/change-requests/${m}/state`,v=n(b,{method:"PUT",body:JSON.stringify(y)});return(await t(v.caller,v.id)).json()},discardChange:async(f,m,y)=>{const b=`api/admin/projects/${f}/change-requests/${m}/changes/${y}`,v=n(b,{method:"DELETE"});return t(v.caller,v.id)},updateChangeRequestEnvironmentConfig:async({project:f,enabled:m,environment:y,requiredApprovals:b})=>{const v=`api/admin/projects/${f}/environments/${y}/change-requests/config`,w=n(v,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:m,requiredApprovals:b})});return t(w.caller,w.id)},discardDraft:async(f,m)=>{const y=`api/admin/projects/${f}/change-requests/${m}`,b=n(y,{method:"DELETE"});return t(b.caller,b.id)},addComment:async(f,m,y)=>{e("change_request",{props:{eventType:"comment added"}});const b=`/api/admin/projects/${f}/change-requests/${m}/comments`,v=n(b,{method:"POST",body:JSON.stringify({text:y})});return t(v.caller,v.id)},updateTitle:async(f,m,y)=>{e("change_request",{props:{eventType:"title updated"}});const b=`api/admin/projects/${f}/change-requests/${m}/title`,v=n(b,{method:"PUT",body:JSON.stringify({title:y})});return t(v.caller,v.id)},errors:r,loading:o}},B_e=()=>{const[e,t]=g.useState(""),{trackEvent:n}=Bn();return{setPreviousTitle:t,trackTitle:(o="")=>{o===e&&n("strategyTitle",{props:{action:"none",on:"edit"}}),e===""&&o!==""&&n("strategyTitle",{props:{action:"added",on:"edit"}}),e!==""&&o===""&&n("strategyTitle",{props:{action:"removed",on:"edit"}}),e!==""&&o!==""&&o!==e&&n("strategyTitle",{props:{action:"edited",on:"edit"}})}}},hje=()=>{const e=br("projectId"),t=br("featureId"),n=XI("environmentId"),r=XI("strategyId"),[o,i]=g.useState({}),[a,l]=g.useState([]),{updateStrategyOnFeature:c,loading:u}=O_e(),{strategyDefinition:d}=Ek(o.name),{setToastData:p,setToastApiError:h}=Ot(),f=Y8(),{uiConfig:m}=xt(),{unleashUrl:y}=m,b=pt(),{addChange:v}=Jd(),{isChangeRequestConfigured:w}=Wc(e),{refetch:C}=u0(e),{setPreviousTitle:T}=B_e(),{feature:A,refetchFeature:k}=Qa(e,t),_=g.useRef(A),{data:P,staleDataNotification:I,forceRefreshCache:O}=J8({unleashGetter:Qa,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},A,{afterSubmitAction:k},Q8);g.useEffect(()=>{_.current.name===""&&A.name&&(O(A),_.current=A)},[A]);const{segments:$,refetchSegments:F}=Ml(r);g.useEffect(()=>{const ne=P==null?void 0:P.environments.flatMap(H=>H.strategies).find(H=>H.id===r);i(H=>({...H,...ne})),T((ne==null?void 0:ne.title)||"")},[r,P]),g.useEffect(()=>{$&&l($)},[JSON.stringify($)]);const M=F_e(o,a),B=async ne=>{await c(e,t,n,r,ne),await F(),p({title:"Strategy updated",type:"success",confetti:!0})},q=async ne=>{await v(e,n,{action:"updateStrategy",feature:t,payload:{...ne,id:r}}),p({title:"Change added to draft",type:"success",confetti:!0}),C()},Y=async()=>{try{w(n)?await q(M):await B(M),k(),b(kk(e,t))}catch(ne){h(vt(ne))}};return!o.id||!d||!P?null:x(Nr,{modal:!0,title:As(o.name??""),description:j_e,documentationLink:U_e,documentationLinkLabel:W_e,formatApiCode:()=>z_e(e,t,n,r,M,d,y),children:[s(K8,{projectId:e,feature:P,strategy:o,setStrategy:i,segments:a,setSegments:l,environmentId:n,onSubmit:Y,loading:u,permission:z1,errors:f,isChangeRequest:w(n)}),I]})},F_e=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),kk=(e,t)=>`/projects/${e}/features/${t}`,Ak=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},z_e=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:$_e(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
315
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Nke={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},Lke={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-60,d:0,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:660,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{a:"Asia/Urumqi",c:["AQ"],r:1},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:360,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{u:480,c:["MN"]},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",c:["CN"],r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:360,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN","AQ"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{u:60,d:120},CST6CDT:{u:-360,d:-300},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{u:120,d:180},EST:{u:-300},EST5EDT:{u:-300,d:-240},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:60,d:0,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{u:-600},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{u:60,d:120},MST:{u:-420},MST7MDT:{u:-420,d:-360},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{u:-480,d:-420},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{u:0,d:60},Zulu:{a:"Etc/UTC",r:1}},pg={countries:Nke,timezones:Lke},FS;function Dke(e,t){var n=e.countries[t];if(!n)return null;var r=Mke(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function Mke(e){return FS||(FS=Bke(e)),FS}function Bke(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,a=e.timezones[i]||{},l=o||a.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,s0({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function Fke(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=kh(kh({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:$I(c),dstOffset:u,dstOffsetStr:$I(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function $I(e){var t=Math.floor(e/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(NI(t),":").concat(NI(n))}function NI(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var zke=["allTimezones"],jke=Object.keys(pg.timezones).length,aC={},Df={},A8=0;function Uke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(pg.countries).reduce(function(t,n){return Object.assign(t,s0({},n,l0(n,e)))},{})}function Wke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return jke!==A8&&Object.keys(pg.timezones).forEach(c0),Kke(Df,e)}function l0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return aC[e]||Hke(Dke(pg,e)),Yke(aC[e],t)}function Hke(e){e&&(aC[e.id]=e)}function c0(e){return Df[e]||Vke(Fke(pg,e)),Df[e]?kh({},Df[e]):null}function Vke(e){e&&(Df[e.name]=e,A8=Object.keys(e).length)}function R8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=c0(e)||{},r=n.countries||[];return r.map(function(o){return l0(o,t)})}function Gke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=R8(e,t),r=_ke(n,1),o=r[0];return o||null}function qke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=l0(e,t);if(!n)return null;var r=n.timezones||[];return r.map(c0)}function Kke(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,s0({},i,e[i])),o},{})}function Yke(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=Rke(e,zke),i=r?e.allTimezones:e.timezones;return kh(kh({},o),{},{timezones:i})}var Xke={getCountry:l0,getTimezone:c0,getAllCountries:Uke,getAllTimezones:Wke,getTimezonesForCountry:qke,getCountriesForTimezone:R8,getCountryForTimezone:Gke};const Jke=S("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Qke=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(Xke.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[a,l]=g.useState(t||""),c=g.useMemo(()=>{const u=o.find(d=>d.key===i);return u!=null?`${u.key} (UTC ${u.utcOffset})`:"The time shown is in your local time zone according to your browser."},[o,i]);return t?x(le,{children:[s(dg,{children:"Select a date"}),x(Jke,{children:[s(cr,{id:"date",label:"Date",type:"datetime-local",value:Vxe(a),onChange:u=>{r("");const d=XM(u.target.value),p=d==null?void 0:d.toISOString();p&&l(p),p&&e(p)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),s("p",{children:c})]})]}):null},_8=Ns()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),Zke="Enter",LI=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,a]=g.useState(""),{classes:l}=_8(),c=d=>{d.key===Zke&&(d.preventDefault(),u())},u=()=>{const d=tAe([...e,...Zs(i)]);d.length===0?o("values cannot be empty"):d.some(p=>p.length>100)?o("values cannot be longer than 100 characters"):(o(""),a(""),n(d))};return x("div",{children:[s(dg,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),x("div",{className:l.inputContainer,children:[s("div",{className:l.inputInnerContainer,children:s(cr,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>a(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),s(Ve,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),s("div",{className:l.valuesContainer,children:s(eAe,{values:e,removeValue:t})})]})},eAe=({values:e,removeValue:t})=>{const{classes:n}=_8();return s(le,{children:e.map((r,o)=>s(Os,{label:s(Pa,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},tAe=e=>Array.from(new Set(e)),wk=({filter:e,setFilter:t})=>x("div",{style:{display:"flex",alignItems:"center"},children:[s("div",{style:{width:"300px"},children:s(vn,{label:"Search",name:"search",value:e,onChange:n=>t(n.target.value),placeholder:"Filter values",style:{width:"100%",margin:"1rem 0"},variant:"outlined",size:"small",InputProps:{startAdornment:s(bE,{position:"start",children:s(QE,{})})}})}),s(V,{condition:!!e,show:s(Os,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),nAe=Ns()(e=>({container:{display:"inline-block",wordBreak:"break-word"},value:{lineHeight:1.33,fontSize:e.fontSizes.smallBody},description:{lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active}})),P8=({legal:e,control:t})=>{const{classes:n}=nAe();return s("div",{className:n.container,children:s(Gr,{value:e.value,control:t,label:x(le,{children:[s("div",{className:n.value,children:e.value}),s("div",{className:n.description,children:e.description})]})})})},I8=(e,t)=>e.filter(n=>n.value.includes(t)),zS=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),O8=e=>new Set(e.map(({value:t})=>t)),$8=(e,t)=>{const n=O8(t);return e.filter(r=>n.has(r))},rAe=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[a,l]=g.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=I8(c,a),[p,h]=g.useState(()=>zS(t)),{classes:f}=eg(),m=v=>{const w=O8(u);return(v==null?void 0:v.filter(C=>!w.has(C)))||[]},y=$8(i,u);g.useEffect(()=>{h(zS(t))},[t,h,zS]),g.useEffect(()=>{y.length>0&&n(m(t))},[]);const b=v=>{if(o(""),p[v]){const w=t.findIndex(T=>T===v),C=[...t];C.splice(w,1),n(C);return}n([...m(t),v])};return x(le,{children:[s(V,{condition:!!(y&&y.length>0),show:x(Lt,{severity:"warning",children:["This constraint is using legal values that have been deleted as valid options. If you save changes on this constraint and then save the strategy the following values will be removed:",s("ul",{children:y==null?void 0:y.map(v=>s("li",{children:v},v))})]})}),s(dg,{children:"Select values from a predefined set"}),s(V,{condition:c.length>100,show:s(wk,{filter:a,setFilter:l})}),d.map(v=>s(P8,{legal:v,control:s(ts,{checked:!!p[v.value],onChange:()=>b(v.value),name:v.value,color:"primary",disabled:u.map(({value:w})=>w).includes(v.value)})},v.value)),s(V,{condition:!!r,show:s("p",{className:f.error,children:r})})]})},DI=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:a,constraintValue:l})=>{const[c,u]=g.useState(""),{classes:d}=eg(),p=I8(r,c),{deletedLegalValues:h}=a,f=$8([l],h);return x(le,{children:[s(V,{condition:!!(f&&f.length>0),show:x(Lt,{severity:"warning",sx:m=>({marginTop:m.spacing(1)}),children:[" ","This constraint is using legal values that have been deleted as a valid option. Please select a new value from the remaining predefined legal values. The constraint will be updated with the new value when you save the strategy."]})}),x(dg,{children:["Add a single ",n.toLowerCase()," value"]}),s(V,{condition:r.length>100,show:s(wk,{filter:c,setFilter:u})}),s(V,{condition:!!r.length,show:s($s,{component:"fieldset",children:s(EE,{"aria-label":"selected-value",name:"selected",value:t,onChange:m=>{i(""),e(m.target.value)},children:p.map(m=>s(P8,{legal:m,control:s(dc,{})},m.value))})}),elseShow:s("p",{children:"No valid legal values available for this operator."})}),s(V,{condition:!!o,show:s("p",{className:d.error,children:o})})]})},oAe=Ns()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),MI=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=oAe();return x(le,{children:[x(dg,{children:["Add a single ",n.toLowerCase()," value"]}),s("div",{className:i.singleValueContainer,children:s(cr,{label:n,name:"value",value:t||"",onChange:a=>{o(""),e(a.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},jS=(e,t)=>{if((t==null?void 0:t.length)===0)return{legalValues:[],deletedLegalValues:[]};const n=(e||[]).filter(r=>!(t||[]).some(({value:o})=>o===r)).map(r=>({value:r,description:""}));return{legalValues:t||[],deletedLegalValues:n}},iAe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:a,setError:l,removeValue:c,error:u})=>s(le,{children:(()=>{var p;switch(e){case iC:case b8:return s(le,{children:s(rAe,{data:jS(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:a,error:u,setError:l})});case S8:return s(le,{children:s(DI,{data:jS([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(h=>Number(h.value)))||[],error:u,setError:l})});case w8:return s(le,{children:s(DI,{data:jS([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case x8:return s(Qke,{value:o.value,setValue:i,error:u,setError:l});case C8:return s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l});case E8:return s(le,{children:s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l})});case T8:return s(MI,{setValue:i,value:o.value,type:"number",error:u,setError:l});case k8:return s(MI,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}})()}),N8="cancel",BI="save",FI=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},aAe=S("div")({padding:0,margin:0,width:"100%"}),sAe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.elevation1,boxShadow:"none",margin:0,"& .expanded":{"&:before":{opacity:"0 !important"}}})),lAe=S(v1)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),cAe=S(m1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),uAe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,a]=g.useState(nI(e)),{context:l}=ma(),[c,u]=g.useState(FI(l,i.contextName)),{validateConstraint:d}=qd(),[p,h]=g.useState(!1),[f,m]=g.useState("");g.useEffect(()=>{h(!0)},[]),g.useEffect(()=>{u(FI(l,i.contextName))},[i.contextName,l]);const y=g.useCallback(M=>{a(B=>({...B,contextName:M,values:[],value:""}))},[]),b=g.useCallback(M=>{a(B=>({...B,operator:M,values:[],value:""}))},[]),v=g.useCallback(M=>{a(B=>({...B,values:M}))},[]),w=g.useCallback(M=>{a(B=>({...B,value:M}))},[]),C=()=>{a(M=>({...M,inverted:!M.inverted}))},T=g.useCallback(()=>{a(M=>({...M,caseInsensitive:!M.caseInsensitive}))},[]),A=g.useCallback(M=>{const B=[...i.values];B.splice(M,1),v(B)},[i,v]),k=()=>{h(!1)},_=()=>{const M=Array.isArray(i.values)&&i.values.length>0,B=!!i.value;return M||B?($(""),!0):($("You must provide a value for the constraint"),!1)},P=async()=>{if(!_())return;const[B,q]=O();if(B||$(q),B)try{await d(i),$(""),m(BI),k();return}catch(Y){$(vt(Y))}},{input:I,validator:O,setError:$,error:F}=Tke({contextDefinition:c,localConstraint:i});return g.useEffect(()=>{$(""),a(M=>nI(M))},[i.operator,i.contextName,$]),s(aAe,{children:x(sAe,{expanded:p,TransitionProps:{onExited:()=>{f===N8?(m(""),n()):f===BI&&(m(""),r(i))}},children:[s(lAe,{children:s(w2e,{localConstraint:i,setLocalConstraint:a,setContextName:y,setOperator:b,action:f,compact:t,setInvertedOperator:C,setCaseInsensitive:T,onDelete:o})}),s(cAe,{children:s(e2e,{localConstraint:i,setValues:v,setValue:w,triggerTransition:k,setAction:m,onSubmit:P,children:s(iAe,{setValues:v,setValue:w,setError:$,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:I,error:F,contextDefinition:c,removeValue:A})})})]})})},L8=(e,t)=>e.value&&e.contextName===Th?B1(e.value,t.locale):e.value,dAe=S(Pa)({whiteSpace:"pre"}),pAe=S(Os)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),fAe=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:x(le,{children:[s(V,{condition:e.length>20,show:s(wk,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>s(pAe,{label:s(dAe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},hAe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),gAe=S("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),mAe=S(Os)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),yAe=({value:e,operator:t})=>e?x(hAe,{children:[x(gAe,{children:["Value must be ",t]})," ",s(mAe,{label:s(Pa,{maxWidth:"400",text:e,maxLength:50})})]}):null,vAe=S("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),bAe=({constraint:e})=>{const{locationSettings:t}=ha();return s("div",{children:x(vAe,{children:[s(fAe,{values:e.values}),s(yAe,{value:L8(e,t),operator:e.operator})]})})},SAe=S("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),wAe=S("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),xAe=S("div",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),CAe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=rC(e.operator);return x(SAe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[s(wAe,{disabled:n,children:r}),s(xAe,{disabled:n,children:o})]})},D8=S("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation2,width:24,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"stretch",color:e.palette.primary.main,marginLeft:e.spacing(1),borderRadius:e.shape.borderRadius})),EAe=S(D8)(()=>({marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),zI=g.forwardRef(({isPrefix:e,...t},n)=>s(V,{condition:!!e,show:()=>s(EAe,{ref:n,...t}),elseShow:()=>s(D8,{ref:n,...t})})),TAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),kAe=S("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),AAe=({constraint:e,disabled:t=!1})=>x(TAe,{children:[s(V,{condition:!!e.inverted,show:s(yt,{title:"Operator is negated",arrow:!0,children:s(ye,{sx:{display:"flex"},children:s(zI,{isPrefix:!0,children:s(a8,{})})})})}),s(kAe,{children:s(CAe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),s(V,{condition:!e.caseInsensitive&&Mn(ws,e.operator),show:s(yt,{title:"Case sensitive is active",arrow:!0,children:s(zI,{children:s(c8,{})})})})]}),RAe=S(Os)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),_Ae=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),PAe=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=ha();return g.useEffect(()=>{t(!1)},[t]),s(_Ae,{children:s(RAe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:L8(e,r)})})},IAe=S("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,margin:"auto 0",[e.breakpoints.down("sm")]:{margin:e.spacing(1,0),textAlign:"center"}})),OAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),$Ae=S("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),NAe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),LAe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,a]=g.useState(!1),l=g.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return g.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),a(((l==null?void 0:l.length)??0)>r))},[l,r,n,a]),s(OAe,{children:x($Ae,{children:[s(IAe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),s(V,{condition:i,show:s(NAe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},DAe=S("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",maxWidth:"100px",minWidth:"100px",marginRight:"10px",marginTop:"auto",marginBottom:"auto",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,[e.breakpoints.down(710)]:{textAlign:"center",padding:e.spacing(1,0),marginRight:"inherit",maxWidth:"inherit"}})),MAe=S("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),BAe=S("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),FAe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>s(MAe,{children:x(BAe,{children:[s(yt,{title:e.contextName,arrow:!0,children:s(DAe,{sx:a=>({color:o?a.palette.text.secondary:"inherit"}),children:e.contextName})}),s(AAe,{constraint:e,disabled:o}),s(V,{condition:t,show:s(PAe,{constraint:e,allowExpand:n,disabled:o}),elseShow:s(LAe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),zAe=Bc("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),jAe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:a,disabled:l})=>{const{context:c}=ma(),{contextName:u}=e,d=!c.map(p=>p.name).includes(u);return x(zAe,{children:[s(o8,{compact:a,disabled:l}),s(FAe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),s(u8,{onEdit:t,onDelete:n,disableEdit:d})]})},UAe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),WAe=S(v1)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto","-webkit-user-select":"auto","-moz-user-select":"auto","-ms-user-select":"auto"})),HAe=S(m1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),VAe=S("div")({display:"flex",flexDirection:"column",width:"100%"}),GAe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:a})=>{const[l,c]=g.useState(!0),[u,d]=g.useState(!1),p=Mn([...Vu,...Hu,...$i],e.operator);return x(UAe,{expanded:u,sx:r,children:[s(WAe,{expandIcon:null,onClick:()=>{l&&d(!u)},sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:x(VAe,{children:[s(jAe,{constraint:e,onEdit:t,onDelete:n,singleValue:p,allowExpand:c,disabled:i,expanded:u,compact:o}),a]})}),s(HAe,{children:s(bAe,{constraint:e})})]})},qAe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:a})=>e?s(V,{condition:!!(n&&a),show:s(uAe,{constraint:e,onCancel:o,onSave:a,onDelete:i,compact:t}),elseShow:s(GAe,{constraint:e,onEdit:r,onDelete:i})}):null,KAe=e=>{const t=g.useRef(e??new WeakMap),[,n]=g.useState(0),r=g.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=g.useCallback(i=>t.current.get(i),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},M8=e=>(US.has(e)||(jI++,US.set(e,jI)),US.get(e)),US=new WeakMap;let jI=0;const YAe=e=>{const t=i8(e)[0],n=Mn($i,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1}},B8=S("div")(({theme:e})=>({padding:e.spacing(.75,1),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:"50%",left:e.spacing(2),transform:"translateY(-50%)",lineHeight:1})),XAe=S(B8)(({theme:e})=>({top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.75,1.5)})),xk=({text:e})=>{const t=on();return s(ye,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:s(V,{condition:e==="AND",show:()=>s(B8,{children:e}),elseShow:()=>s(XAe,{children:e})})})},F8="constraintAccordionListId",JAe=S("div")({width:"100%",display:"flex",flexDirection:"column"}),QAe=S(yt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),ZAe=S(jy)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),eRe=S("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),tRe=S("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),fg=g.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const i=KAe(),{context:a}=ma(),l=t&&(f=>{const m=YAe(f);i.set(m,{editing:!0,new:!0}),t(y=>[...y,m])});g.useImperativeHandle(o,()=>({addConstraint:l}));const c=l&&(()=>{l(a[0].name)}),u=t&&(f=>{i.set(f,{editing:!0})}),d=t&&(f=>{const m=e[f];i.set(m,{}),t(ki(y=>{y.splice(f,1)}))}),p=t&&((f,m)=>{i.set(m,{}),t(ki(y=>{y[f]=m}))}),h=f=>{var y;const m=e[f];(y=i.get(m))!=null&&y.new&&(d==null||d(f)),i.set(m,{})};return a.length===0?null:x(JAe,{id:F8,children:[s(V,{condition:e&&e.length>0&&r,show:s(eRe,{children:"Constraints"})}),e.map((f,m)=>{var y;return x(g.Fragment,{children:[s(V,{condition:m>0,show:s(xk,{text:"AND"})}),s(qAe,{constraint:f,onEdit:u==null?void 0:u.bind(null,f),onCancel:h.bind(null,m),onDelete:d==null?void 0:d.bind(null,m),onSave:p==null?void 0:p.bind(null,m),editing:!!((y=i.get(f))!=null&&y.editing),compact:!0})]},M8(f))}),s(V,{condition:!!(n&&c),show:x("div",{children:[x(tRe,{children:[s("p",{children:"Add any number of constraints"}),s(QAe,{title:"View constraints documentation",arrow:!0,children:s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:s(ZAe,{})})})]}),s(Ve,{type:"button",onClick:c,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),nRe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{const o=g.useMemo(()=>n.constraints??[],[n]),i=c=>{r(u=>({...u,constraints:c instanceof Function?c(o):c}))},a=ld(m9,e,t),l=ld(z1,e,t);return s(fg,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},UI=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},Ck=e=>{const t=!!(e&&e.length===0),[n,r]=g.useState(t),{validateConstraint:o}=qd();return g.useEffect(()=>{if(!e)return;if(e.find(l=>!UI(l))){r(!1);return}const a=e.filter(UI).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Ml=e=>{xt();const t=wt(e?`api/admin/segments/strategies/${e}`:"api/admin/segments"),{data:n,error:r,mutate:o}=An(t,()=>rRe(t),{refreshInterval:15*1e3}),i=g.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:i,loading:!r&&!n,error:r}},rRe=async e=>fetch(e).then(fn("Segments")).then(t=>t.json()).then(t=>t.segments),oRe=Ns()(e=>({inputRoot:{height:48,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTopRightRadius:50,borderBottomRightRadius:50,"& fieldset":{borderColor:e.palette.divider,borderLeftColor:"transparent"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:1}}})),iRe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),aRe=S("div",{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({background:t?e.palette.primary.light:e.palette.primary.main,height:"48px",width:"48px",display:"flex",alignItems:"center",justifyContent:"center",paddingLeft:6,borderTopLeftRadius:"40px",borderBottomLeftRadius:"40px",color:e.palette.primary.contrastText})),sRe=S(Od)({flex:1}),z8=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const{classes:i}=oRe(),a=l=>s(vn,{...l,variant:"outlined",label:e});return x(iRe,{children:[s(aRe,{$disabled:!!o,"aria-hidden":!0,children:s(QE,{})}),s(sRe,{classes:{inputRoot:i.inputRoot},options:t,value:n,popupIcon:s(Sce,{titleAccess:"Toggle"}),onChange:(l,c)=>r(c||[]),renderInput:a,getOptionLabel:l=>l.label,disabled:o,size:"small",multiple:!0})]})},lRe=S("span")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),paddingInlineStart:e.spacing(2),paddingInlineEnd:e.spacing(1),paddingBlockStart:e.spacing(.5),paddingBlockEnd:e.spacing(.5),borderRadius:"100rem",background:e.palette.primary.main,color:e.palette.primary.contrastText})),WI=S("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),cRe=S(qt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),WS=e=>({fontSize:e.fontSizes.bodySize}),uRe=({segment:e,setSegments:t,preview:n,setPreview:r})=>{const o=()=>{t(c=>c.filter(u=>u.id!==e.id)),r(c=>c===e?void 0:c)},i=()=>{r(c=>c===e?void 0:e)},a=s(V,{condition:e===n,show:s($D,{titleAccess:"Hide",sx:WS}),elseShow:s(OD,{titleAccess:"Show",sx:WS})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return x(lRe,{children:[s(cRe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s(yt,{title:l,arrow:!0,children:s(WI,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":F8,children:a})}),s(yt,{title:"Remove segment",arrow:!0,children:s(WI,{type:"button",onClick:o,children:s(xce,{titleAccess:"Remove",sx:WS})})})]})},dRe=S(g1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light}})),pRe=S(v1)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),fRe=S(qt)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),hRe=S("span",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({color:t?e.palette.text.secondary:"inherit"})),j8=({segment:e,isExpanded:t,headerContent:n,constraintList:r,disabled:o=!1})=>{var l;const[i,a]=g.useState(t||!1);return x(dRe,{expanded:i,children:[x(pRe,{id:`segment-accordion-${e.id}`,children:[s(TD,{sx:c=>({mr:1,color:o?c.palette.neutral.border:c.palette.secondary.main})}),s(hRe,{disabled:o,children:"Segment:"}),s(fRe,{to:`/segments/edit/${e.id}`,children:e.name}),s(V,{condition:!!n,show:n}),s(V,{condition:!t,show:s(Ve,{size:"small",variant:"outlined",onClick:()=>a(c=>!c),sx:{my:0,ml:"auto",fontSize:c=>c.typography.body2.fontSize},children:i?"Close preview":"Preview"})})]}),s(m1,{sx:{pt:0},children:s(V,{condition:!!r,show:r,elseShow:s(V,{condition:(((l=e==null?void 0:e.constraints)==null?void 0:l.length)||0)>0,show:s(fg,{constraints:e.constraints,showLabel:!1}),elseShow:s(re,{children:"This segment has no constraints."})})})})]})},gRe=S("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),mRe=S("p")(({theme:e})=>({color:e.palette.text.secondary})),yRe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,padding:e.spacing(.75,1),display:"block",marginTop:"auto",marginBottom:"auto",alignItems:"center",borderRadius:e.shape.borderRadius,lineHeight:1,color:e.palette.text.primary,backgroundColor:e.palette.background.elevation2})),vRe=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1;return e.length===0?null:x(le,{children:[s(V,{condition:e&&e.length>0,show:s(mRe,{children:"Selected Segments"})}),s(gRe,{children:e.map((i,a)=>x(g.Fragment,{children:[s(uRe,{segment:i,setSegments:t,preview:n,setPreview:r}),s(V,{condition:a<o,show:s(yRe,{children:"AND"})})]},i.id))}),s(V,{condition:!!n,show:()=>s(j8,{segment:n,isExpanded:!0})})]})},qc=()=>{const{uiConfig:e}=xt();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},bRe=()=>{const{segmentValuesLimit:e}=qc();return typeof e>"u"?null:x(Lt,{severity:"info",children:["A segment can have"," ",x("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",s(U8,{})]})},SRe=e=>{const{segmentValuesLimit:t}=qc();return typeof t>"u"?null:x(Lt,{severity:"error",children:["A segment can have"," ",x("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},wRe=()=>{const{strategySegmentsLimit:e}=qc();return typeof e>"u"?null:x(Lt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s(U8,{})]})},U8=()=>x(le,{children:[s("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),W8="https://docs.getunleash.io/reference/segments",xRe=S(Er)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),CRe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Ml(),{strategySegmentsLimit:o}=qc(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name}));return x(le,{children:[s(re,{component:"h3",sx:{m:0},variant:"h3",children:"Segmentation"}),i&&s(wRe,{}),s("p",{children:"Add a predefined segment to constrain this feature toggle:"}),s(z8,{label:"Select segments",options:c,onChange:([d])=>{const p=r.find(h=>String(h.id)===d.value);p&&t(h=>[...h,p])},disabled:i}),s(vRe,{segments:e,setSegments:t}),s(xRe,{})]})},ERe=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!TRe(t))return"Not a valid number."}},TRe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),Ek=e=>{const{data:t,error:n,mutate:r}=An(e?wt(`api/admin/strategies/${e}`):null,kRe),o=g.useCallback(()=>{r().catch(console.warn)},[r]);return{strategyDefinition:t,refetchStrategy:o,loading:!n&&!t,error:n}},kRe=e=>fetch(e).then(fn("Strategy")).then(t=>t.json()),ARe=({environment:e})=>x(Lt,{severity:"info",children:[s("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),sC="production",RRe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:a}=Tk(),[l,c]=g.useState(i.hide);return x(Zn,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s(Lt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s(Gr,{label:"Don't show again",control:s(ts,{checked:l,onChange:()=>{a(d=>({hide:!d.hide})),c(d=>!d)}})})]})},_Re=(e,t)=>{var r;const{value:n}=Tk();return n.hide?!1:typeof e=="string"?e===sC:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===sC)},PRe="useFeatureStrategyProdGuardSettings:v2",Tk=()=>rs(PRe,{hide:!1}),pje=e=>{const{value:t}=Tk();return e===sC&&!t.hide},IRe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Mn(["In review","Approved"],r.state)):!1,alert:s(Lt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),H8=(e,t,n,r={})=>{const{isEnterprise:o}=xt();return Uc(o(),e,t,n,r)},ORe=e=>fetch(e).then(fn("ChangeRequest")).then(t=>t.json()),u0=e=>{const{data:t,error:n,mutate:r}=H8([],wt(`api/admin/projects/${e}/change-requests/pending`),ORe);return{data:t,loading:!n&&!t,refetch:r,error:n}},$Re=({title:e,setTitle:t})=>x(ye,{sx:{paddingBottom:n=>n.spacing(2)},children:[s(re,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s(cr,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),NRe=({enabled:e,onToggleEnabled:t})=>s(Gr,{control:s(pa,{name:"enabled",onChange:t,checked:e}),label:"Enabled – This strategy will be used when evaluating feature toggles."}),LRe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),DRe=function(e){return"/"+e},HI={},Yd=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=DRe(i),i in HI)return;HI[i]=!0;const a=i.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let d=o.length-1;d>=0;d--){const p=o[d];if(p.href===i&&(!a||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":LRe,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})},MRe=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s(vn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},BRe=S("div")(({theme:e})=>({display:"flex",alignItems:"center",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%",alignItems:"flex-start"}}})),FRe=S(Z1)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),zRe=S("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),jRe=S(MRe)(()=>({width:"100%"})),URe=S(vn)(()=>({width:"100%"})),WRe=({overrides:e,overridesDispatch:t})=>{const{context:n}=ma(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s(le,{children:e.map((a,l)=>{var p;const c=n.find(({name:h})=>h===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:h})=>h))||[],d=a.values.filter(h=>u.includes(h));return x(BRe,{children:[s(FRe,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:h=>t({type:"UPDATE_TYPE_AT",payload:[l,h.target.value]})}),x(zRe,{children:[s(V,{condition:!!(u&&u.length>0),show:s(Od,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(h,f)=>h===f,options:u,onChange:i(l),getOptionLabel:h=>h,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:h=>s(URe,{...h,variant:"outlined",label:"Legal values"})}),elseShow:s(jRe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s(yt,{title:"Remove",arrow:!0,children:s(Ft,{onClick:h=>{h.preventDefault(),t({type:"REMOVE",payload:l})},children:s(vo,{})})})]})]},`override=${l}`)})})},HRe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},VRe=(e=[])=>g.useReducer(HRe,e);var ds=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ds||{});const hg=e=>{var n;const{uiConfig:t}=xt();return((n=t==null?void 0:t.flags)==null?void 0:n[e])||!1},GRe=Te.lazy(()=>Yd(()=>import("./ReactJSONEditor-693b261e.js"),[])),qRe=S("div")(({theme:e})=>({position:"relative",backgroundColor:e.palette.neutral.light,display:"flex",flexDirection:"column",padding:e.spacing(3),marginBottom:e.spacing(3),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden"})),KRe=S("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),YRe=S(yt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),V8=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),VI=S(V8)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),XRe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),JRe=S(Gr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),QRe=S("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),GI=S(cr)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),ZRe=S("div")(({theme:e})=>({marginLeft:e.spacing(3)})),e_e=S(cr)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),t_e=S("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),G8=S("div")(({theme:e})=>({display:"flex",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%"}}})),n_e=S(G8)({alignItems:"end",justifyContent:"space-between"}),r_e=S(Z1)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),o_e=S(Ve)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),HS=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"}],i_e={type:"string",value:""},a_e=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a})=>{const[l,c]=g.useState(e.name),[u,d]=g.useState(e.weightType===ds.FIX),[p,h]=g.useState(String(e.weight/10)),[f,m]=g.useState(e.payload||i_e),[y,b]=VRe("overrides"in e?e.overrides||[]:[]),{context:v}=ma(),[w,C]=g.useState({}),T=hg("variantTypeNumber");g.useEffect(()=>{T&&!HS.some(H=>H.key==="number")&&HS.push({key:"number",label:"number"})},[T]);const A=H=>{C(j=>({...j,[H]:void 0}))},k=(H,j)=>{C(W=>({...W,[H]:j}))};g.useEffect(()=>{A("percentage"),o!=null&&o.includes("%")&&k("percentage","Total weight must equal 100%")},[o]);const _=!e.new,P=t.filter(({id:H,weightType:j})=>H!==e.id&&j===ds.VARIABLE).length>0,I=H=>{const j=H.weightType===ds.VARIABLE,W=t.some(N=>N.weightType===ds.FIX),R=t.filter(N=>N.weightType===ds.VARIABLE).length===1;return W&&R&&j},O=H=>{A("name"),q(H,e.id)||k("name","A variant with that name already exists for this environment."),c(H.trim())},$=H=>{(H===""||Y(H))&&h(H)},F=H=>{ne(H)||k("payload",H.type==="json"?"Invalid json":"Invalid number")},M=()=>{v.length>0&&b({type:"ADD",payload:{contextName:v[0].name,values:[]}})},B=H=>!!H.length,q=(H,j)=>_||!t.some(W=>W.name===H&&W.id!==j),Y=H=>{if(!u)return!0;if(H===""||H.match(/\.[0-9]{2,}$/))return!1;const j=Number(H);return j>=0&&j<=100},ne=H=>{try{return H.type==="json"&&JSON.parse(H.value),T&&H.type==="number"?!Number.isNaN(Number(H.value)):!0}catch{return!1}};return g.useEffect(()=>{const H={...e,name:l,weight:Number(u?p:100)*10,weightType:u?ds.FIX:ds.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:f.value?f:void 0,isValid:B(l)&&q(l,e.id)&&Y(p)&&ne(f)&&!o};i||(H.overrides=y.map(j=>({contextName:j.contextName,values:j.values})).filter(j=>j.values&&j.values.length>0)),n(H)},[l,u,p,f,y]),g.useEffect(()=>{u||h(String(e.weight/10))},[e.weight]),x(qRe,{"data-testid":"VARIANT",children:[s(KRe,{color:a}),s(YRe,{arrow:!0,title:I(e)?"You need to have at least one variable variant":"Delete variant",children:s("div",{children:s(Ft,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:I(e),children:s(vo,{})})})}),x(n_e,{children:[x(t_e,{children:[s(V8,{children:"Variant name"}),s(XRe,{children:"This will be used to identify the variant in your code"}),s(GI,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:H=>O(H.target.value),disabled:_,required:!0})]}),s(V,{condition:P,show:x(ZRe,{children:[s(JRe,{label:"Custom percentage",control:s(pa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:H=>d(H.target.checked)})}),s(e_e,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:p,onChange:H=>$(H.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s(bE,{position:"end",children:"%"})}})]})})]}),x(VI,{children:["Payload",s(Rs,{tooltip:"Passed along with the the variant object."})]}),x(G8,{children:[s(r_e,{id:"variant-payload-type",name:"type",label:"Type",value:f.type,options:HS,onChange:H=>{A("payload"),m(j=>({...j,type:H.target.value}))}}),s(QRe,{children:s(V,{condition:f.type==="json",show:s(g.Suspense,{fallback:null,children:s(GRe,{content:{text:f.value},onChange:H=>m(j=>{var W;return{...j,value:"json"in H?((W=H.json)==null?void 0:W.toString())||"":H.text}})})}),elseShow:s(GI,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:f.type!=="string",rows:f.type==="string"||f.type==="number"?1:4,value:f.value,onChange:H=>{A("payload"),m(j=>({...j,value:H.target.value}))},placeholder:"",onBlur:()=>F(f),error:!!w.payload,errorText:w.payload})})})]}),i?null:x(le,{children:[x(VI,{children:["Overrides",s(Rs,{tooltip:"Here you can specify which users should get this variant."})]}),s(WRe,{overrides:y,overridesDispatch:b}),s("div",{children:s(o_e,{onClick:M,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})};let km;const s_e=new Uint8Array(16);function l_e(){if(!km&&(km=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!km))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return km(s_e)}const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function c_e(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}const u_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qI={randomUUID:u_e};function KI(e,t,n){if(qI.randomUUID&&!t&&!e)return qI.randomUUID();e=e||{};const r=e.random||(e.rng||l_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return c_e(r)}const d_e=S(ye)(()=>({display:"flex",width:"100%",position:"relative"})),p_e=S(ye)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),f_e=S(ye)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),h_e=S(ye,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({height:e.spacing(1.8),width:"100%",position:"relative",background:e.palette.variants[t%e.palette.variants.length]})),g_e=S(ye)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),YI=S(re)(({theme:e})=>({marginY:e.spacing(1)})),m_e=S(ye)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),q8=S(ye,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",marginRight:e.spacing(2),"& div":{width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",marginRight:e.spacing(1),background:e.palette.variants[t%e.palette.variants.length]}})),y_e=S(re)(({theme:e})=>({marginTop:e.spacing(1)})),v_e=({variants:e})=>e.length<1?null:x(ye,{sx:t=>({marginTop:t.spacing(2)}),children:[s(b_e,{variants:e}),x(d_e,{children:[s(p_e,{}),e.map((t,n)=>{const r=t.weight/10;return s(Ll,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:s(E_e,{variant:t,index:n}),children:x(ye,{style:{width:`${r}%`},children:[" ",x(f_e,{children:[s(h_e,{index:n}),x(y_e,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),b_e=({variants:e})=>x(g_e,{children:[x(YI,{variant:"body2",children:["Feature variants (",e.length,")"]}),s(m_e,{children:e.map((t,n)=>x(q8,{index:n,children:[s(ye,{}),s(YI,{variant:"body2",children:t.name})]},n))})]}),S_e=S(ye)(()=>({display:"flex",flexDirection:"column"})),w_e=S(ye)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),x_e=S(ye)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),C_e=S(re)(({theme:e})=>({marginBottom:e.spacing(1)})),E_e=({variant:e,index:t})=>x(S_e,{children:[x(w_e,{children:[s(q8,{index:t,children:s(ye,{})}),x(re,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?x(x_e,{children:[s(C_e,{variant:"body2",children:"Payload"}),s(V,{condition:e.payload.type==="json",show:s("code",{children:e.payload.value}),elseShow:s(re,{variant:"body2",children:e.payload.value})})]}):null]}),T_e=()=>x(Lt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s(k_e,{}),"."]}),fje=()=>x(Lt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s("b",{children:"variants inside strategies"}),". ",s(A_e,{})]}),k_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),A_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),R_e=S("div")({display:"flex",flexDirection:"column"}),__e=({strategy:e,setStrategy:t,projectId:n,environment:r})=>{const{trackEvent:o}=Bn(),[i,a]=g.useState([]),l=on(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{a((e.variants||[]).map(p=>({...p,new:!1,isValid:!0,id:KI(),overrides:[]})))},[]),g.useEffect(()=>{t(p=>({...p,variants:i.map(h=>({stickiness:c,name:h.name,weight:h.weight,payload:h.payload,weightType:h.weightType}))}))},[c,JSON.stringify(i)]);const u=(p,h)=>{a(f=>H3(f.map(m=>m.id===h?p:m),1e3))},d=()=>{const p=KI();a(h=>[...h,{name:"",weightType:ds.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:p}]),o("strategy-variants",{props:{eventType:"variant added"}})};return x(le,{children:[x(re,{component:"h3",sx:{m:0,display:"flex",gap:"1ch"},variant:"h3",children:["Variants",s(Rs,{htmlTooltip:!0,tooltip:x(le,{children:[s("span",{children:"Variants allow to attach one or more values to this strategy. Variants at the strategy level override variants at the feature level."}),s($r,{target:"_blank",href:"https://docs.getunleash.io/reference/strategy-variants",children:"Learn more"})]})})]}),x(R_e,{children:[s(T_e,{}),i.map((p,h)=>s(a_e,{disableOverrides:!0,variant:p,variants:i,updateVariant:f=>u(f,p.id),removeVariant:()=>a(f=>H3(f.filter(m=>m.id!==p.id),1e3)),decorationColor:l.palette.variants[h%l.palette.variants.length]},p.id))]}),s(Io,{onClick:d,variant:"outlined",permission:y9,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",children:"Add variant"}),s(v_e,{variants:i})]})},P_e=S("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),Up=S("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),I_e=S("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),K8=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:h})=>{const{trackEvent:f}=Bn(),[m,y]=g.useState(!1),b=Ck(l.constraints),v=_Re(t,n),w=ld(r,e,n),{strategyDefinition:C}=Ek(l==null?void 0:l.name),{data:T}=u0(t.project),{changeRequestInReviewOrApproved:A,alert:k}=IRe(T),_=A(n||""),P=_?"Add to existing change request":"Add change to draft",I=pt(),{uiConfig:O,error:$,loading:F}=xt();if($)throw $;if(F||!C)return null;const M=H=>C.parameters.find(j=>j.name===H),B=(H,j)=>{const W=ERe(M(H),j);return W?(p.setFormError(H,W),!1):(p.removeFormError(H),!0)},q=()=>C.parameters.map(H=>H.name).map(H=>{var j;return B(H,(j=l.parameters)==null?void 0:j[H])}).every(Boolean),Y=()=>{I(kk(t.project,t.name))};return x(P_e,{onSubmit:async H=>{var j;Array.isArray(l.variants)&&((j=l.variants)==null?void 0:j.length)>0&&f("strategy-variants",{props:{eventType:"submitted"}}),H.preventDefault(),q()&&(v&&!h?y(!0):o())},children:[s(V,{condition:_,show:k,elseShow:s(V,{condition:!!h,show:s(ARe,{environment:n})})}),s(HCe,{projectId:t.project,featureId:t.name,environmentId:n,children:s(V,{condition:!!h,show:x(Lt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:x(Lt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",s("strong",{children:"save"}),"."]})})}),s(Up,{}),s($Re,{title:l.title||"",setTitle:H=>{c(j=>({...j,title:H}))}}),s(CRe,{segments:u,setSegments:d,projectId:e}),s(nRe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c}),s(Up,{}),s(zCe,{strategy:l,strategyDefinition:C,setStrategy:c,validateParameter:B,errors:p,hasAccess:w}),s(Up,{}),s(V,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:s(__e,{strategy:l,setStrategy:c,environment:n,projectId:e})}),s(Up,{}),s(NRe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(H=>({...H,disabled:!H.disabled}))}),s(Up,{}),x(I_e,{children:[s(Io,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:a||!b||p.hasFormErrors(),"data-testid":wse,children:h?P:"Save strategy"}),s(Ve,{type:"button",color:"primary",onClick:i||Y,disabled:a,children:"Cancel"}),s(RRe,{open:m,onClose:()=>y(!1),onClick:o,loading:a,label:"Save strategy"})]})]})},XI=e=>{const t=new URLSearchParams(window.location.search).get(e);if(!t)throw new Error(`Missing required query param: ${e}`);return t},O_e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{addStrategyToFeature:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies`,m=t(f,{method:"POST",body:JSON.stringify(h)},"addStrategyToFeature");return(await e(m.caller,m.id)).json()},updateStrategyOnFeature:async(u,d,p,h,f)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,y=t(m,{method:"PUT",body:JSON.stringify(f)},"updateStrategyOnFeature");await e(y.caller,y.id)},deleteStrategyFromFeature:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,m=t(f,{method:"DELETE"},"deleteStrategyFromFeature");await e(m.caller,m.id)},setStrategiesSortOrder:async(u,d,p,h)=>{const f=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/set-sort-order`,m=t(f,{method:"POST",body:JSON.stringify(h)},"setStrategiesSortOrderOnFeature");await e(m.caller,m.id)},setStrategyDisabledState:async(u,d,p,h,f)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${h}`,y=t(m,{method:"PATCH",body:JSON.stringify([{path:"/disabled",value:f,op:"replace"}])},"setStrategyDisabledState");await e(y.caller,y.id)},loading:r,errors:n}},Y8=()=>{const[e,t]=g.useState({}),n=g.useCallback(a=>e[a],[e]),r=g.useCallback((a,l)=>{t(ki(c=>{c[a]=l}))},[t]),o=g.useCallback(a=>{t(ki(l=>{delete l[a]}))},[t]),i=g.useCallback(()=>Object.values(e).some(Boolean),[e]);return{getFormError:n,setFormError:r,removeFormError:o,hasFormErrors:i}},$_e=(e,t)=>{const n=t.parameters.map(r=>r.name);return Object.fromEntries(Object.entries(e).sort((r,o)=>n.indexOf(r[0])-n.indexOf(o[0])))};var JI=Object.prototype.hasOwnProperty;function QI(e,t,n){for(n of e.keys())if(Mf(n,t))return n}function Mf(e,t){var n,r,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Mf(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(o=r,o&&typeof o=="object"&&(o=QI(t,o),!o)||!t.has(o))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(o=r[0],o&&typeof o=="object"&&(o=QI(t,o),!o)||!Mf(r[1],t.get(o)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(JI.call(e,n)&&++r&&!JI.call(t,n)||!(n in t)||!Mf(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var X8={exports:{}};(function(e,t){(function(n,r){var o=r(n);e.exports=o})(Ei,function(n){var r=["N","E","A","D"];function o(P,I){P.super_=I,P.prototype=Object.create(I.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}})}function i(P,I){Object.defineProperty(this,"kind",{value:P,enumerable:!0}),I&&I.length&&Object.defineProperty(this,"path",{value:I,enumerable:!0})}function a(P,I,O){a.super_.call(this,"E",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0}),Object.defineProperty(this,"rhs",{value:O,enumerable:!0})}o(a,i);function l(P,I){l.super_.call(this,"N",P),Object.defineProperty(this,"rhs",{value:I,enumerable:!0})}o(l,i);function c(P,I){c.super_.call(this,"D",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0})}o(c,i);function u(P,I,O){u.super_.call(this,"A",P),Object.defineProperty(this,"index",{value:I,enumerable:!0}),Object.defineProperty(this,"item",{value:O,enumerable:!0})}o(u,i);function d(P,I,O){var $=P.slice((O||I)+1||P.length);return P.length=I<0?P.length+I:I,P.push.apply(P,$),P}function p(P){var I=typeof P;return I!=="object"?I:P===Math?"math":P===null?"null":Array.isArray(P)?"array":Object.prototype.toString.call(P)==="[object Date]"?"date":typeof P.toString=="function"&&/^\/.*\//.test(P.toString())?"regexp":"object"}function h(P){var I=0;if(P.length===0)return I;for(var O=0;O<P.length;O++){var $=P.charCodeAt(O);I=(I<<5)-I+$,I=I&I}return I}function f(P){var I=0,O=p(P);if(O==="array"){P.forEach(function(q){I+=f(q)});var $="[type: array, hash: "+I+"]";return I+h($)}if(O==="object"){for(var F in P)if(P.hasOwnProperty(F)){var M="[ type: object, key: "+F+", value hash: "+f(P[F])+"]";I+=h(M)}return I}var B="[ type: "+O+" ; value: "+P+"]";return I+h(B)}function m(P,I,O,$,F,M,B,q){O=O||[],F=F||[],B=B||[];var Y=F.slice(0);if(typeof M<"u"&&M!==null){if($){if(typeof $=="function"&&$(Y,M))return;if(typeof $=="object"){if($.prefilter&&$.prefilter(Y,M))return;if($.normalize){var ne=$.normalize(Y,M,P,I);ne&&(P=ne[0],I=ne[1])}}}Y.push(M)}p(P)==="regexp"&&p(I)==="regexp"&&(P=P.toString(),I=I.toString());var H=typeof P,j=typeof I,W,R,N,J,se=H!=="undefined"||B&&B.length>0&&B[B.length-1].lhs&&Object.getOwnPropertyDescriptor(B[B.length-1].lhs,M),xe=j!=="undefined"||B&&B.length>0&&B[B.length-1].rhs&&Object.getOwnPropertyDescriptor(B[B.length-1].rhs,M);if(!se&&xe)O.push(new l(Y,I));else if(!xe&&se)O.push(new c(Y,P));else if(p(P)!==p(I))O.push(new a(Y,P,I));else if(p(P)==="date"&&P-I!==0)O.push(new a(Y,P,I));else if(H==="object"&&P!==null&&I!==null){for(W=B.length-1;W>-1;--W)if(B[W].lhs===P){J=!0;break}if(J)P!==I&&O.push(new a(Y,P,I));else{if(B.push({lhs:P,rhs:I}),Array.isArray(P)){for(q&&(P.sort(function(ee,ae){return f(ee)-f(ae)}),I.sort(function(ee,ae){return f(ee)-f(ae)})),W=I.length-1,R=P.length-1;W>R;)O.push(new u(Y,W,new l(void 0,I[W--])));for(;R>W;)O.push(new u(Y,R,new c(void 0,P[R--])));for(;W>=0;--W)m(P[W],I[W],O,$,Y,W,B,q)}else{var ge=Object.keys(P),Oe=Object.keys(I);for(W=0;W<ge.length;++W)N=ge[W],J=Oe.indexOf(N),J>=0?(m(P[N],I[N],O,$,Y,N,B,q),Oe[J]=null):m(P[N],void 0,O,$,Y,N,B,q);for(W=0;W<Oe.length;++W)N=Oe[W],N&&m(void 0,I[N],O,$,Y,N,B,q)}B.length=B.length-1}}else P!==I&&(H==="number"&&isNaN(P)&&isNaN(I)||O.push(new a(Y,P,I)))}function y(P,I,O,$,F){var M=[];if(m(P,I,M,$,null,null,null,F),O)for(var B=0;B<M.length;++B)O(M[B]);return M}function b(P,I,O,$,F,M,B){return m(P,I,O,$,F,M,B,!0)}function v(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,M=y(P,I,F,O);return $||(M.length?M:void 0)}function w(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,M=y(P,I,F,O,!0);return $||(M.length?M:void 0)}function C(P,I,O){if(O.path&&O.path.length){var $=P[I],F,M=O.path.length-1;for(F=0;F<M;F++)$=$[O.path[F]];switch(O.kind){case"A":C($[O.path[F]],O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}else switch(O.kind){case"A":C(P[I],O.index,O.item);break;case"D":P=d(P,I);break;case"E":case"N":P[I]=O.rhs;break}return P}function T(P,I,O){if(typeof O>"u"&&I&&~r.indexOf(I.kind)&&(O=I),P&&O&&O.kind){for(var $=P,F=-1,M=O.path?O.path.length-1:0;++F<M;)typeof $[O.path[F]]>"u"&&($[O.path[F]]=typeof O.path[F+1]<"u"&&typeof O.path[F+1]=="number"?[]:{}),$=$[O.path[F]];switch(O.kind){case"A":O.path&&typeof $[O.path[F]]>"u"&&($[O.path[F]]=[]),C(O.path?$[O.path[F]]:$,O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}}function A(P,I,O){if(O.path&&O.path.length){var $=P[I],F,M=O.path.length-1;for(F=0;F<M;F++)$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}else switch(O.kind){case"A":A(P[I],O.index,O.item);break;case"D":P[I]=O.lhs;break;case"E":P[I]=O.lhs;break;case"N":P=d(P,I);break}return P}function k(P,I,O){if(P&&I&&O&&O.kind){var $=P,F,M;for(M=O.path.length-1,F=0;F<M;F++)typeof $[O.path[F]]>"u"&&($[O.path[F]]={}),$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}}function _(P,I,O){if(P&&I){var $=function(F){(!O||O(P,I,F))&&T(P,I,F)};y(P,I,$)}}return Object.defineProperties(v,{diff:{value:v,enumerable:!0},orderIndependentDiff:{value:w,enumerable:!0},observableDiff:{value:y,enumerable:!0},orderIndependentObservableDiff:{value:b,enumerable:!0},orderIndepHash:{value:f,enumerable:!0},applyDiff:{value:_,enumerable:!0},applyChange:{value:T,enumerable:!0},revertChange:{value:k,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),v.DeepDiff=v,n&&(n.DeepDiff=v),v})})(X8);var N_e=X8.exports;const L_e={A:" ",E:" ",D:"-",N:"+"},Xd=({entry:e,sort:t=(n,r)=>n.key.localeCompare(r.key)})=>{const n=qh(),r={A:{color:n.palette.eventLog.edited},E:{color:n.palette.eventLog.edited},D:{color:n.palette.eventLog.diffSub},N:{color:n.palette.eventLog.diffAdd}},o=e.data&&e.preData?N_e.diff(e.preData,e.data):void 0,i=(c,u)=>{let d;return c.lhs!==void 0?d=x("div",{style:r.D,children:["- ",u,": ",JSON.stringify(c.lhs)]}):c.rhs!==void 0&&(d=x("div",{style:r.N,children:["+ ",u,": ",JSON.stringify(c.rhs)]})),d},a=(c,u)=>{var h;let d;const p=((h=c.path)==null?void 0:h.join("."))??c.index;if(c.item)d=i(c.item,p);else if(c.lhs!==void 0&&c.rhs!==void 0)d=x("div",{children:[x("div",{style:r.D,children:["- ",p,": ",JSON.stringify(c.lhs)]}),x("div",{style:r.N,children:["+ ",p,": ",JSON.stringify(c.rhs)]})]});else{const f=JSON.stringify(c.rhs||c.item);d=x("div",{style:r[c.kind],children:[L_e[c.kind]," ",p,f?`: ${f}`:c.kind==="D"?" (deleted)":""]})}return{key:p.toString(),value:s("div",{children:d},u),index:u}};let l=[];if(o)l=o.map(a).sort(t).map(({value:c})=>c);else if(e.data==null||e.preData==null){const c=e.data||e.preData;l=[s("div",{style:e.data?r.N:r.D,children:JSON.stringify(c,null,2)},0)]}return s("pre",{style:{overflowX:"auto",overflowY:"hidden"},tabIndex:0,children:s("code",{children:l.length===0?"(no changes)":l})})},D_e=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=on(),a=ar(i.breakpoints.down("sm")),l=g.useMemo(()=>{const c={...FL,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return x(OE,{mounted:t,start:l,enter:zL,children:[s(re,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s(re,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s(Xd,{entry:{preData:o,data:r}}),s(Ve,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},M_e=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},J8=(e,t,n,r)=>{const{data:o,refetch:i}=M_e(e),[a,l]=g.useState(t||null),[c,u]=g.useState(!1),d=h=>{u(!1),l(h)},p=h=>h&&(r&&typeof r=="function"?r(h):h);return g.useEffect(()=>{a===null&&l(t)},[t]),g.useEffect(()=>{if(!a||!o)return;Mf(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s(D_e,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function lC(e,t){if(Array.isArray(e))return e.map(n=>lC(n,t));if(typeof e=="object"&&e!==null){const n={};for(const[r,o]of Object.entries(e))r!==t&&(n[r]=lC(o,t));return n}return e}const Q8=e=>{const t={...e};return lC(t,"lastSeenAt")},Jd=()=>{const{trackEvent:e}=Bn(),{makeRequest:t,createRequest:n,errors:r,loading:o}=qn({propagateErrors:!0});return{addChange:async(f,m,y)=>{e("change_request",{props:{eventType:"change added"}});const b=`api/admin/projects/${f}/environments/${m}/change-requests`,v=n(b,{method:"POST",body:JSON.stringify(y)});return(await t(v.caller,v.id)).json()},editChange:async(f,m,y,b)=>{const v=`api/admin/projects/${f}/change-requests/${m}/changes/${y}`,w=n(v,{method:"PUT",body:JSON.stringify(b)});return t(w.caller,w.id)},changeState:async(f,m,y)=>{e("change_request",{props:{eventType:y.state}});const b=`api/admin/projects/${f}/change-requests/${m}/state`,v=n(b,{method:"PUT",body:JSON.stringify(y)});return(await t(v.caller,v.id)).json()},discardChange:async(f,m,y)=>{const b=`api/admin/projects/${f}/change-requests/${m}/changes/${y}`,v=n(b,{method:"DELETE"});return t(v.caller,v.id)},updateChangeRequestEnvironmentConfig:async({project:f,enabled:m,environment:y,requiredApprovals:b})=>{const v=`api/admin/projects/${f}/environments/${y}/change-requests/config`,w=n(v,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:m,requiredApprovals:b})});return t(w.caller,w.id)},discardDraft:async(f,m)=>{const y=`api/admin/projects/${f}/change-requests/${m}`,b=n(y,{method:"DELETE"});return t(b.caller,b.id)},addComment:async(f,m,y)=>{e("change_request",{props:{eventType:"comment added"}});const b=`/api/admin/projects/${f}/change-requests/${m}/comments`,v=n(b,{method:"POST",body:JSON.stringify({text:y})});return t(v.caller,v.id)},updateTitle:async(f,m,y)=>{e("change_request",{props:{eventType:"title updated"}});const b=`api/admin/projects/${f}/change-requests/${m}/title`,v=n(b,{method:"PUT",body:JSON.stringify({title:y})});return t(v.caller,v.id)},errors:r,loading:o}},B_e=()=>{const[e,t]=g.useState(""),{trackEvent:n}=Bn();return{setPreviousTitle:t,trackTitle:(o="")=>{o===e&&n("strategyTitle",{props:{action:"none",on:"edit"}}),e===""&&o!==""&&n("strategyTitle",{props:{action:"added",on:"edit"}}),e!==""&&o===""&&n("strategyTitle",{props:{action:"removed",on:"edit"}}),e!==""&&o!==""&&o!==e&&n("strategyTitle",{props:{action:"edited",on:"edit"}})}}},hje=()=>{const e=br("projectId"),t=br("featureId"),n=XI("environmentId"),r=XI("strategyId"),[o,i]=g.useState({}),[a,l]=g.useState([]),{updateStrategyOnFeature:c,loading:u}=O_e(),{strategyDefinition:d}=Ek(o.name),{setToastData:p,setToastApiError:h}=Ot(),f=Y8(),{uiConfig:m}=xt(),{unleashUrl:y}=m,b=pt(),{addChange:v}=Jd(),{isChangeRequestConfigured:w}=Wc(e),{refetch:C}=u0(e),{setPreviousTitle:T}=B_e(),{feature:A,refetchFeature:k}=Qa(e,t),_=g.useRef(A),{data:P,staleDataNotification:I,forceRefreshCache:O}=J8({unleashGetter:Qa,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},A,{afterSubmitAction:k},Q8);g.useEffect(()=>{_.current.name===""&&A.name&&(O(A),_.current=A)},[A]);const{segments:$,refetchSegments:F}=Ml(r);g.useEffect(()=>{const ne=P==null?void 0:P.environments.flatMap(H=>H.strategies).find(H=>H.id===r);i(H=>({...H,...ne})),T((ne==null?void 0:ne.title)||"")},[r,P]),g.useEffect(()=>{$&&l($)},[JSON.stringify($)]);const M=F_e(o,a),B=async ne=>{await c(e,t,n,r,ne),await F(),p({title:"Strategy updated",type:"success",confetti:!0})},q=async ne=>{await v(e,n,{action:"updateStrategy",feature:t,payload:{...ne,id:r}}),p({title:"Change added to draft",type:"success",confetti:!0}),C()},Y=async()=>{try{w(n)?await q(M):await B(M),k(),b(kk(e,t))}catch(ne){h(vt(ne))}};return!o.id||!d||!P?null:x(Nr,{modal:!0,title:As(o.name??""),description:j_e,documentationLink:U_e,documentationLinkLabel:W_e,formatApiCode:()=>z_e(e,t,n,r,M,d,y),children:[s(K8,{projectId:e,feature:P,strategy:o,setStrategy:i,segments:a,setSegments:l,environmentId:n,onSubmit:Y,loading:u,permission:z1,errors:f,isChangeRequest:w(n)}),I]})},F_e=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),kk=(e,t)=>`/projects/${e}/features/${t}`,Ak=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},z_e=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:$_e(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
316
316
  --header 'Authorization: INSERT_API_KEY' \\
317
317
  --header 'Content-Type: application/json' \\
318
318
  --data-raw '${u}'`},j_e=`
@@ -373,12 +373,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
373
373
  --data-raw '${JSON.stringify(C(),void 0,2)}'`,F=zIe(r==null?void 0:r.project)(),{addChange:M}=Jd();return s(Nr,{loading:u,modal:e,title:"Edit segment",description:EB,documentationLink:W8,documentationLinkLabel:"Segments documentation",formatApiCode:O,children:s(CB,{handleSubmit:async q=>{if(r){q.preventDefault(),A();try{F?await M(r.project||"",F,{action:"updateSegment",feature:null,payload:{id:r.id,...C()}}):await c(r.id,C()),d(),l(t?`/projects/${t}/settings/segments/`:"/segments/"),i({title:`Segment ${F?"change added to draft":"updated"}`,type:"success"})}catch(Y){a(vt(Y))}}},name:p,setName:h,description:f,setDescription:m,project:y,setProject:b,constraints:v,setConstraints:w,errors:T,clearErrors:A,mode:"edit",children:s(Vd,{permission:mT,disabled:!k||I,"data-testid":cse,children:F?"Add to draft":"Save"})})})},UIe=()=>{const{uiConfig:e}=xt(),t=pt();return s(GM,{onClick:()=>t("/environments/create"),maxWidth:"700px",Icon:fa,permission:mi,disabled:!e.flags.EEA,children:"New environment"})},WIe=(e,t,n)=>{const r=g.useRef(null);return g.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),HIe(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},HIe=(e,t,n)=>{const r=p=>{Rm&&t(Number(Rm.dataset.index),Number(e.dataset.index),p)},o=n??e,i=p=>{p.target===o&&(e.draggable=!0)},a=()=>{e.draggable=!1},l=()=>{e.draggable=!0,Rm=e},c=()=>{r(!1)},u=p=>{p.preventDefault()},d=()=>{r(!0),Rm=null};return o.addEventListener("mouseenter",i),o.addEventListener("mouseleave",a),n&&e.addEventListener("mouseenter",a),e.addEventListener("dragstart",l),e.addEventListener("dragenter",c),e.addEventListener("dragover",u),e.addEventListener("drop",d),()=>{o.removeEventListener("mouseenter",i),o.removeEventListener("mouseleave",a),n&&e.removeEventListener("mouseenter",a),e.removeEventListener("dragstart",l),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",u),e.removeEventListener("drop",d)}};let Rm;const VIe=S(ji)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),GIe=({row:e,moveListItem:t})=>{const{hasAccess:n}=g.useContext(Po),r=g.useRef(null),{searchQuery:o}=Nl(),i=!o&&n(Dx),a=WIe(e.index,t,r),l=(c,u)=>i&&c.column.isDragHandle?s(Wi,{...c.getCellProps(),ref:u,className:"drag-handle",children:c.render("Cell")}):s(Wi,{...c.getCellProps(),children:c.render("Cell")});return s(VIe,{hover:!0,ref:i?a:void 0,children:e.cells.map(c=>l(c,r))})},qIe=S(re)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),KIe=S(re)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),fO=S(jt)(({theme:e})=>({marginLeft:e.spacing(1)})),YIe=({environment:e})=>{const{searchQuery:t}=Nl();return x(jn,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:[s(Ka,{search:t,children:e.name}),s(V,{condition:e.protected,show:s(fO,{color:"success",children:"Predefined"})}),s(V,{condition:!e.enabled,show:s(Ld,{maxWidth:"270px",title:x(le,{children:[s(qIe,{children:"Deprecated environment"}),s(KIe,{children:"This environment is not auto-enabled for new projects. The project owner will need to manually enable it in the project."})]}),describeChild:!0,arrow:!0,children:s(fO,{color:"neutral",children:"Deprecated"})})})]})},Tu=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:i})=>{const{hasAccess:a}=g.useContext(Po);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),s(Ll,{...i,title:F1(l,o),children:n({hasAccess:l})})},XIe=S(wE)(({theme:e})=>({padding:e.spacing(1)})),ty=S(sa)(({theme:e})=>({borderRadius:e.shape.borderRadius})),JIe=S(ty)(({theme:e})=>({color:e.palette.error.main})),QIe=S(ul)(({theme:e})=>({color:e.palette.error.main})),ZIe=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[i,a]=g.useState(null),l=!!i,c=h=>{a(h.currentTarget)},u=()=>{a(null)},d=`environment-${e.name}-actions`,p=`${d}-menu`;return x(le,{children:[s(yt,{title:"Environment actions",arrow:!0,describeChild:!0,children:s(Ft,{id:d,"aria-controls":l?p:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:s(H1,{})})}),s(xE,{id:p,anchorEl:i,open:l,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:x(XIe,{"aria-labelledby":d,children:[s(Tu,{permission:Dx,children:({hasAccess:h})=>x(ty,{onClick:()=>{t(),u()},disabled:!h||e.protected,children:[s(ul,{children:s(Ui,{})}),s(en,{children:s(re,{variant:"body2",children:"Edit"})})]})}),s(Tu,{permission:mi,children:({hasAccess:h})=>x(ty,{onClick:()=>{r(),u()},disabled:!h,children:[s(ul,{children:s(yce,{})}),s(en,{children:s(re,{variant:"body2",children:"Clone"})})]})}),s(Tu,{permission:Dx,children:({hasAccess:h})=>x(ty,{onClick:()=>{n(),u()},disabled:!h||e.protected,children:[s(ul,{children:s(V,{condition:e.enabled,show:s(Xce,{}),elseShow:s(Jce,{})})}),s(en,{children:s(re,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),s(Tu,{permission:Ufe,children:({hasAccess:h})=>x(JIe,{onClick:()=>{o(),u()},disabled:!h||e.protected,children:[s(QIe,{children:s(vo,{})}),s(en,{children:s(re,{variant:"body2",children:"Delete"})})]})})]})})]})},hO=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},eOe=S($r)(({theme:e})=>({cursor:"pointer",fontSize:e.fontSizes.bodySize})),kB=({isAllSelected:e,onClick:t})=>s(ye,{sx:{ml:3.5,my:.5},children:s(eOe,{onClick:t,component:"button",underline:"hover",children:e?"Deselect all":"Select all"})}),tOe=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),nOe=S("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),rOe=S("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),oOe=(e,t,n)=>x("li",{...e,children:[s(ts,{icon:s(p0,{fontSize:"small"}),checkedIcon:s(f0,{fontSize:"small"}),style:{marginRight:8},checked:n}),x(tOe,{children:[s("span",{children:t.name}),s("span",{children:t.description})]})]}),iOe=e=>s(nOe,{children:e.length>1?`${e.length} projects selected`:e[0].name}),aOe=({projects:e,setProjects:t})=>{const{projects:n}=ga(),r=n.sort((c,u)=>c.name.localeCompare(u.name)).map(({id:c,name:u,description:d})=>({id:c,name:u,description:d})),o=r.filter(({id:c})=>e.includes(c)),i=e.length>0&&e.length===r.length,a=()=>{const c=i?[]:r.map(({id:u})=>u);t(c)};return s(rOe,{children:s(Od,{size:"small",multiple:!0,limitTags:1,openOnFocus:!0,disableCloseOnSelect:!0,value:o,onChange:(c,u,d)=>{c.type==="keydown"&&c.key==="Backspace"&&d==="removeOption"||t(u.map(({id:p})=>p))},options:r,renderOption:(c,u,{selected:d})=>oOe(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:p})=>hO(u,d)||hO(u,p)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>s(vn,{...c,label:"Projects"}),renderTags:c=>iOe(c),groupBy:()=>"Select/Deselect all",renderGroup:({key:c,children:u})=>x(g.Fragment,{children:[s(V,{condition:r.length>2,show:s(kB,{isAllSelected:i,onClick:a})}),u]},c)})})},Wp="*",sOe=({...e})=>s(Sr,{elevation:8,...e}),lOe=S(ts)(({theme:e})=>({marginRight:e.spacing(.4)})),cOe=({options:e,defaultValue:t=[Wp],onChange:n,disabled:r,error:o,onFocus:i})=>{const[a,l]=g.useState(typeof t=="string"?[t]:t),[c,u]=g.useState(typeof t=="string"||t.includes(Wp)),d=a.length>0&&a.length===e.length&&a[0]!==Wp,p=(b,v)=>{v?(u(!0),n([Wp])):(u(!1),n(a.includes(Wp)?[]:a))},h=()=>{const b=d?[]:e.map(({value:v})=>v);l(b),n(b)};return x(ye,{sx:{mt:-1,mb:3},children:[s(ye,{sx:{mt:1,mb:.25,ml:1.5},children:s(Gr,{disabled:r,"data-testid":"select-all-projects",control:s(ts,{checked:r||c,onChange:p}),label:"ALL current and future projects"})}),s(Od,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:b})=>b,groupBy:()=>"Select/Deselect all",renderGroup:({key:b,children:v})=>x(g.Fragment,{children:[s(V,{condition:e.length>2,show:s(kB,{isAllSelected:d,onClick:h})}),v]},b),fullWidth:!0,PaperComponent:sOe,renderOption:(b,v,{selected:w})=>x("li",{...b,children:[s(lOe,{icon:s(p0,{fontSize:"small"}),checkedIcon:s(f0,{fontSize:"small"}),checked:w}),v.label]}),renderInput:b=>s(vn,{...b,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:i,"data-testid":"select-input"}),value:c||r?e:e.filter(b=>a.includes(b.value)),onChange:(b,v)=>{const w=v.map(({value:C})=>C);l(w),n(w)}})]})},uOe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{deleteToken:async a=>{const l=`api/admin/api-tokens/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},createToken:async a=>{const c=t("api/admin/api-tokens",{method:"POST",body:JSON.stringify(a)});return e(c.caller,c.id)},errors:n,loading:r}},dOe=S("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),uu=S("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),YS=S("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),pOe=S(cr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),fOe=S("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),hOe=S("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),gOe=S("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),mOe=S(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),yOe=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:i}=Md(),{cloneEnvironment:a,loading:l}=Wd(),{createToken:c}=uOe(),{projects:u}=ga(),{setToastData:d,setToastApiError:p}=Ot(),{uiConfig:h}=xt(),[f,m]=g.useState(`${e.name}_clone`),[y,b]=g.useState("development"),[v,w]=g.useState([]),[C,T]=g.useState(["*"]),[A,k]=g.useState(!0),[_,P]=g.useState("later"),[I,O]=g.useState({}),$=J=>{O(se=>({...se,[J]:void 0}))},F=(J,se)=>{O(xe=>({...xe,[J]:se}))};g.useEffect(()=>{m(M(e.name)),b("development"),w([]),T(["*"]),k(!0),P("later"),O({})},[e]);const M=J=>{let se=`${J}_clone`,xe=2;for(;!j(se);)se=`${e.name}_clone_${xe}`,xe++;return se},B=()=>({name:f,type:y,projects:v,clonePermissions:A}),q=()=>({username:`${f}_token`,type:"CLIENT",environment:f,projects:C}),Y=async J=>{J.preventDefault();try{if(await a(e.name,B()),_==="now"){const xe=await(await c(q())).json();r(xe)}d({title:"Environment successfully cloned!",type:"success"}),i(),n(!1)}catch(se){p(vt(se))}},ne=()=>`curl --location --request POST '${h.unleashUrl}/api/admin/environments/${e.name}/clone' \\
374
374
  --header 'Authorization: INSERT_API_KEY' \\
375
375
  --header 'Content-Type: application/json' \\
376
- --data-raw '${JSON.stringify(B(),void 0,2)}'`,H=J=>J.length,j=J=>!(o!=null&&o.some(se=>se.name===J)),W=H(f)&&j(f)&&C.length,R=J=>{$("name"),j(J)||F("name","An environment with that name already exists."),m(J)},N=u.map(J=>({value:J.id,label:J.name}));return s(mg,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s(Nr,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:ne,children:x(dOe,{onSubmit:Y,children:[x("div",{children:[s(uu,{children:"What is your new environment name? (Can't be changed later)"}),s(pOe,{autoFocus:!0,label:"Environment name",error:!!I.name,errorText:I.name,value:f,onChange:J=>R(J.target.value),required:!0}),s(uu,{children:"What type of environment do you want to create?"}),s(YM,{onChange:J=>b(J.currentTarget.value),value:y}),x(uu,{children:["Select which projects you want to clone the environment configuration in?",s(Rs,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),s(aOe,{projects:v,setProjects:w}),s(uu,{children:"Keep the users permission for this environment?"}),s(YS,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),s(Gr,{label:A?"Yes":"No",control:s(pa,{onChange:J=>k(J.target.checked),checked:A})}),x(fOe,{children:[s(uu,{children:"API Token"}),x(YS,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s($r,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s($s,{children:x(EE,{value:_,onChange:J=>P(J.target.value),name:"api-token-generation",children:[s(Gr,{value:"later",control:s(dc,{}),label:"I want to generate an API token later"}),s(Gr,{value:"now",control:s(dc,{}),label:"Generate an API token now"})]})}),x(hOe,{children:[s(YS,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),s(V,{condition:_==="now",show:x(le,{children:[s(uu,{children:"Which projects do you want this token to give access to?"}),s(cOe,{options:N,defaultValue:C,onChange:T,error:I.projects,onFocus:()=>$("projects")})]})})]})]})]}),x(gOe,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!W,children:"Clone environment"}),s(mOe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var Bk={},vOe=Sn;Object.defineProperty(Bk,"__esModule",{value:!0});var Fk=Bk.default=void 0,bOe=vOe(wn()),SOe=xn,wOe=(0,bOe.default)((0,SOe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");Fk=Bk.default=wOe;const AB=({token:e})=>{const{setToastData:t}=Ot();return x(ye,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s(yt,{title:"Copy token",arrow:!0,children:s(Ft,{onClick:()=>{G9(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:s(Fk,{})})})]})},xOe=({open:e,setOpen:t,token:n})=>x(Zn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s(re,{variant:"body1",children:"Your new token has been created successfully."}),x(re,{variant:"body1",children:['You can also find it as "',s("strong",{children:n==null?void 0:n.username}),'" in the'," ",s(qt,{to:"/admin/api",children:"API access page"}),"."]}),s(AB,{token:(n==null?void 0:n.secret)||""})]}),COe=S(ye)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),EOe=S(Ft)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),TOe=S(ED,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),RB=({environment:e})=>x(COe,{children:[s(EOe,{size:"large",disableRipple:!0,className:"drag-icon",children:s(kce,{titleAccess:"Drag to reorder"})}),s(TOe,{deprecated:!e.enabled})]}),kOe=S(da)(({theme:e})=>({marginTop:e.spacing(3)})),AOe=S("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),_B=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s(RB,{environment:c})},{Header:"Name",accessor:"name",Cell:jn},{Header:"Type",accessor:"type",Cell:jn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>x(jn,{children:[u,s(V,{condition:!!t,show:s(AOe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=nn.useTable({columns:n,data:[e],disableSortBy:!0});return x(kOe,{...r(),rowHeight:"compact",children:[s(ua,{headerGroups:i}),s(la,{...o(),children:a.map(c=>(l(c),s(ji,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>s(Wi,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},ROe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return x(Zn,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s(V,{condition:o,show:s(Lt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s(Lt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s(_B,{environment:e})]})},_Oe=S("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),POe=S(cr)(()=>({width:"100%"})),IOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=g.useState("");return g.useEffect(()=>{i("")},[t]),x(Zn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[x(Lt,{severity:"error",children:[s("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),s(_B,{environment:e,warnEnabledToggles:!0}),x(_Oe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s("strong",{children:e.name})]}),s(POe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},OOe=({environment:e})=>{const t=pt(),{setToastApiError:n,setToastData:r}=Ot(),{environments:o,refetchEnvironments:i}=Md(),{refetch:a}=GT(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=Wd(),[d,p]=g.useState(!1),[h,f]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(!1),[w,C]=g.useState();return x(Tl,{children:[s(ZIe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>f(!0),onClone:()=>{o.length<Qy?y(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Qy}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),s(IOe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await l(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(k){n(vt(k))}finally{p(!1),await i()}}}),s(ROe,{environment:e,open:h,setOpen:f,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(k){n(vt(k))}finally{f(!1),await i()}}}),s(yOe,{environment:e,open:m,setOpen:y,newToken:k=>{C(k),v(!0)}}),s(xOe,{open:b,setOpen:v,token:w})]})},$Oe=S(ye)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),NOe=S("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),LOe=S("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),fl=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Nl();return x($Oe,{children:[x(NOe,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[s(Ka,{search:r,children:e}),n]}),s(V,{condition:!!t,show:()=>s(LOe,{"data-loading":!0,children:s(Ka,{search:r,children:t})})})]})},DOe=S(Lt)(({theme:e})=>({marginBottom:e.spacing(4)})),MOe=()=>{const{changeSortOrder:e}=Wd(),{setToastApiError:t}=Ot(),{environments:n,mutateEnvironments:r}=Md(),o=g.useCallback(async(b,v,w=!1)=>{const C=[...n],T=C[b];if(C.splice(b,1),C.splice(v,0,T),await r(C),w)try{await e(zxe(C))}catch(A){t(vt(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=nn.useTable({columns:BOe,data:n,disableSortBy:!0},nn.useGlobalFilter),f=x(le,{children:[s(Ro,{initialValue:d,onChange:p}),s(kn.Divider,{}),s(UIe,{})]}),m=c.length,y=s(kn,{title:`Environments (${m})`,actions:f});return x(er,{header:y,children:[s(DOe,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),s(ns,{value:d,children:x(da,{...i(),rowHeight:"compact",children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(b=>(u(b),s(GIe,{row:b,moveListItem:o},b.original.name)))})]})}),s(V,{condition:c.length===0,show:s(V,{condition:(d==null?void 0:d.length)>0,show:x(Fr,{children:["No environments found matching “",d,"”"]}),elseShow:s(Fr,{children:"No environments available. Get started by adding one."})})})]})},BOe=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s(RB,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s(YIe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:fl},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:jn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:jn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>s(OOe,{environment:e}),disableGlobalFilter:!0}],FOe=()=>{const e=Xa("projectId"),t=pt();return s(Io,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[j1,yT],projectId:e,"data-testid":ese,children:"New segment"})},zOe=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),jOe=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),UOe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),WOe=S(qt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),HOe=()=>{const{hasAccess:e}=g.useContext(Po);return x(zOe,{children:[s(jOe,{children:"No segments yet!"}),s(UOe,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s(V,{condition:e(j1),show:s(WOe,{to:"/segments/create",children:"Create your first segment"})})]})},VOe=S(cr)(({theme:e})=>({marginTop:e.spacing(2)})),GOe=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=g.useState(""),a=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return x(Zn,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:l,formId:c,children:[x("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:c,children:s(VOe,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":dse})})]})},qOe=S("ul")({marginBottom:0}),KOe=S(qt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),YOe=({segment:e,open:t,onClose:n,strategies:r})=>x(Zn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[x("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(qOe,{children:r==null?void 0:r.map(o=>s("li",{children:x(KOe,{to:Ak(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",XOe(o)]})},o.id))})]}),XOe=e=>e.strategyName?`(${As(e.strategyName)})`:"",JOe=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=SB(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(V,{condition:a,show:s(GOe,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(YOe,{segment:e,open:t,onClose:n,strategies:o})})},QOe=({segment:e})=>{const t=Xa("projectId"),{refetchSegments:n}=Ml(),{deleteSegment:r}=Nk(),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(vt(u))}finally{l(!1)}};return x(le,{children:[s(Kr,{onClick:()=>l(!0),permission:[Vfe,yT],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${use}_${e.name}`,children:s(vo,{"data-loading":!0})}),s(V,{condition:a,show:()=>s(JOe,{segment:e,open:a,onClose:()=>l(!1),onRemove:c})})]})},ZOe=({segment:e})=>{const t=Xa("projectId"),n=pt();return s(Kr,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[mT,yT],projectId:t,tooltipProps:{title:"Edit segment"},children:s(Ui,{"data-loading":!0})})},e4e=({segment:e})=>x(Tl,{children:[s(ZOe,{segment:e}),s(QOe,{segment:e})]}),t4e=()=>{const e=Xa("projectId"),{segments:t,loading:n}=Ml(),r=ar(ca.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=g.useMemo(()=>t?e?t.filter(({project:y})=>y===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=g.useMemo(()=>n4e(),[]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:h},setGlobalFilter:f,setHiddenColumns:m}=nn.useTable({initialState:o,columns:a,data:i,sortTypes:ui,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:fl}},nn.useGlobalFilter,nn.useSortBy);return Dd([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),s(er,{header:s(kn,{title:`Segments (${d.length})`,actions:x(le,{children:[s(Ro,{initialValue:h,onChange:f}),s(kn.Divider,{}),s(FOe,{})]})}),isLoading:n,children:s(V,{condition:!n&&i.length===0,show:s(Fr,{children:s(HOe,{})}),elseShow:()=>x(le,{children:[s(ns,{value:h,children:x(da,{...l(),rowHeight:"standard",children:[s(ua,{headerGroups:u}),s(la,{...c(),children:d.map(y=>(p(y),s(ji,{hover:!0,...y.getRowProps(),children:y.cells.map(b=>s(Wi,{...b.getCellProps(),children:b.render("Cell")}))})))})]})}),s(V,{condition:d.length===0&&(h==null?void 0:h.length)>0,show:x(Fr,{children:["No segments found matching “",h,"”"]})})]})})})},n4e=()=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(d0,{icon:s(TD,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:e,description:t,id:n}}})=>s(Ya,{title:e,to:`/segments/edit/${n}`,subtitle:t})},{Header:"Used in",width:"60%",Cell:({row:{original:e}})=>s(dB,{original:e})},{Header:"Project",accessor:"project",Cell:({value:e})=>s(V,{condition:!!e,show:s(Ya,{title:e,to:`/projects/${e}`}),elseShow:s(jn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:vh,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(e4e,{segment:e})},{accessor:"description"}],r4e=e=>fetch(e).then(fn("Feature toggle archive")).then(t=>t.json()),PB=e=>{const{data:t,error:n,mutate:r,isLoading:o}=An(wt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),r4e,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},o4e=({onRevive:e,onDelete:t,project:n})=>x(Tl,{children:[s(Kr,{onClick:e,projectId:n,permission:gT,tooltipProps:{title:"Revive feature toggle"},"data-testid":"revive-feature-toggle-button",children:s(ID,{})}),s(Kr,{permission:p9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(vo,{})})]}),i4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},a4e=({value:e})=>{const{locationSettings:t}=ha(),n=on();return e?s(jn,{children:s(yt,{title:`Archived on: ${kc(e,t.locale)}`,arrow:!0,children:s(re,{noWrap:!0,variant:"body2","data-loading":!0,children:s(Ac,{date:new Date(e),title:"",live:!1})})})}):s(jn,{children:s(re,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},s4e=S("p")(({theme:e})=>({marginTop:e.spacing(3)})),l4e=S(cr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),c4e="I want to delete",IB=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=g.useState(""),{setToastData:l,setToastApiError:c}=Ot(),{deleteFeatures:u}=VT(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(f){c(vt(f))}finally{p()}},p=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return x(Zn,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:c4e!==i,formId:h,children:[x(Lt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),x(s4e,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",s("strong",{children:"I want to delete"})]}),s("form",{id:h,children:s(l4e,{autoFocus:!0,onChange:f=>{a(f.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},u4e=S(ye)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),d4e=({onChange:e,checked:t,title:n})=>s(u4e,{"data-testid":Pse,children:s(ts,{onChange:e,title:n,checked:t})}),p4e=S("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),f4e=S(ye)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),h4e=S(Sr)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),g4e=S("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),m4e=S(re)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),y4e=({count:e,children:t})=>e===0?null:s(p4e,{"data-testid":Rse,children:s(f4e,{children:x(h4e,{elevation:4,children:[x(m4e,{children:[s(g4e,{"data-testid":_se,children:e})," selected"]}),t]})})}),gO=S("p")(({theme:e})=>({marginTop:e.spacing(2)})),OB=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:a}=Ot(),{reviveFeatures:l}=VT(),c=hg("disableEnvsOnRevive"),u=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",title:"And we're back!",text:"The feature toggles have been revived."})}catch(f){a(vt(f))}finally{d()}},d=()=>{r(!1)},p=`Revive feature toggle${e.length>1?"s":""}?`,h=`Revive feature toggle${e.length>1?"s":""}`;return x(Zn,{title:p,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:u,onClose:d,children:[s(V,{condition:!!c,show:s(Lt,{severity:"info",children:"Revived feature toggles will be automatically disabled in all environments"})}),s(V,{condition:e.length>1,show:x(le,{children:[s(gO,{children:"You are about to revive feature toggles:"}),s("ul",{children:e.map(f=>s("li",{children:f},`revive-${f}`))})]}),elseShow:x(gO,{children:["You are about to revive feature toggle:"," ",e[0]]})})]})},v4e=({selectedIds:e,projectId:t,onReviveConfirm:n})=>{const{refetchArchived:r}=PB(t),[o,i]=g.useState(!1),[a,l]=g.useState(!1),{trackEvent:c}=Bn(),u=async()=>{l(!0)},d=async()=>{i(!0)};return x(le,{children:[s(Tu,{projectId:t,permission:gT,children:({hasAccess:p})=>s(Ve,{disabled:!p,startIcon:s(ID,{}),variant:"outlined",size:"small",onClick:u,"date-testid":"batch_revive",children:"Revive"})}),s(Tu,{projectId:t,permission:p9,children:({hasAccess:p})=>s(Ve,{disabled:!p,startIcon:s(vo,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),s(IB,{deletedFeatures:e,projectId:t,open:o,setOpen:i,refetch:()=>{r(),c("batch_operations",{props:{eventType:"features deleted"}})}}),s(OB,{revivedFeatures:e,projectId:t,open:a,setOpen:l,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features revived"}})}})]})},b4e=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=ar(ca.breakpoints.down("md")),c=ar(ca.breakpoints.down("lg"));Ot();const[u,d]=g.useState(!1),[p,h]=g.useState(),[f,m]=g.useState(!1),[y,b]=g.useState(),[v,w]=jh();i4e();const[C,T]=g.useState(v.get("search")||""),{uiConfig:A}=xt(),k=!!A.flags.lastSeenByEnvironment,_=g.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>s(ts,{"data-testid":"select_all_rows",...R()}),Cell:({row:R})=>{var N;return s(d4e,{...(N=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:N.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:R,row:{original:N}})=>k?s(O9,{feature:N}):s(r9,{value:R}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:l9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:R,row:{original:N}})=>s(fl,{value:R,subtitle:N.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:vh,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:a4e,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:R})=>s(Ya,{title:R,to:`/projects/${R}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:R}})=>s(o4e,{project:R.project,onRevive:()=>{b(R),m(!0)},onDelete:()=>{h(R),d(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a,k]),{data:P,getSearchText:I,getSearchContext:O}=ag(_,C,e),$=g.useMemo(()=>t?$9:P,[P,t]),[F]=g.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),M=g.useCallback(R=>R.name,[]),{headerGroups:B,rows:q,state:{sortBy:Y,selectedRowIds:ne},prepareRow:H,setHiddenColumns:j,toggleAllRowsSelected:W}=nn.useTable({columns:_,data:$,initialState:F,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:M},nn.useFlexLayout,nn.useSortBy,nn.useRowSelect);return Dd([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],j,_),g.useEffect(()=>{if(t)return;const R={};R.sort=Y[0].id,Y[0].desc&&(R.order="desc"),C&&(R.search=C),w(R,{replace:!0}),o({id:Y[0].id,desc:Y[0].desc||!1})},[t,Y,C]),x(le,{children:[x(er,{isLoading:t,header:s(kn,{titleElement:`${i} (${q.length<$.length?`${q.length} of ${$.length}`:$.length})`,actions:s(Ro,{initialValue:C,onChange:T,hasFilters:!0,getSearchContext:O})}),children:[s(ns,{value:I(C),children:s(D1,{rows:q,headerGroups:B,prepareRow:H})}),s(V,{condition:q.length===0,show:()=>s(V,{condition:(C==null?void 0:C.length)>0,show:x(Fr,{children:["No feature toggles found matching “",C,"”"]}),elseShow:s(Fr,{children:"None of the feature toggles were archived yet."})})}),s(IB,{deletedFeatures:[p==null?void 0:p.name],projectId:a??(p==null?void 0:p.project),open:u,setOpen:d,refetch:n}),s(OB,{revivedFeatures:[y==null?void 0:y.name],projectId:a??(y==null?void 0:y.project),open:f,setOpen:m,refetch:n})]}),s(V,{condition:!!a,show:s(y4e,{count:Object.keys(ne).length,children:s(v4e,{selectedIds:Object.keys(ne),projectId:a,onReviveConfirm:()=>W(!1)})})})]})},S4e={id:"createdAt"},{value:w4e,setValue:x4e}=rs("FeaturesArchiveTable:v1",S4e),C4e=()=>{c9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=PB();return s(b4e,{title:"Archive",archivedFeatures:e,loading:t,storedParams:w4e,setStoredParams:x4e,refetch:n})},E4e=g.lazy(()=>Yd(()=>import("./AdvancedPlayground-83369892.js"),[])),T4e=S(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),k4e=({label:e,selected:t,onClick:n,icon:r})=>x(T4e,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),A4e=S("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),R4e=S("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),_4e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),P4e=({tabs:e,value:t,onChange:n,children:r})=>x(A4e,{children:[s(_4e,{children:e.filter(o=>!o.hidden).map(o=>s(k4e,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),s(R4e,{children:r})]}),$B=(e,t={})=>{const n=async()=>{const u=wt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(fn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=H8({},r,n,t),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},I4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(a.caller,a.id)},errors:n,loading:r}},O4e=S("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),$4e=()=>{const{config:e,loading:t}=$B("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[h,f]=g.useState(""),[m,y]=g.useState(""),[b,v]=g.useState(""),{changePassword:w}=I4e(),C=async T=>{if(T.preventDefault(),h===m){if(!a)u(FM);else{r(!0),u(void 0),p(void 0);try{await w({password:h,confirmPassword:m,oldPassword:b}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(A){const k=vt(A);A instanceof rT?p(k):u(k),i(k)}}r(!1)}};return t?null:s(er,{isLoading:n,header:"Change password",children:s(V,{condition:e.disabled,show:s(Lt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:x(O4e,{children:[s(zM,{password:h,callback:l,"data-loading":!0}),s(gc,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:T=>v(T.target.value)}),s(gc,{"data-loading":!0,label:"Password",name:"password",value:h,error:!!c,helperText:c,autoComplete:"new-password",onChange:T=>f(T.target.value)}),s(gc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:T=>y(T.target.value)}),s(UM,{"data-loading":!0,started:!!(h&&m),matchingPasswords:h===m}),s(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:C,children:"Save"})]})})})},N4e="environment",L4e="project",NB="root",LB="project",D4e="root-custom",M4e="custom",B4e=[NB,LB],xje=[NB,D4e],F4e=[LB,M4e],z4e=10,zk=()=>{const{data:e,error:t,mutate:n}=An(wt("api/admin/user/tokens"),j4e);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},j4e=e=>fetch(e).then(fn("Personal API Tokens")).then(t=>t.json()),DB=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{createPersonalAPIToken:async a=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(a)});return(await e(l.caller,l.id)).json()},deletePersonalAPIToken:async a=>{const l=t(`api/admin/user/tokens/${a}`,{method:"DELETE"});await e(l.caller,l.id)},errors:n,loading:r}},U4e=e=>{const t=new Date(e);return yh(t,"yyyy-MM-dd")},W4e=e=>{const t=new Date(e);return`${yh(t,"yyyy-MM-dd")}T${yh(t,"HH:mm")}`},H4e=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?W4e:U4e;return s(vn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const h=XM(p.target.value);l(h??a)},FormHelperTextProps:{"data-testid":HL},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},mO=S("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),V4e=S(cr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),G4e=S("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),q4e=S(Z1)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),K4e=S(H4e)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Y4e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var MB=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(MB||{});const BB=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],hC=e=>{const t=new Date,n=BB.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},X4e=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=ha(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(v=>({...v,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(hC(r))},[r]);const h=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},f=r==="custom",m=i.getFullYear()>new Date().getFullYear()+100;return x(le,{children:[s(mO,{children:"Describe what this token will be used for"}),s(V4e,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>h(y.target.value),required:!0}),s(mO,{children:"Token expiration date"}),x(G4e,{custom:f,children:[s(q4e,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:BB}),s(V,{condition:f,show:()=>s(K4e,{label:"Date",value:i,onChange:y=>{d("expiresAt"),y<new Date&&p("expiresAt","Invalid date, must be in the future"),a(y)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s(V,{condition:m,show:x(re,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>x(re,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:kc(i,u.locale)})]})})})]}),s(V,{condition:m,show:s(Y4e,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},J4e=S("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Q4e=S("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Z4e=S(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),_m=MB["30DAYS"],e$e=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=zk(),{createPersonalAPIToken:i,loading:a}=DB(),{setToastApiError:l}=Ot(),{uiConfig:c}=xt(),[u,d]=g.useState(""),[p,h]=g.useState(_m),[f,m]=g.useState(hC(_m)),[y,b]=g.useState({});g.useEffect(()=>{d(""),h(_m),m(hC(_m)),b({})},[e]);const v=()=>({description:u,expiresAt:f}),w=async _=>{_.preventDefault();try{const P=await i(v());n(P),o(),t(!1)}catch(P){l(vt(P))}},C=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
376
+ --data-raw '${JSON.stringify(B(),void 0,2)}'`,H=J=>J.length,j=J=>!(o!=null&&o.some(se=>se.name===J)),W=H(f)&&j(f)&&C.length,R=J=>{$("name"),j(J)||F("name","An environment with that name already exists."),m(J)},N=u.map(J=>({value:J.id,label:J.name}));return s(mg,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s(Nr,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:ne,children:x(dOe,{onSubmit:Y,children:[x("div",{children:[s(uu,{children:"What is your new environment name? (Can't be changed later)"}),s(pOe,{autoFocus:!0,label:"Environment name",error:!!I.name,errorText:I.name,value:f,onChange:J=>R(J.target.value),required:!0}),s(uu,{children:"What type of environment do you want to create?"}),s(YM,{onChange:J=>b(J.currentTarget.value),value:y}),x(uu,{children:["Select which projects you want to clone the environment configuration in?",s(Rs,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),s(aOe,{projects:v,setProjects:w}),s(uu,{children:"Keep the users permission for this environment?"}),s(YS,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),s(Gr,{label:A?"Yes":"No",control:s(pa,{onChange:J=>k(J.target.checked),checked:A})}),x(fOe,{children:[s(uu,{children:"API Token"}),x(YS,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s($r,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s($s,{children:x(EE,{value:_,onChange:J=>P(J.target.value),name:"api-token-generation",children:[s(Gr,{value:"later",control:s(dc,{}),label:"I want to generate an API token later"}),s(Gr,{value:"now",control:s(dc,{}),label:"Generate an API token now"})]})}),x(hOe,{children:[s(YS,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),s(V,{condition:_==="now",show:x(le,{children:[s(uu,{children:"Which projects do you want this token to give access to?"}),s(cOe,{options:N,defaultValue:C,onChange:T,error:I.projects,onFocus:()=>$("projects")})]})})]})]})]}),x(gOe,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!W,children:"Clone environment"}),s(mOe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var Bk={},vOe=Sn;Object.defineProperty(Bk,"__esModule",{value:!0});var Fk=Bk.default=void 0,bOe=vOe(wn()),SOe=xn,wOe=(0,bOe.default)((0,SOe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");Fk=Bk.default=wOe;const AB=({token:e})=>{const{setToastData:t}=Ot();return x(ye,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s(yt,{title:"Copy token",arrow:!0,children:s(Ft,{onClick:()=>{G9(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:s(Fk,{})})})]})},xOe=({open:e,setOpen:t,token:n})=>x(Zn,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s(re,{variant:"body1",children:"Your new token has been created successfully."}),x(re,{variant:"body1",children:['You can also find it as "',s("strong",{children:n==null?void 0:n.username}),'" in the'," ",s(qt,{to:"/admin/api",children:"API access page"}),"."]}),s(AB,{token:(n==null?void 0:n.secret)||""})]}),COe=S(ye)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),EOe=S(Ft)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),TOe=S(ED,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),RB=({environment:e})=>x(COe,{children:[s(EOe,{size:"large",disableRipple:!0,className:"drag-icon",children:s(kce,{titleAccess:"Drag to reorder"})}),s(TOe,{deprecated:!e.enabled})]}),kOe=S(da)(({theme:e})=>({marginTop:e.spacing(3)})),AOe=S("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),_B=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s(RB,{environment:c})},{Header:"Name",accessor:"name",Cell:jn},{Header:"Type",accessor:"type",Cell:jn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>x(jn,{children:[u,s(V,{condition:!!t,show:s(AOe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=nn.useTable({columns:n,data:[e],disableSortBy:!0});return x(kOe,{...r(),rowHeight:"compact",children:[s(ua,{headerGroups:i}),s(la,{...o(),children:a.map(c=>(l(c),s(ji,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>s(Wi,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},ROe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return x(Zn,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s(V,{condition:o,show:s(Lt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s(Lt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s(_B,{environment:e})]})},_Oe=S("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),POe=S(cr)(()=>({width:"100%"})),IOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=g.useState("");return g.useEffect(()=>{i("")},[t]),x(Zn,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[x(Lt,{severity:"error",children:[s("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),s(_B,{environment:e,warnEnabledToggles:!0}),x(_Oe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s("strong",{children:e.name})]}),s(POe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},OOe=({environment:e})=>{const t=pt(),{setToastApiError:n,setToastData:r}=Ot(),{environments:o,refetchEnvironments:i}=Md(),{refetch:a}=GT(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=Wd(),[d,p]=g.useState(!1),[h,f]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(!1),[w,C]=g.useState();return x(Tl,{children:[s(ZIe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>f(!0),onClone:()=>{o.length<Qy?y(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Qy}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),s(IOe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await l(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(k){n(vt(k))}finally{p(!1),await i()}}}),s(ROe,{environment:e,open:h,setOpen:f,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(k){n(vt(k))}finally{f(!1),await i()}}}),s(yOe,{environment:e,open:m,setOpen:y,newToken:k=>{C(k),v(!0)}}),s(xOe,{open:b,setOpen:v,token:w})]})},$Oe=S(ye)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),NOe=S("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),LOe=S("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),fl=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Nl();return x($Oe,{children:[x(NOe,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[s(Ka,{search:r,children:e}),n]}),s(V,{condition:!!t,show:()=>s(LOe,{"data-loading":!0,children:s(Ka,{search:r,children:t})})})]})},DOe=S(Lt)(({theme:e})=>({marginBottom:e.spacing(4)})),MOe=()=>{const{changeSortOrder:e}=Wd(),{setToastApiError:t}=Ot(),{environments:n,mutateEnvironments:r}=Md(),o=g.useCallback(async(b,v,w=!1)=>{const C=[...n],T=C[b];if(C.splice(b,1),C.splice(v,0,T),await r(C),w)try{await e(zxe(C))}catch(A){t(vt(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=nn.useTable({columns:BOe,data:n,disableSortBy:!0},nn.useGlobalFilter),f=x(le,{children:[s(Ro,{initialValue:d,onChange:p}),s(kn.Divider,{}),s(UIe,{})]}),m=c.length,y=s(kn,{title:`Environments (${m})`,actions:f});return x(er,{header:y,children:[s(DOe,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),s(ns,{value:d,children:x(da,{...i(),rowHeight:"compact",children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(b=>(u(b),s(GIe,{row:b,moveListItem:o},b.original.name)))})]})}),s(V,{condition:c.length===0,show:s(V,{condition:(d==null?void 0:d.length)>0,show:x(Fr,{children:["No environments found matching “",d,"”"]}),elseShow:s(Fr,{children:"No environments available. Get started by adding one."})})})]})},BOe=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s(RB,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s(YIe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:fl},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:jn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:jn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>s(OOe,{environment:e}),disableGlobalFilter:!0}],FOe=()=>{const e=Xa("projectId"),t=pt();return s(Io,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[j1,yT],projectId:e,"data-testid":ese,children:"New segment"})},zOe=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),jOe=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),UOe=S("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),WOe=S(qt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),HOe=()=>{const{hasAccess:e}=g.useContext(Po);return x(zOe,{children:[s(jOe,{children:"No segments yet!"}),s(UOe,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s(V,{condition:e(j1),show:s(WOe,{to:"/segments/create",children:"Create your first segment"})})]})},VOe=S(cr)(({theme:e})=>({marginTop:e.spacing(2)})),GOe=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=g.useState(""),a=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return x(Zn,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:l,formId:c,children:[x("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:c,children:s(VOe,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":dse})})]})},qOe=S("ul")({marginBottom:0}),KOe=S(qt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),YOe=({segment:e,open:t,onClose:n,strategies:r})=>x(Zn,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[x("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(qOe,{children:r==null?void 0:r.map(o=>s("li",{children:x(KOe,{to:Ak(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",XOe(o)]})},o.id))})]}),XOe=e=>e.strategyName?`(${As(e.strategyName)})`:"",JOe=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=SB(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(V,{condition:a,show:s(GOe,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(YOe,{segment:e,open:t,onClose:n,strategies:o})})},QOe=({segment:e})=>{const t=Xa("projectId"),{refetchSegments:n}=Ml(),{deleteSegment:r}=Nk(),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(vt(u))}finally{l(!1)}};return x(le,{children:[s(Kr,{onClick:()=>l(!0),permission:[Vfe,yT],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${use}_${e.name}`,children:s(vo,{"data-loading":!0})}),s(V,{condition:a,show:()=>s(JOe,{segment:e,open:a,onClose:()=>l(!1),onRemove:c})})]})},ZOe=({segment:e})=>{const t=Xa("projectId"),n=pt();return s(Kr,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[mT,yT],projectId:t,tooltipProps:{title:"Edit segment"},children:s(Ui,{"data-loading":!0})})},e4e=({segment:e})=>x(Tl,{children:[s(ZOe,{segment:e}),s(QOe,{segment:e})]}),t4e=()=>{const e=Xa("projectId"),{segments:t,loading:n}=Ml(),r=ar(ca.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=g.useMemo(()=>t?e?t.filter(({project:y})=>y===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=g.useMemo(()=>n4e(),[]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:h},setGlobalFilter:f,setHiddenColumns:m}=nn.useTable({initialState:o,columns:a,data:i,sortTypes:ui,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:fl}},nn.useGlobalFilter,nn.useSortBy);return Dd([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),s(er,{header:s(kn,{title:`Segments (${d.length})`,actions:x(le,{children:[s(Ro,{initialValue:h,onChange:f}),s(kn.Divider,{}),s(FOe,{})]})}),isLoading:n,children:s(V,{condition:!n&&i.length===0,show:s(Fr,{children:s(HOe,{})}),elseShow:()=>x(le,{children:[s(ns,{value:h,children:x(da,{...l(),rowHeight:"standard",children:[s(ua,{headerGroups:u}),s(la,{...c(),children:d.map(y=>(p(y),s(ji,{hover:!0,...y.getRowProps(),children:y.cells.map(b=>s(Wi,{...b.getCellProps(),children:b.render("Cell")}))})))})]})}),s(V,{condition:d.length===0&&(h==null?void 0:h.length)>0,show:x(Fr,{children:["No segments found matching “",h,"”"]})})]})})})},n4e=()=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(d0,{icon:s(TD,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:e,description:t,id:n}}})=>s(Ya,{title:e,to:`/segments/edit/${n}`,subtitle:t})},{Header:"Used in",width:"60%",Cell:({row:{original:e}})=>s(dB,{original:e})},{Header:"Project",accessor:"project",Cell:({value:e})=>s(V,{condition:!!e,show:s(Ya,{title:e,to:`/projects/${e}`}),elseShow:s(jn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:vh,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(e4e,{segment:e})},{accessor:"description"}],r4e=e=>fetch(e).then(fn("Feature toggle archive")).then(t=>t.json()),PB=e=>{const{data:t,error:n,mutate:r,isLoading:o}=An(wt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),r4e,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},o4e=({onRevive:e,onDelete:t,project:n})=>x(Tl,{children:[s(Kr,{onClick:e,projectId:n,permission:gT,tooltipProps:{title:"Revive feature toggle"},"data-testid":"revive-feature-toggle-button",children:s(ID,{})}),s(Kr,{permission:p9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(vo,{})})]}),i4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},a4e=({value:e})=>{const{locationSettings:t}=ha(),n=on();return e?s(jn,{children:s(yt,{title:`Archived on: ${kc(e,t.locale)}`,arrow:!0,children:s(re,{noWrap:!0,variant:"body2","data-loading":!0,children:s(Ac,{date:new Date(e),title:"",live:!1})})})}):s(jn,{children:s(re,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},s4e=S("p")(({theme:e})=>({marginTop:e.spacing(3)})),l4e=S(cr)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),c4e="I want to delete",IB=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=g.useState(""),{setToastData:l,setToastApiError:c}=Ot(),{deleteFeatures:u}=VT(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(f){c(vt(f))}finally{p()}},p=()=>{r(!1),a("")},h="delete-feature-toggle-confirmation-form";return x(Zn,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:c4e!==i,formId:h,children:[x(Lt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),x(s4e,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",s("strong",{children:"I want to delete"})]}),s("form",{id:h,children:s(l4e,{autoFocus:!0,onChange:f=>{a(f.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},u4e=S(ye)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),d4e=({onChange:e,checked:t,title:n})=>s(u4e,{"data-testid":Pse,children:s(ts,{onChange:e,title:n,checked:t})}),p4e=S("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),f4e=S(ye)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),h4e=S(Sr)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),g4e=S("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),m4e=S(re)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),y4e=({count:e,children:t})=>e===0?null:s(p4e,{"data-testid":Rse,children:s(f4e,{children:x(h4e,{elevation:4,children:[x(m4e,{children:[s(g4e,{"data-testid":_se,children:e})," selected"]}),t]})})}),gO=S("p")(({theme:e})=>({marginTop:e.spacing(2)})),OB=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:a}=Ot(),{reviveFeatures:l}=VT(),c=hg("disableEnvsOnRevive"),u=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",title:"And we're back!",text:"The feature toggles have been revived."})}catch(f){a(vt(f))}finally{d()}},d=()=>{r(!1)},p=`Revive feature toggle${e.length>1?"s":""}?`,h=`Revive feature toggle${e.length>1?"s":""}`;return x(Zn,{title:p,open:n,primaryButtonText:h,secondaryButtonText:"Cancel",onClick:u,onClose:d,children:[s(V,{condition:!!c,show:s(Lt,{severity:"info",children:"Revived feature toggles will be automatically disabled in all environments"})}),s(V,{condition:e.length>1,show:x(le,{children:[s(gO,{children:"You are about to revive feature toggles:"}),s("ul",{children:e.map(f=>s("li",{children:f},`revive-${f}`))})]}),elseShow:x(gO,{children:["You are about to revive feature toggle:"," ",e[0]]})})]})},v4e=({selectedIds:e,projectId:t,onReviveConfirm:n})=>{const{refetchArchived:r}=PB(t),[o,i]=g.useState(!1),[a,l]=g.useState(!1),{trackEvent:c}=Bn(),u=async()=>{l(!0)},d=async()=>{i(!0)};return x(le,{children:[s(Tu,{projectId:t,permission:gT,children:({hasAccess:p})=>s(Ve,{disabled:!p,startIcon:s(ID,{}),variant:"outlined",size:"small",onClick:u,"date-testid":"batch_revive",children:"Revive"})}),s(Tu,{projectId:t,permission:p9,children:({hasAccess:p})=>s(Ve,{disabled:!p,startIcon:s(vo,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),s(IB,{deletedFeatures:e,projectId:t,open:o,setOpen:i,refetch:()=>{r(),c("batch_operations",{props:{eventType:"features deleted"}})}}),s(OB,{revivedFeatures:e,projectId:t,open:a,setOpen:l,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features revived"}})}})]})},b4e=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=ar(ca.breakpoints.down("md")),c=ar(ca.breakpoints.down("lg"));Ot();const[u,d]=g.useState(!1),[p,h]=g.useState(),[f,m]=g.useState(!1),[y,b]=g.useState(),[v,w]=jh();i4e();const[C,T]=g.useState(v.get("search")||""),{uiConfig:A}=xt(),k=!!A.flags.lastSeenByEnvironment,_=g.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>s(ts,{"data-testid":"select_all_rows",...R()}),Cell:({row:R})=>{var N;return s(d4e,{...(N=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:N.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:R,row:{original:N}})=>k?s(O9,{feature:N}):s(r9,{value:R}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:l9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:R,row:{original:N}})=>s(fl,{value:R,subtitle:N.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:vh,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:a4e,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:R})=>s(Ya,{title:R,to:`/projects/${R}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:R}})=>s(o4e,{project:R.project,onRevive:()=>{b(R),m(!0)},onDelete:()=>{h(R),d(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a,k]),{data:P,getSearchText:I,getSearchContext:O}=ag(_,C,e),$=g.useMemo(()=>t?$9:P,[P,t]),[F]=g.useState(()=>({sortBy:[{id:v.get("sort")||r.id,desc:v.has("order")?v.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),M=g.useCallback(R=>R.name,[]),{headerGroups:B,rows:q,state:{sortBy:Y,selectedRowIds:ne},prepareRow:H,setHiddenColumns:j,toggleAllRowsSelected:W}=nn.useTable({columns:_,data:$,initialState:F,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:M},nn.useFlexLayout,nn.useSortBy,nn.useRowSelect);return Dd([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],j,_),g.useEffect(()=>{if(t)return;const R={};R.sort=Y[0].id,Y[0].desc&&(R.order="desc"),C&&(R.search=C),w(R,{replace:!0}),o({id:Y[0].id,desc:Y[0].desc||!1})},[t,Y,C]),x(le,{children:[x(er,{isLoading:t,header:s(kn,{titleElement:`${i} (${q.length<$.length?`${q.length} of ${$.length}`:$.length})`,actions:s(Ro,{initialValue:C,onChange:T,hasFilters:!0,getSearchContext:O})}),children:[s(ns,{value:I(C),children:s(D1,{rows:q,headerGroups:B,prepareRow:H})}),s(V,{condition:q.length===0,show:()=>s(V,{condition:(C==null?void 0:C.length)>0,show:x(Fr,{children:["No feature toggles found matching “",C,"”"]}),elseShow:s(Fr,{children:"None of the feature toggles were archived yet."})})}),s(IB,{deletedFeatures:[p==null?void 0:p.name],projectId:a??(p==null?void 0:p.project),open:u,setOpen:d,refetch:n}),s(OB,{revivedFeatures:[y==null?void 0:y.name],projectId:a??(y==null?void 0:y.project),open:f,setOpen:m,refetch:n})]}),s(V,{condition:!!a,show:s(y4e,{count:Object.keys(ne).length,children:s(v4e,{selectedIds:Object.keys(ne),projectId:a,onReviveConfirm:()=>W(!1)})})})]})},S4e={id:"createdAt"},{value:w4e,setValue:x4e}=rs("FeaturesArchiveTable:v1",S4e),C4e=()=>{c9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=PB();return s(b4e,{title:"Archive",archivedFeatures:e,loading:t,storedParams:w4e,setStoredParams:x4e,refetch:n})},E4e=g.lazy(()=>Yd(()=>import("./AdvancedPlayground-b7bccfbe.js"),[])),T4e=S(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),k4e=({label:e,selected:t,onClick:n,icon:r})=>x(T4e,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),A4e=S("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),R4e=S("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),_4e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),P4e=({tabs:e,value:t,onChange:n,children:r})=>x(A4e,{children:[s(_4e,{children:e.filter(o=>!o.hidden).map(o=>s(k4e,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),s(R4e,{children:r})]}),$B=(e,t={})=>{const n=async()=>{const u=wt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(fn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=H8({},r,n,t),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},I4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(a.caller,a.id)},errors:n,loading:r}},O4e=S("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),$4e=()=>{const{config:e,loading:t}=$B("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[h,f]=g.useState(""),[m,y]=g.useState(""),[b,v]=g.useState(""),{changePassword:w}=I4e(),C=async T=>{if(T.preventDefault(),h===m){if(!a)u(FM);else{r(!0),u(void 0),p(void 0);try{await w({password:h,confirmPassword:m,oldPassword:b}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(A){const k=vt(A);A instanceof rT?p(k):u(k),i(k)}}r(!1)}};return t?null:s(er,{isLoading:n,header:"Change password",children:s(V,{condition:e.disabled,show:s(Lt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:x(O4e,{children:[s(zM,{password:h,callback:l,"data-loading":!0}),s(gc,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:T=>v(T.target.value)}),s(gc,{"data-loading":!0,label:"Password",name:"password",value:h,error:!!c,helperText:c,autoComplete:"new-password",onChange:T=>f(T.target.value)}),s(gc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:T=>y(T.target.value)}),s(UM,{"data-loading":!0,started:!!(h&&m),matchingPasswords:h===m}),s(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:C,children:"Save"})]})})})},N4e="environment",L4e="project",NB="root",LB="project",D4e="root-custom",M4e="custom",B4e=[NB,LB],xje=[NB,D4e],F4e=[LB,M4e],z4e=10,zk=()=>{const{data:e,error:t,mutate:n}=An(wt("api/admin/user/tokens"),j4e);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},j4e=e=>fetch(e).then(fn("Personal API Tokens")).then(t=>t.json()),DB=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{createPersonalAPIToken:async a=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(a)});return(await e(l.caller,l.id)).json()},deletePersonalAPIToken:async a=>{const l=t(`api/admin/user/tokens/${a}`,{method:"DELETE"});await e(l.caller,l.id)},errors:n,loading:r}},U4e=e=>{const t=new Date(e);return yh(t,"yyyy-MM-dd")},W4e=e=>{const t=new Date(e);return`${yh(t,"yyyy-MM-dd")}T${yh(t,"HH:mm")}`},H4e=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?W4e:U4e;return s(vn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const h=XM(p.target.value);l(h??a)},FormHelperTextProps:{"data-testid":HL},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},mO=S("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),V4e=S(cr)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),G4e=S("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),q4e=S(Z1)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),K4e=S(H4e)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Y4e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var MB=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(MB||{});const BB=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],hC=e=>{const t=new Date,n=BB.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},X4e=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=ha(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(v=>({...v,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(hC(r))},[r]);const h=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},f=r==="custom",m=i.getFullYear()>new Date().getFullYear()+100;return x(le,{children:[s(mO,{children:"Describe what this token will be used for"}),s(V4e,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>h(y.target.value),required:!0}),s(mO,{children:"Token expiration date"}),x(G4e,{custom:f,children:[s(q4e,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:BB}),s(V,{condition:f,show:()=>s(K4e,{label:"Date",value:i,onChange:y=>{d("expiresAt"),y<new Date&&p("expiresAt","Invalid date, must be in the future"),a(y)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s(V,{condition:m,show:x(re,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>x(re,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:kc(i,u.locale)})]})})})]}),s(V,{condition:m,show:s(Y4e,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},J4e=S("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Q4e=S("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Z4e=S(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),_m=MB["30DAYS"],e$e=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=zk(),{createPersonalAPIToken:i,loading:a}=DB(),{setToastApiError:l}=Ot(),{uiConfig:c}=xt(),[u,d]=g.useState(""),[p,h]=g.useState(_m),[f,m]=g.useState(hC(_m)),[y,b]=g.useState({});g.useEffect(()=>{d(""),h(_m),m(hC(_m)),b({})},[e]);const v=()=>({description:u,expiresAt:f}),w=async _=>{_.preventDefault();try{const P=await i(v());n(P),o(),t(!1)}catch(P){l(vt(P))}},C=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
377
377
  --header 'Authorization: INSERT_API_KEY' \\
378
378
  --header 'Content-Type: application/json' \\
379
379
  --data-raw '${JSON.stringify(v(),void 0,2)}'`,T=_=>_.length,A=_=>!(r!=null&&r.some(P=>P.description===_)),k=T(u)&&A(u)&&f>new Date;return s(mg,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:s(Nr,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
380
380
  yourself. A personal API token has the same access privileges as
381
- your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:C,children:x(J4e,{onSubmit:w,children:[s("div",{children:s(X4e,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:h,expiresAt:f,setExpiresAt:m,errors:y,setErrors:b})}),x(Q4e,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!k,children:"Create token"}),s(Z4e,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},t$e=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=zk(),{deletePersonalAPIToken:o}=DB(),{setToastData:i,setToastApiError:a}=Ot();return s(Zn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(vt(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:x(re,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},n$e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),r$e=({open:e,setOpen:t,token:n})=>x(Zn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(n$e,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(re,{variant:"body1",children:"Your token:"}),s(AB,{token:(n==null?void 0:n.secret)||""})]}),FB=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=kc})=>{const{locationSettings:i}=ha();if(!e)return s(jn,{children:n});const a=o(e,i.locale);return s(jn,{children:s(yt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:s(re,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(Ac,{date:new Date(e),live:t,title:""})})})})},o$e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),i$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),a$e=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),s$e=S(re)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),l$e=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),c$e={id:"createdAt"},{value:yO,setValue:u$e}=rs("PersonalAPITokensTable:v1",c$e),d$e=()=>{const e=on(),t=ar(e.breakpoints.down("md")),n=ar(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=zk(),[i,a]=jh(),[l]=g.useState(()=>({sortBy:[{id:i.get("sort")||yO.id,desc:i.has("order")?i.get("order")==="desc":yO.desc}],globalFilter:i.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[h,f]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(),[w,C]=g.useState(),T=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:fl,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:B})=>new Date(B).getFullYear()>new Date().getFullYear()+100?s(jn,{children:"Never"}):s(vh,{value:B}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:vh,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:FB,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>s(Tl,{children:s(yt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(Ft,{onClick:()=>{C(B),y(!0)},children:s(vo,{})})})})}),maxWidth:100,disableSortBy:!0}],[C,y]),{data:A,getSearchText:k,getSearchContext:_}=ag(T,c,r),P=g.useMemo(()=>(A==null?void 0:A.length)===0&&o?l$e:A,[A,o]),{headerGroups:I,rows:O,prepareRow:$,state:{sortBy:F},setHiddenColumns:M}=nn.useTable({columns:T,data:P,initialState:l,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy,nn.useFlexLayout);return Dd([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],M,T),g.useEffect(()=>{const B={};B.sort=F[0].id,F[0].desc&&(B.order="desc"),c&&(B.search=c),a(B,{replace:!0}),u$e({id:F[0].id,desc:F[0].desc||!1})},[F,c,a]),x(er,{isLoading:o,header:s(kn,{title:`Personal API tokens (${O.length<P.length?`${O.length} of ${P.length}`:P.length})`,actions:x(le,{children:[s(V,{condition:!t,show:x(le,{children:[s(Ro,{initialValue:c,onChange:u,getSearchContext:_}),s(kn.Divider,{})]})}),s(Ve,{variant:"contained",color:"primary",disabled:r.length>=z4e,onClick:()=>p(!0),children:"New token"})]}),children:s(V,{condition:t,show:s(Ro,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:_})})}),children:[s(o$e,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(ns,{value:k(c),children:s(D1,{rows:O,headerGroups:I,prepareRow:$})}),s(V,{condition:O.length===0,show:s(V,{condition:(c==null?void 0:c.length)>0,show:x(Fr,{children:["No tokens found matching “",c,"”"]}),elseShow:x(i$e,{children:[s(a$e,{children:"You have no personal API tokens yet."}),s(s$e,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(e$e,{open:d,setOpen:p,newToken:B=>{v(B),f(!0)}}),s(r$e,{open:h,setOpen:f,token:b}),s(t$e,{open:m,setOpen:y,token:w})]})},p$e=()=>{const{data:e,error:t,mutate:n}=An(wt("api/admin/user/profile"),f$e);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},f$e=e=>fetch(e).then(fn("Profile")).then(t=>t.json());var jk={},h$e=Sn;Object.defineProperty(jk,"__esModule",{value:!0});var zB=jk.default=void 0,g$e=h$e(wn()),m$e=xn,y$e=(0,g$e.default)((0,m$e.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");zB=jk.default=y$e;const jB=(e,t={})=>{const{isEnterprise:n}=xt(),{data:r,error:o,mutate:i}=Uc(!!e&&n(),void 0,wt(`api/admin/roles/${e}`),v$e,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},v$e=e=>fetch(e).then(fn("Role")).then(t=>t.json()),vc=e=>e.environment?`${e.id}-${e.environment}`:`${e.id}`,Cje=e=>e.reduce((t,n)=>(t[vc(n)]=n,t),{}),Eje=(e,t)=>{const n=gg(e);return n[vc(t)]?delete n[vc(t)]:n[vc(t)]={...t},n},Tje=(e,t)=>{const n=gg(e);return t.every(o=>n[vc(o)])?t.forEach(o=>{delete n[vc(o)]}):t.forEach(o=>{n[vc(o)]={...o}}),n},b$e=e=>e.filter(({name:n})=>n!=="ADMIN").reduce((n,r)=>{var a;const o=((a=r3e.find(l=>l.permissions.includes(r.name)))==null?void 0:a.label)||"Other",i=n.find(({label:l})=>l===o);return i?i.permissions.push(r):n.push({label:o,type:"root",permissions:[r]}),n},[]).sort(w$e),S$e=e=>{const t=e.filter(({type:o})=>o===L4e),n=e.filter(({type:o})=>o===N4e),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r},kje=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],w$e=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),x$e=S("div",{shouldForwardProp:e=>e!=="tooltip"})(({theme:e,tooltip:t})=>({width:"100%",maxWidth:e.spacing(50),padding:t?e.spacing(1):e.spacing(3),backgroundColor:t?e.palette.background.paper:e.palette.neutral.light,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:t?0:e.shape.borderRadiusMedium})),C$e=S("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),E$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),T$e=S("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),k$e=S(Vce)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),A$e=S("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),R$e=S("p")(({theme:e})=>({marginTop:e.spacing(.5)})),_$e=S("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),P$e=({roleId:e,tooltip:t,...n})=>{const{role:r}=jB(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=F4e.includes(l)?S$e(a):b$e(a);return x(x$e,{tooltip:t,...n,children:[x(T$e,{children:[s(k$e,{color:"disabled"}),o]}),s(R$e,{children:i}),s(V,{condition:!B4e.includes(r.type),show:()=>x(le,{children:[s(C$e,{children:"Role permissions:"}),s(E$e,{children:u.map(({label:d,permissions:p})=>x("div",{children:[s(A$e,{children:d}),s(_$e,{children:p.map(h=>s("li",{children:h.displayName},h.id))})]},d))})]})})]})},I$e=({roleId:e,children:t})=>{const{role:n}=jB(e.toString());return n?s(Ld,{title:s(P$e,{roleId:e,tooltip:!0}),arrow:!0,children:s(jt,{color:"success",icon:s(s5,{}),sx:{cursor:"pointer"},children:n.name})}):t?s(jt,{color:"success",icon:s(s5,{}),children:t}):null},O$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),$$e=S("div")(()=>({flexGrow:1})),N$e=S(re)(({theme:e})=>({fontSize:e.spacing(3.75)})),L$e=S(UE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),vO=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),D$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),M$e=S(jt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),B$e=S("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),F$e=S($s)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),z$e=S(Qh)(({theme:e})=>({backgroundColor:e.palette.background.paper})),j$e=({user:e})=>{const{profile:t}=p$e(),n=pt(),{locationSettings:r,setLocationSettings:o}=ha(),[i,a]=g.useState(),[l,c]=g.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);g.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return x(le,{children:[x(O$e,{children:[s(L$e,{user:e}),x($$e,{children:[s(N$e,{children:e.name||e.username}),s(re,{variant:"body1",children:e.email})]})]}),x(er,{children:[s(vO,{children:"Access"}),x(D$e,{children:[s(ye,{sx:{width:"50%"},children:s(V,{condition:!!(t!=null&&t.rootRole),show:()=>x(le,{children:[s(re,{variant:"body2",children:"Your root role"}),s(I$e,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),x(ye,{children:[s(re,{variant:"body2",children:"Projects"}),s(V,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>s(yt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(M$e,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(zB,{}),children:d})},d)),elseShow:s(yt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(jt,{children:"No projects"})})})]})]}),s(B$e,{}),s(vO,{children:"Settings"}),s(re,{variant:"body2",children:"This is the format used across the system for time and date"}),x(F$e,{variant:"outlined",size:"small",children:[s(z$e,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(Zh,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},U$e=()=>{const{user:e}=gi(),t=bo(),n=pt(),{config:r,loading:o}=$B("simple"),{uiConfig:i}=xt(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:f})=>f&&p.includes(f))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:x(P4e,{tabs:a,value:u,onChange:l,children:[s(V,{condition:u==="profile",show:s(j$e,{user:e})}),s(V,{condition:u==="password",show:s($4e,{})}),s(V,{condition:u==="pat",show:s(d$e,{})})]})},W$e=g.lazy(()=>Yd(()=>import("./CreateProject-be345ba6.js"),[])),H$e=g.lazy(()=>Yd(()=>import("./FeatureViewLazyExport-397aadc2.js"),[])),V$e=g.lazy(()=>Yd(()=>import("./LazyAdminExport-4e6e4e1f.js"),[])),G$e=g.lazy(()=>Yd(()=>import("./LazyProjectExport-e3f9f7ab.js"),[])),q$e=()=>{const{isEnterprise:e}=xt(),{data:t,error:n,mutate:r}=Uc(e(),{events:[]},wt("api/admin/logins"),K$e);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},K$e=e=>fetch(e).then(fn("Login History")).then(t=>t.json()),bO=S(ye)(()=>({display:"flex",justifyContent:"center"})),Y$e=({row:e,value:t})=>{const{searchQuery:n}=Nl();return t?s(bO,{children:s(jt,{color:"success",children:"True"})}):s(bO,{children:s(Ld,{arrow:!0,title:s(Ka,{search:n,children:e.original.failure_reason}),children:s(jt,{color:"error",children:"False"})})})},X$e=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=qn({propagateErrors:!0});return{downloadCSV:async()=>{const a=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(a.caller,a.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}},J$e={id:"created_at"},{value:SO,setValue:Q$e}=rs("LoginHistoryTable:v1",J$e),Z$e={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},eNe=()=>{const{events:e,loading:t}=q$e(),{downloadCSV:n}=X$e(),[r,o]=jh(),[i]=g.useState(()=>({sortBy:[{id:r.get("sort")||SO.id,desc:r.has("order")?r.get("order")==="desc":SO.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(i.globalFilter),c=ar(ca.breakpoints.down("sm")),u=ar(ca.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:C})=>s(FB,{value:C,dateFormat:B1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:fl,searchable:!0},{Header:"Authentication",accessor:C=>Z$e[C.auth_type]||C.auth_type,width:150,maxWidth:150,Cell:fl,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:fl,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Y$e,filterName:"success",filterParsing:C=>C.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:h,getSearchContext:f}=ag(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:v},setHiddenColumns:w}=nn.useTable({columns:d,data:p,initialState:i,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:jn}},nn.useSortBy,nn.useFlexLayout);return Dd([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),g.useEffect(()=>{const C={};C.sort=v[0].id,v[0].desc&&(C.order="desc"),a&&(C.search=a),o(C,{replace:!0}),Q$e({id:v[0].id,desc:v[0].desc||!1})},[v,a,o]),x(er,{isLoading:t,header:s(kn,{title:`Login history (${y.length})`,actions:x(le,{children:[s(V,{condition:!u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:f})}),s(V,{condition:y.length>0,show:x(le,{children:[s(V,{condition:!u,show:s(kn.Divider,{})}),s(yt,{title:"Download login history",arrow:!0,children:s(Ft,{onClick:n,children:s(Tce,{})})})]})})]}),children:s(V,{condition:u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:f})})}),children:[s(ns,{value:h(a),children:s(D1,{rows:y,headerGroups:m,prepareRow:b})}),s(V,{condition:y.length===0,show:s(V,{condition:(a==null?void 0:a.length)>0,show:x(Fr,{children:["No login events found matching “",a,"”"]}),elseShow:s(Fr,{children:"No login events available."})})})]})},tNe=()=>{const{isEnterprise:e}=xt();return e()?s("div",{children:s(hB,{permissions:mi,children:s(eNe,{})})}):s(qM,{feature:"login-history",page:!0})},nNe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},rNe=S("div")(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:e.spacing(4),position:"fixed",inset:0,backgroundColor:e.palette.background.paper,width:"100%"})),oNe=S(qL)(({theme:e})=>({height:"80px"})),iNe=S("div")(({theme:e})=>({display:"flex",position:"relative"})),aNe=S("div")(({theme:e})=>({marginTop:e.spacing(4)})),sNe=S(Ve)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),Uk=({children:e})=>{const t=pt();return x(rNe,{children:[x("div",{children:[s(oNe,{}),s(iNe,{children:s(re,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),x(aNe,{children:[s(Ve,{variant:"contained",color:"primary",onClick:()=>{t(Oo)},children:"Go back"}),s(sNe,{onClick:()=>{t("/")},children:"Go home"})]})]}),e]})},lNe=S(ye)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),cNe=S(ye)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),uNe=({featureType:e,loading:t})=>{const n=pt(),{uiConfig:r}=xt(),{refetch:o}=og(),{updateFeatureTypeLifetime:i,loading:a}=nNe(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:h}=Ot(),f=Bn(),m=C=>{const T=parseInt(kl(C.target.value),10);c(T),T===0&&d(!0)},y=C=>{d(C.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),v=async C=>{C.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature toggle type loaded");const T=u?0:l;await i(e.id,T),o(),p({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),f.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:T}})}catch(T){h(vt(T))}},w=g.useCallback(()=>[`curl --location --request PUT '${r.unleashUrl}/api/admin/feature-types/${e==null?void 0:e.id}/lifetime`,"--header 'Authorization: INSERT_API_KEY'","--header 'Content-Type: application/json'",`--data-raw '{
381
+ your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:C,children:x(J4e,{onSubmit:w,children:[s("div",{children:s(X4e,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:h,expiresAt:f,setExpiresAt:m,errors:y,setErrors:b})}),x(Q4e,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!k,children:"Create token"}),s(Z4e,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},t$e=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=zk(),{deletePersonalAPIToken:o}=DB(),{setToastData:i,setToastApiError:a}=Ot();return s(Zn,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(vt(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:x(re,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},n$e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),r$e=({open:e,setOpen:t,token:n})=>x(Zn,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(n$e,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(re,{variant:"body1",children:"Your token:"}),s(AB,{token:(n==null?void 0:n.secret)||""})]}),FB=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=kc})=>{const{locationSettings:i}=ha();if(!e)return s(jn,{children:n});const a=o(e,i.locale);return s(jn,{children:s(yt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:s(re,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(Ac,{date:new Date(e),live:t,title:""})})})})},o$e=S(Lt)(({theme:e})=>({marginBottom:e.spacing(3)})),i$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),a$e=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),s$e=S(re)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),l$e=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),c$e={id:"createdAt"},{value:yO,setValue:u$e}=rs("PersonalAPITokensTable:v1",c$e),d$e=()=>{const e=on(),t=ar(e.breakpoints.down("md")),n=ar(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=zk(),[i,a]=jh(),[l]=g.useState(()=>({sortBy:[{id:i.get("sort")||yO.id,desc:i.has("order")?i.get("order")==="desc":yO.desc}],globalFilter:i.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[h,f]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(),[w,C]=g.useState(),T=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:fl,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:B})=>new Date(B).getFullYear()>new Date().getFullYear()+100?s(jn,{children:"Never"}):s(vh,{value:B}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:vh,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:FB,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>s(Tl,{children:s(yt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(Ft,{onClick:()=>{C(B),y(!0)},children:s(vo,{})})})})}),maxWidth:100,disableSortBy:!0}],[C,y]),{data:A,getSearchText:k,getSearchContext:_}=ag(T,c,r),P=g.useMemo(()=>(A==null?void 0:A.length)===0&&o?l$e:A,[A,o]),{headerGroups:I,rows:O,prepareRow:$,state:{sortBy:F},setHiddenColumns:M}=nn.useTable({columns:T,data:P,initialState:l,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy,nn.useFlexLayout);return Dd([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],M,T),g.useEffect(()=>{const B={};B.sort=F[0].id,F[0].desc&&(B.order="desc"),c&&(B.search=c),a(B,{replace:!0}),u$e({id:F[0].id,desc:F[0].desc||!1})},[F,c,a]),x(er,{isLoading:o,header:s(kn,{title:`Personal API tokens (${O.length<P.length?`${O.length} of ${P.length}`:P.length})`,actions:x(le,{children:[s(V,{condition:!t,show:x(le,{children:[s(Ro,{initialValue:c,onChange:u,getSearchContext:_}),s(kn.Divider,{})]})}),s(Ve,{variant:"contained",color:"primary",disabled:r.length>=z4e,onClick:()=>p(!0),children:"New token"})]}),children:s(V,{condition:t,show:s(Ro,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:_})})}),children:[s(o$e,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(ns,{value:k(c),children:s(D1,{rows:O,headerGroups:I,prepareRow:$})}),s(V,{condition:O.length===0,show:s(V,{condition:(c==null?void 0:c.length)>0,show:x(Fr,{children:["No tokens found matching “",c,"”"]}),elseShow:x(i$e,{children:[s(a$e,{children:"You have no personal API tokens yet."}),s(s$e,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(e$e,{open:d,setOpen:p,newToken:B=>{v(B),f(!0)}}),s(r$e,{open:h,setOpen:f,token:b}),s(t$e,{open:m,setOpen:y,token:w})]})},p$e=()=>{const{data:e,error:t,mutate:n}=An(wt("api/admin/user/profile"),f$e);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},f$e=e=>fetch(e).then(fn("Profile")).then(t=>t.json());var jk={},h$e=Sn;Object.defineProperty(jk,"__esModule",{value:!0});var zB=jk.default=void 0,g$e=h$e(wn()),m$e=xn,y$e=(0,g$e.default)((0,m$e.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");zB=jk.default=y$e;const jB=(e,t={})=>{const{isEnterprise:n}=xt(),{data:r,error:o,mutate:i}=Uc(!!e&&n(),void 0,wt(`api/admin/roles/${e}`),v$e,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},v$e=e=>fetch(e).then(fn("Role")).then(t=>t.json()),vc=e=>e.environment?`${e.id}-${e.environment}`:`${e.id}`,Cje=e=>e.reduce((t,n)=>(t[vc(n)]=n,t),{}),Eje=(e,t)=>{const n=gg(e);return n[vc(t)]?delete n[vc(t)]:n[vc(t)]={...t},n},Tje=(e,t)=>{const n=gg(e);return t.every(o=>n[vc(o)])?t.forEach(o=>{delete n[vc(o)]}):t.forEach(o=>{n[vc(o)]={...o}}),n},b$e=e=>e.filter(({name:n})=>n!=="ADMIN").reduce((n,r)=>{var a;const o=((a=r3e.find(l=>l.permissions.includes(r.name)))==null?void 0:a.label)||"Other",i=n.find(({label:l})=>l===o);return i?i.permissions.push(r):n.push({label:o,type:"root",permissions:[r]}),n},[]).sort(w$e),S$e=e=>{const t=e.filter(({type:o})=>o===L4e),n=e.filter(({type:o})=>o===N4e),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r},kje=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],w$e=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),x$e=S("div",{shouldForwardProp:e=>e!=="tooltip"})(({theme:e,tooltip:t})=>({width:"100%",maxWidth:e.spacing(50),padding:t?e.spacing(1):e.spacing(3),backgroundColor:t?e.palette.background.paper:e.palette.neutral.light,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:t?0:e.shape.borderRadiusMedium})),C$e=S("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),E$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),T$e=S("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),k$e=S(Vce)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),A$e=S("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),R$e=S("p")(({theme:e})=>({marginTop:e.spacing(.5)})),_$e=S("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),P$e=({roleId:e,tooltip:t,...n})=>{const{role:r}=jB(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=F4e.includes(l)?S$e(a):b$e(a);return x(x$e,{tooltip:t,...n,children:[x(T$e,{children:[s(k$e,{color:"disabled"}),o]}),s(R$e,{children:i}),s(V,{condition:!B4e.includes(r.type),show:()=>x(le,{children:[s(C$e,{children:"Role permissions:"}),s(E$e,{children:u.map(({label:d,permissions:p})=>x("div",{children:[s(A$e,{children:d}),s(_$e,{children:p.map(h=>s("li",{children:h.displayName},h.id))})]},d))})]})})]})},I$e=({roleId:e,children:t})=>{const{role:n}=jB(e.toString());return n?s(Ld,{title:s(P$e,{roleId:e,tooltip:!0}),arrow:!0,children:s(jt,{color:"success",icon:s(s5,{}),sx:{cursor:"pointer"},children:n.name})}):t?s(jt,{color:"success",icon:s(s5,{}),children:t}):null},O$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),$$e=S("div")(()=>({flexGrow:1})),N$e=S(re)(({theme:e})=>({fontSize:e.spacing(3.75)})),L$e=S(UE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),vO=S(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),D$e=S("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),M$e=S(jt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),B$e=S("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),F$e=S($s)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),z$e=S(Qh)(({theme:e})=>({backgroundColor:e.palette.background.paper})),j$e=({user:e})=>{const{profile:t}=p$e(),n=pt(),{locationSettings:r,setLocationSettings:o}=ha(),[i,a]=g.useState(),[l,c]=g.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);g.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return x(le,{children:[x(O$e,{children:[s(L$e,{user:e}),x($$e,{children:[s(N$e,{children:e.name||e.username}),s(re,{variant:"body1",children:e.email})]})]}),x(er,{children:[s(vO,{children:"Access"}),x(D$e,{children:[s(ye,{sx:{width:"50%"},children:s(V,{condition:!!(t!=null&&t.rootRole),show:()=>x(le,{children:[s(re,{variant:"body2",children:"Your root role"}),s(I$e,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),x(ye,{children:[s(re,{variant:"body2",children:"Projects"}),s(V,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>s(yt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(M$e,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(zB,{}),children:d})},d)),elseShow:s(yt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(jt,{children:"No projects"})})})]})]}),s(B$e,{}),s(vO,{children:"Settings"}),s(re,{variant:"body2",children:"This is the format used across the system for time and date"}),x(F$e,{variant:"outlined",size:"small",children:[s(z$e,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(Zh,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},U$e=()=>{const{user:e}=gi(),t=bo(),n=pt(),{config:r,loading:o}=$B("simple"),{uiConfig:i}=xt(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:f})=>f&&p.includes(f))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:x(P4e,{tabs:a,value:u,onChange:l,children:[s(V,{condition:u==="profile",show:s(j$e,{user:e})}),s(V,{condition:u==="password",show:s($4e,{})}),s(V,{condition:u==="pat",show:s(d$e,{})})]})},W$e=g.lazy(()=>Yd(()=>import("./CreateProject-556f9c57.js"),[])),H$e=g.lazy(()=>Yd(()=>import("./FeatureViewLazyExport-e2d57dd1.js"),[])),V$e=g.lazy(()=>Yd(()=>import("./LazyAdminExport-d83c093e.js"),[])),G$e=g.lazy(()=>Yd(()=>import("./LazyProjectExport-9d441d13.js"),[])),q$e=()=>{const{isEnterprise:e}=xt(),{data:t,error:n,mutate:r}=Uc(e(),{events:[]},wt("api/admin/logins"),K$e);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},K$e=e=>fetch(e).then(fn("Login History")).then(t=>t.json()),bO=S(ye)(()=>({display:"flex",justifyContent:"center"})),Y$e=({row:e,value:t})=>{const{searchQuery:n}=Nl();return t?s(bO,{children:s(jt,{color:"success",children:"True"})}):s(bO,{children:s(Ld,{arrow:!0,title:s(Ka,{search:n,children:e.original.failure_reason}),children:s(jt,{color:"error",children:"False"})})})},X$e=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=qn({propagateErrors:!0});return{downloadCSV:async()=>{const a=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(a.caller,a.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}},J$e={id:"created_at"},{value:SO,setValue:Q$e}=rs("LoginHistoryTable:v1",J$e),Z$e={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},eNe=()=>{const{events:e,loading:t}=q$e(),{downloadCSV:n}=X$e(),[r,o]=jh(),[i]=g.useState(()=>({sortBy:[{id:r.get("sort")||SO.id,desc:r.has("order")?r.get("order")==="desc":SO.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(i.globalFilter),c=ar(ca.breakpoints.down("sm")),u=ar(ca.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:C})=>s(FB,{value:C,dateFormat:B1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:fl,searchable:!0},{Header:"Authentication",accessor:C=>Z$e[C.auth_type]||C.auth_type,width:150,maxWidth:150,Cell:fl,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:fl,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Y$e,filterName:"success",filterParsing:C=>C.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:h,getSearchContext:f}=ag(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:v},setHiddenColumns:w}=nn.useTable({columns:d,data:p,initialState:i,sortTypes:ui,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:jn}},nn.useSortBy,nn.useFlexLayout);return Dd([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),g.useEffect(()=>{const C={};C.sort=v[0].id,v[0].desc&&(C.order="desc"),a&&(C.search=a),o(C,{replace:!0}),Q$e({id:v[0].id,desc:v[0].desc||!1})},[v,a,o]),x(er,{isLoading:t,header:s(kn,{title:`Login history (${y.length})`,actions:x(le,{children:[s(V,{condition:!u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:f})}),s(V,{condition:y.length>0,show:x(le,{children:[s(V,{condition:!u,show:s(kn.Divider,{})}),s(yt,{title:"Download login history",arrow:!0,children:s(Ft,{onClick:n,children:s(Tce,{})})})]})})]}),children:s(V,{condition:u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:f})})}),children:[s(ns,{value:h(a),children:s(D1,{rows:y,headerGroups:m,prepareRow:b})}),s(V,{condition:y.length===0,show:s(V,{condition:(a==null?void 0:a.length)>0,show:x(Fr,{children:["No login events found matching “",a,"”"]}),elseShow:s(Fr,{children:"No login events available."})})})]})},tNe=()=>{const{isEnterprise:e}=xt();return e()?s("div",{children:s(hB,{permissions:mi,children:s(eNe,{})})}):s(qM,{feature:"login-history",page:!0})},nNe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=qn({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},rNe=S("div")(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:e.spacing(4),position:"fixed",inset:0,backgroundColor:e.palette.background.paper,width:"100%"})),oNe=S(qL)(({theme:e})=>({height:"80px"})),iNe=S("div")(({theme:e})=>({display:"flex",position:"relative"})),aNe=S("div")(({theme:e})=>({marginTop:e.spacing(4)})),sNe=S(Ve)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),Uk=({children:e})=>{const t=pt();return x(rNe,{children:[x("div",{children:[s(oNe,{}),s(iNe,{children:s(re,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),x(aNe,{children:[s(Ve,{variant:"contained",color:"primary",onClick:()=>{t(Oo)},children:"Go back"}),s(sNe,{onClick:()=>{t("/")},children:"Go home"})]})]}),e]})},lNe=S(ye)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),cNe=S(ye)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),uNe=({featureType:e,loading:t})=>{const n=pt(),{uiConfig:r}=xt(),{refetch:o}=og(),{updateFeatureTypeLifetime:i,loading:a}=nNe(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:h}=Ot(),f=Bn(),m=C=>{const T=parseInt(kl(C.target.value),10);c(T),T===0&&d(!0)},y=C=>{d(C.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),v=async C=>{C.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature toggle type loaded");const T=u?0:l;await i(e.id,T),o(),p({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),f.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:T}})}catch(T){h(vt(T))}},w=g.useCallback(()=>[`curl --location --request PUT '${r.unleashUrl}/api/admin/feature-types/${e==null?void 0:e.id}/lifetime`,"--header 'Authorization: INSERT_API_KEY'","--header 'Content-Type: application/json'",`--data-raw '{
382
382
  "lifetimeDays": 7
383
383
  }'`].join(` \\
384
384
  `),[r,e==null?void 0:e.id]);return!t&&!e?s(Uk,{children:s("div",{"data-testid":"404_NOT_FOUND"})}):s(Nr,{modal:!0,title:t?"Edit toggle type":`Edit toggle type: ${e==null?void 0:e.name}`,description:(e==null?void 0:e.description)||"",documentationLink:"https://docs.getunleash.io/reference/feature-toggle-types",documentationLinkLabel:"Feature toggle types documentation",formatApiCode:w,children:x(cNe,{component:"form",onSubmit:v,children:[x(re,{sx:C=>({margin:C.spacing(3,0,1),display:"flex",alignItems:"center"}),children:[s(ye,{component:"label",htmlFor:"feature-toggle-lifetime",children:"Expected lifetime"}),s(Rs,{htmlTooltip:!0,tooltip:x(le,{children:[s("p",{children:"If your toggle exceeded lifetime of it's type it will be marked as potencially stale."}),s("br",{}),s("a",{href:"https://docs.getunleash.io/reference/feature-toggle-types#expected-lifetime",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})]})})]}),x(ye,{component:"label",sx:C=>({display:"flex",alignItems:"center",cursor:"pointer",marginBottom:C.spacing(1),marginRight:"auto"}),htmlFor:"feature-toggle-expire",children:[s(ts,{checked:u||l===0,id:"feature-toggle-expire",onChange:y,disabled:t}),s(ye,{children:"doesn't expire"})]}),s(cr,{autoFocus:!0,disabled:u||t,type:"number",label:"Lifetime in days",id:"feature-toggle-lifetime",value:u?"0":`${l}`,onChange:m,error:b}),x(lNe,{children:[s(Io,{permission:mi,variant:"contained",color:"primary",type:"submit",disabled:t||a,children:"Save feature toggle type"}),s(Ve,{type:"button",color:"primary",onClick:()=>n(Oo),children:"Cancel"})]})]})})},dNe=({featureTypes:e,loading:t})=>{const{featureTypeId:n}=_2(),r=e.find(o=>o.id===n);return s(uNe,{featureType:r,loading:t})},pNe="/feature-toggle-type",fNe=()=>{const{featureTypes:e,loading:t}=og(),n=pt(),r=g.useMemo(()=>[{accessor:"id",Cell:({value:d})=>{const p=s9(d);return s(d0,{icon:s(p,{"data-loading":"true",color:"action"})})},width:50,disableSortBy:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:d,description:p}}})=>s(Ya,{"data-loading":!0,title:d,subtitle:p}),sortType:"alphanumeric"},{Header:"Lifetime",accessor:"lifetimeDays",Cell:({value:d})=>d?s(jn,{children:d===1?"1 day":`${d} days`}):s(jn,{children:"doesn't expire"}),minWidth:150,sortType:"numericZeroLast"},{Header:"Actions",Cell:({row:{original:d}})=>s(ye,{sx:p=>({padding:p.spacing(.5,0)}),children:s(Tl,{children:s(Kr,{disabled:!d.id,"data-loading":"true",onClick:()=>n(`/feature-toggle-type/edit/${d.id}`),permission:mi,tooltipProps:{title:`Edit ${d.name} feature toggle type`},children:s(Ui,{})})})}),disableSortBy:!0}],[n]),o=g.useMemo(()=>t?Array(5).fill({id:"",name:"Loading...",description:"Loading...",lifetimeDays:1}):e,[t,e]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u}=nn.useTable({columns:r,data:o,sortTypes:ui,autoResetSortBy:!1,disableSortRemove:!0,initialState:{sortBy:[{id:"lifetimeDays"}]}},nn.useSortBy);return x(er,{isLoading:t,header:s(kn,{children:s(re,{component:"h2",sx:d=>({fontSize:d.fontSizes.mainHeader}),children:"Feature toggle types"})}),children:[x(da,{...i(),children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(d=>(u(d),s(ji,{hover:!0,...d.getRowProps(),children:d.cells.map(p=>s(Wi,{...p.getCellProps(),children:p.render("Cell")}))})))})]}),s(VN,{children:s(xf,{path:"edit/:featureTypeId",element:s(mg,{label:"Edit feature toggle type",onClose:()=>n(pNe),open:!0,children:s(dNe,{featureTypes:e,loading:t})})})})]})},hNe="/static/edge-mode-5d25949b.svg",gNe="/static/edge-offline-f6a0f761.svg",mNe="/static/edge-daisy-chaining-012bfdef.svg",yNe=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),vNe=S("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3)})),bNe=S("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(1)})),XS=S(re)(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1)})),SNe=S("a")({textDecoration:"none","&:hover":{textDecoration:"underline"}}),JS=S("figure")(({theme:e})=>({display:"flex",marginLeft:0,marginRight:0,marginTop:e.spacing(1.5),marginBottom:e.spacing(3),gap:e.spacing(1),flexDirection:"column"})),QS=S("figcaption")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary,textAlign:"center"})),wO={name:"unleash",displayName:"Unleash Edge",description:"Unleash Edge is the successor to the Unleash Proxy.",documentationUrl:"https://docs.getunleash.io/reference/unleash-edge",howTo:`Unleash Edge sits between the Unleash API and your SDKs and provides a cached read-replica of your Unleash instance. This means you can scale up your Unleash instance to thousands of connected SDKs without increasing the number of requests you make to your Unleash instance.